Coder Social home page Coder Social logo

connect-sdk-android-core's People

Contributors

anishlg avatar ashikachhabda avatar dung2le avatar hong-jeong-min avatar iheart2code avatar jiteshnayak2424 avatar jonghenhan avatar lgarl-jinyoung avatar lgcast-dev avatar oleksii-frolov avatar sanghyuk777lee avatar se-bastiaan avatar seokhee-lee avatar simongladkoskok avatar tomas1885 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

connect-sdk-android-core's Issues

Apple TV tvOS 10.2 require device pairing

The HTTP connection to Apple TV with tvOS 10.2 it's no longer working since device pairing is required. Unfortunately there is no documentation on how to do that.
We see that some commercial app as AirParrot from Squirrel has been able to do that.

Need to support various port numbers changed dynamically for webOSTVService

webOS is applying to various areas such as Auto, OSE. Although webOS TV is using fixed port number 3001, it can be changed dynamically In the other device platforms. So it is needed to support various port numbers changed dynamically for webOSTVService by detecting them during service discovery procedure.

ServiceCommandError when casting a song

We have a casting application which uses this library to cast songs to a TV
The issue we are experiencing often and quite random, is that at some point, generally when changing audio tracks, or at the beginning of a track, we get "ServiceCommandError"
We use 1.6 library version
I have attached the log snippet:
...
10-05 19:38:20.430 8537-8537/? E/: com.connectsdk.service.command.ServiceCommandError: Internal Server ErrorInternal Server Error
10-05 19:38:20.430 8537-8537/? E/: com.connectsdk.service.command.ServiceCommandError: Internal Server Error
10-05 19:38:20.430 8537-8537/? E/: at com.connectsdk.service.DLNAService$6.run(DLNAService.java:834)
10-05 19:38:20.430 8537-8537/? E/: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
10-05 19:38:20.430 8537-8537/? E/: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
10-05 19:38:20.430 8537-8537/? E/: at java.lang.Thread.run(Thread.java:818)
...
I have investigated the matter and the error seems to be generated here, as we do not get a proper 200 response:
"try {
HttpConnection connection = createHttpConnection(targetURL);
connection.setHeader("Content-Type", "text/xml; charset=utf-8");
connection.setHeader("SOAPAction", String.format(""%s#%s"", serviceURN, method));
connection.setMethod(HttpConnection.Method.POST);
connection.setPayload(payload);
connection.execute();
int code = connection.getResponseCode();
if (code == 200) {
Util.postSuccess(command.getResponseListener(), connection.getResponseString());
} else {
Util.postError(command.getResponseListener(), ServiceCommandError.getError(code));
}
} catch (IOException e) {
Util.postError(command.getResponseListener(), new ServiceCommandError(0, e.getMessage(), null));
}"

Could you please investigate this issue
Thank you

LG WebOS audio output control?

I’m trying to figure out how to control the audio output on WebOS TVs (from built-in speakers to optical or ARC out).

Is there an API call to do that?

Internal Server error when connecting with DLNA

Hi,
I am going to test with LG DLNA tv for video and image beam but the error occur Internal server error . On the other hand,Working fine with FireTv ,chromecast and WebOS.
what is the issue with this

ScreenOnOffReceiver file not found

Only one file is mentioned in manifest and it is missing. Please guide me on it to write that receiver if any special functionality is written in it. Which main service would be initialised on Screen ON and OFF

Failed to connect to Google Cast device (Chromcast)

Hi,

I am developing a TV Remote control application. I am only discovering CastService and DLNAService devices. After getting the devices list. I select a device and try to connect it with the below code.

`
deviceModel.connectableDevice.addListener(connectableDeviceListener)
deviceModel.connectableDevice.setPairingType(DeviceService.PairingType.MIXED)
deviceModel.connectableDevice.connect()

`

After a few seconds, I only receive a callback in onDeviceDisconnected() method. nothing else is happening. After some deep debugging, I found that the error states that Failed to connect to Google Cast Device.

I have no idea about what is going wrong here. Am I missing something ?

Also, What should I set in .setPairingType(PairingType) as I have tried all the PairingTypes but of no use.

Excessive device heating and app freeze when running cast service discovery for more than few minutes

Hi,

We have integrated in our app the Connect SDK ver. "com.connectsdk:connect-sdk-android:1.6.0"
This is using the following discovery providers when the scan is started for Cast devices:

mDiscoveryManager.registerDeviceService(WebOSTVService.class, SSDPDiscoveryProvider.class);
mDiscoveryManager.registerDeviceService(NetcastTVService.class, SSDPDiscoveryProvider.class);
mDiscoveryManager.registerDeviceService(CustomDLNAService.class, SSDPDiscoveryProvider.class);
mDiscoveryManager.registerDeviceService(DIALService.class, SSDPDiscoveryProvider.class);
mDiscoveryManager.registerDeviceService(RokuService.class, SSDPDiscoveryProvider.class);
mDiscoveryManager.registerDeviceService(AirPlayService.class, ZeroconfDiscoveryProvider.class);
mDiscoveryManager.registerDeviceService(FireTVService.class, FireTVDiscoveryProvider.class);

  1. PRIMARY Issue description - Service Discovery:

With our original implementation, the LG SDK cast services scan was started at app start an was running in background, in order to make the cast icon appear dynamically when a service is found (similar somehow to what Chromecast SDK does).

The problem with this approach is that LG SDK scan(discovery) will cause excessive device heating and app freeze when the app is running for a while (like 30 min or more). Also this can be a problem for battery drain.
Basically the discovery is doing excessive scan work/load (generates a lot of logs), especially when no cast services are found on a network. (this never happens when using only Chromecast SDK).

Chromecast SDK seems to manage scans in a more friendly way and only scans periodically without performance impact. In contrast the LG SDK seems to scan all the time or at very short periods.

1.1) Expected behavior:
LG SDK scan logic should be able to scan for device in background without generating excessive device heating and app freeze (load). Scan for devices only at reasonable periods of time.

1.2) Temp workaround done on our side until above issue is fixed:
Currently we are forced to start the LG SDK scan only when the "CastRouteChooserDialog" is opened (via cast icon), in order to present the found services, and stop the scan when the "CastRouteChooserDialog" is closed, this is to reduce as much as possible overall run time for LG SDK scan.

1.3) Exceptions:
The exception for (1.2) is FireTVService, for which we are forced to keep the scan ON while connected to an Amazon cast device, limitation imposed by Amazon’s Fling SDK way of working.
In this case we only close the overall scan after we have a fail/disconnect from the connected Amazon cast device.

This behavior is the source for the second issue found for FireTVDiscoveryProvider.

  1. SECONDARY Issue description - Amazon FireTVService casting and "FireTVDiscoveryProvider" stop:

In the current version of LG SDK, when the we call stop() method on "DiscoveryManager", it stops all
discovery providers (as expected).

The problem is that "FireTVDiscoveryProvider" does something extra that should NOT DO - in it's STOP method it also triggers a device disconnect in addition to stopping the provider scan. No other discovery provider does this.

2.1) Expected behavior:
Discovery Provider scan state should never interfere with the service connection state, even in the exceptional case (1.3) when we depend on scan to be ON for Amazon devices. If scan is off during Amazon cast, session should fail in a friendly way.
LG SDK should permit us to run (keep alive) only the Fire TV Discovery Provider while casting to amazon devices, without forcing us to keep other providers active.

Also instead of having the disconnect called in "FireTVDiscoveryProvider" stop method, LG SDK should only trigger the disconnect as a result of normal disconnect (manual etc) event.

2.2) Temp workaround done on our side until (1) or (2) are fixed:
We have a custom "FireTVDiscoveryProvider" for which we have removed the unwanted disconnect call.
Also we keep all scans active while we are connected to an amazon device.
When we receive a connection fail or disconnect (manual etc) event for an Amazon device, we stop the scans by calling the "DiscoveryManager" stop inside a dedicated "ConnectableDeviceListener" found in our "MediaRouteActionProvider".

If issue (1) can be fixed, we will no longer need to do the workarounds from issue (2).

Regards

Toast Notification Icon not displayed on WebOS 3.0

Although the sendToast() was working properly with WebOS 2.0, it is not working with WeboOS 3.0! The icon is never displayed in WebOS 3! Neither if you grab it from your resources and it's converted, nor when you save a BASE64 image as a string value in string resources. I've tried all possible ways, but none works.

I believe that either the Base64 is no longer supported by WebOS 3.0, or the whole payload is wrong.

SSDPDiscoveryProvider crashes with StringIndexOutOfBoundsException

We see a lot of crashes generated by SSDPDiscoveryProvider from our app that is published on the Google Play store.

java.lang.StringIndexOutOfBoundsException: length=1024; regionStart=0; regionLength=-1
at java.lang.String.startEndAndLength(String.java:588)
at java.lang.String.substring(String.java:1475)
at com.connectsdk.core.upnp.ssdp.SSDP$ParsedDatagram.()
at com.connectsdk.core.upnp.ssdp.SSDP.convertDatagram()
at com.connectsdk.discovery.provider.SSDPDiscoveryProvider$4.run()
at java.lang.Thread.run(Thread.java:841)

We are currently using the 1.3 library version.

Please check and make sure these are fixed in newer library versions and if possible to provide a patch for the 1.3 lib.

PS. While previous lib versions like 1.2.x also generated crashes because of SSDPDiscoveryProvider.sendSearch() Timers, these appear to be fixed in 1.3.

[Question] Is it possible for Reverse communication - From WebOS Tv to Android app?

Is it possible for reverse communication from WebOS tv to Android app?

I am wondering if we can get inputs (keycodes & mouse movements) from an LG magic remote and send it to an Android App? I am looking to see the possibility of using a magic remote as a remote for an android app.

All examples talk about sending inputs from an Android app to the TV. But there is none about reverse communication.

MouseControl continuously requesting pointer input socket.

I'm working with Android app that translates Gyroscope data to TV cursor movements.
You can find test source code at https://github.com/alexey-odintsov/MouseSocketTest (it's short).

Currently I'm migrating project from ConnectSDK 1.4 to 1.5 Lite and encountered a problem:
Every time gyroscope data comes my code checks MouseControl availability and invokes move method:

public class App extends Application {
    public static ConnectableDevice tv;

    // return MouseControl
    public static MouseControl getMouse() {
        if (tv != null && tv.isConnected()) {
            return tv.getCapability(MouseControl.class);
        } else {
            return null;
        }
    }
    ...
}

class MySensorsListener implements SensorEventListener {
    // this method is invoked continuously every N millisecond
    public void onSensorChanged(SensorEvent event) {
        ...
        if (App.getMouse() != null) {
            App.getMouse().move(dx, dy);
        }
    }
}

public class MainActivity extends AppCompatActivity {
    ...
    // connected to device
    public void onDeviceReady(ConnectableDevice device) {
        if (App.getMouse() != null) {
            App.getMouse().connectMouse();
        }
    }
}

With ConnectSDK 1.4.2 this code works great, but with ConnectSDK 1.5 mouse movements sometimes don't work.

It seems that mouseSocket is not ready and it's created every time move method invoked.

Normal working socket logs are:

webOS Socket [IN] : {"type":"hello","payload":{...}}
webOS Socket [OUT] : {"type":"register","id":3,"payload":{...}}
webOS Socket [IN] : {"type":"registered","id":3,"payload":{...}}
webOS Socket [OUT] : {"type":"subscribe","id":"1","uri":"ssap:\/\/com.webos.service.ime\/registerRemoteKeyboard"}
webOS Socket [IN] : {"type":"response","id":"1","payload":{"subscribed":true}}
webOS Socket [OUT] : {"type":"request","id":"4","uri":"ssap:\/\/com.webos.service.networkinput\/getPointerInputSocket"}
webOS Socket [IN] : {"type":"response","id":"4","payload":{"socketPath":"wss://192.168.0..../netinput.pointer.sock","returnValue":true}}

Socket logs when mouse is not working:

webOS Socket [IN] : {"type":"hello","payload":{...}}
webOS Socket [OUT] : {"type":"register","id":3,"payload":{...}}
webOS Socket [IN] : {"type":"registered","id":3,"payload":{...}}
webOS Socket [OUT] : {"type":"subscribe","id":"1","uri":"ssap:\/\/com.webos.service.ime\/registerRemoteKeyboard"}
webOS Socket [IN] : {"type":"response","id":"1","payload":{"subscribed":true}}
webOS Socket [OUT] : {"type":"request","id":"4","uri":"ssap:\/\/com.webos.service.networkinput\/getPointerInputSocket"}
webOS Socket [OUT] : {"type":"request","id":"5","uri":"ssap:\/\/com.webos.service.networkinput\/getPointerInputSocket"}
webOS Socket [OUT] : {"type":"request","id":"6","uri":"ssap:\/\/com.webos.service.networkinput\/getPointerInputSocket"}
webOS Socket [OUT] : {"type":"request","id":"7","uri":"ssap:\/\/com.webos.service.networkinput\/getPointerInputSocket"}
webOS Socket [OUT] : {"type":"request","id":"8","uri":"ssap:\/\/com.webos.service.networkinput\/getPointerInputSocket"}
webOS Socket [OUT] : {"type":"request","id":"9","uri":"ssap:\/\/com.webos.service.networkinput\/getPointerInputSocket"}
webOS Socket [OUT] : {"type":"request","id":"10","uri":"ssap:\/\/com.webos.service.networkinput\/getPointerInputSocket"}
webOS Socket [OUT] : {"type":"request","id":"11","uri":"ssap:\/\/com.webos.service.networkinput\/getPointerInputSocket"}
...
webOS Socket [OUT] : {"type":"request","id":"50","uri":"ssap:\/\/com.webos.service.networkinput\/getPointerInputSocket"}

I've found a workaround by exposing isMouseConnected API inside WebOSTVService class and updating MouseControl interface method signature:

public boolean isMouseConnected() {
        return mouseSocket != null && mouseSocket.isConnected();
}

And by adding checking to my code:

if (App.getMouse() != null && App.getMouse().isMouseConnected()) {
    App.getMouse().move(dx, dy);
}

But I believe there is something must be done with MouseControl socket creation logic.

"hh:mm:ss" should be "HH:mm:ss" or it will have trouble with 12 hours of videos.

The code below on DLNAService works fine except for 12 hours of video. It considers 12 to be zero because hh is used instead of HH.

 private long convertStrTimeFormatToLong(String strTime) {
        long time = 0;
        SimpleDateFormat df = new SimpleDateFormat("hh:mm:ss");

        try {
            Date d = df.parse(strTime);
            Date d2 = df.parse("00:00:00");

            time = d.getTime() - d2.getTime();
        } catch (ParseException e) {
//            e.printStackTrace();
            Log.w("Connect SDK", "Invalid Time Format: " + strTime);
            return 0;
        }

        return time;
    }

DLNA & DIAL detection

My Sony Bravia television has support for DIAL and DLNA. But I suspect only one of these services is detected. If DIAL is discovered first, then DLNA is unavailable. If DLNA is discovered first, then DIAL is not available. Can that be the case?

TTL of SSDP search does not conform to the UPnP specification, causing some devices not being listed as renderers

DLNA renderers in a multi-router environment are not found

Steps to Reproduce

  1. Connect your android device (where Connect-SDK will run) in a router. This is the "main router".
  2. Connect a DLNA renderer (TV, Kodi/XBMC box, etc) in another router. This is the "secondary router".
  3. Connect the secondary router into the main router. Make sure both routers are in the same network, and that the computer and the renderer can "see" (ping) each other.
  4. Open the Connect-SDK application in the android device. The renderer will not be listed.

I have an LG TV (with builtin DLNA) and a Raspberry Pi running Raspbmc (with UPnP controller/renderer enabled). Both are connected in a wireless bridge router, which is connected into my main router. My android device, from where I run Connect-SDK, is connected into the main router. With this setup, Connect-SDK does not list them as renderers. If I connect them directly into the main router, Connect-SDK will show them.

I looked into the code, and it seems that the library does not set the proper value of TTL when searching for devices. According to the UPnP Specification:

To limit network congestion, the time-to-live (TTL) of each IP packet for each multicast message should default to 4 and should be configurable. When the TTL is greater than 1, it is possible for multicast messages to traverse multiple routers; therefore control points and devices using non-AutoIP addresses must send an IGMP Join message so that routers will forward multicast messages to them (this is not necessary when using an Auto-IP address, since packets with Auto-IP addresses will not be forwarded by routers).

Possible Fix

By inspecting the packet of SSDP M-SEARCH with Wireshark, it is indeed set as TTL=1, while it should be set as TTL=4.

In Java, it's possible to do that by calling setTimeToLive in the socket object. This method is available only to Multicast sockets.

I looked into Connect-SDK's code, and noticed that a Datagram socket is used to send the SSDP search. It should actually be of the Multicast type, so that we could call socket.setTimeToLive(4) before binding it.

I tried to fix it myself, and now both my TV and Kodi are listed as renderers. I could issue a pull request with my simple fix, but was not sure if the way I did was the best way, so I decided to report my findings with all the details, so that you could handle it properly.

Error not to save client key in WebOSTVService (master)

In current master branch, there is an error not to save client key in WebOSTVService and it causes that webOS TV always asks user confirmation to pairing. If it is saved in Android mobile and 'register' command is requested with it, no more pairing process is needed.

Fails to capture all capabilities

I'm using this sample to connect to a TV,
Firstly its not pairing via Code,
Secondly, on direct connection to Tv it not accessing all the capabilities, It is only accessing VolumeKey and MediaContol keys, all other's are disabled.
How get access for number key controls and KeyCotrols interface and PowerControl.

Need another pairing level for WebOSTVService

webOS has three levels of permission: Open, Protected, and Secure (Personal Activity). Open does not need pairing process but Protected and Secure need pairing process for user to confirm the permission. Although Protected does not ask user's confirmation if there is pairing information, Secure always needs it. To support this different behaviors according to permission level, more various pairing level is needed. Now it only has OFF and ON.

launchYoutubeApp locks after launching the app on chromecast

Hi,

I am trying to integrate the sample app using the updated connect-sdk library,
below is the code
getLauncher().launchYouTube("bB3aZzsZSOE", (float)0.0, new Launcher.AppLaunchListener() {

                @Override
                public void onSuccess(LaunchSession session) {
                    testResponse =  new TestResponseObject(true, TestResponseObject.SuccessCode, TestResponseObject.Launched_Youtube);
                    Toast.makeText(MainActivity.this, "ChromeCastResponse:-"+testResponse.httpResponseCode+", "+testResponse.responseMessage+", "+testResponse.isSuccess, Toast.LENGTH_LONG).show();
                    setRunningAppInfo(session);
                }

                @Override
                public void onError(ServiceCommandError error) {
                    Toast.makeText(MainActivity.this, "Error casting to chromecast"+error.getMessage(), Toast.LENGTH_LONG).show();
                }
            });

this opens the youtube app and after that nothing happens, no video is played at all, where as in the respose, i get the http status as 200 and isSuccess as true.

MediaControl.PlayStateListener.onError() called instead of onSuccess()

Hello,

We have an issue regarding this library (we use 1.6 version):

By selecting any type of media (photo, media or music), we successfully connect to a Roku device, the MediaPlayer.LaunchListener.onSuccess(MediaPlayer.MediaLaunchObject object) gets called.
Here we check if we have a MediaPlayer.MediaLaunchObject.mediaControl, and if we do, we register a MediaControl.PlayStateListener to be informed of the media play status
The onSuccess(MediaControl.PlayStateStatus object) callback should be called, but instead the onError(ServiceCommandError error) gives us the "com.connectsdk.service.command.NotSupportedServiceCommandError" error object.
The error.getCode() returns 0 (zero value) and error.getPayload() returns null, so I don't have any way of knowing what the error means

However, the media selected continues to play, we can select another media and that will also be casted correctly, but each time we select another media, we get the onError(), instead of the onSuccess() callback and we need to know that the Status has changed to PlayStateStatus.Playing

Can you please tell me why this is happening,

Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.