samsungctl icon indicating copy to clipboard operation
samsungctl copied to clipboard

Launch app on tv

Open Mcgurk125 opened this issue 8 years ago • 141 comments

Apologies, if this is not worth creating a new issue for... its more of a question.

The Samsung Smart View application - Link - has the ability to launch apps on the TV (Netflix, Plex etc.) - I was wondering if it was possible to replicate these calls?

Mcgurk125 avatar Jan 19 '18 09:01 Mcgurk125

Not currently supported, but I am accepting patches if you are able to reverse engineer the protocol.

Ape avatar Jan 23 '18 08:01 Ape

So after a day of hacking up some controls for our tvs (we have a wall of them)

{"method":"ms.remote.control","params":{"Cmd":"Move","Position":{"x":-1000,"y":1000,"Time":"1518675746190"},"TypeOfRemote":"ProcessMouseDevice"}}

Send in rapid succession after getting a json blob on the websocket saying that mouse mode is enabled (don't have the actual message handy, sorry)

{"method":"ms.channel.emit","params":{"event": "ed.apps.launch", "to":"host", "data":{"appId": "org.tizen.browser", "action_type": "NATIVE_LAUNCH"}}}

Launch an app, nfi how to change parameters or give it a url, we just set our home page to various dashboards (actually I wrote a tool that redirects the tv to the dashboard based on ip because typing on these tvs suck)

There's .a DEEP_LINK action type, but that seems to be for webapps, which has slightly different arguments.

{"method":"ms.channel.emit","params":{"event": "ed.installedApp.get", "to":"host"}}

List installed apps.

the last two are probably only supported on tvs that have "EDEN_available":"true" in their isSupport list

freman avatar Feb 16 '18 07:02 freman

Awesome work, do you http post this to web service, do you know which port?

Mcgurk125 avatar Feb 16 '18 20:02 Mcgurk125

Just sent up the same websocket the button presses are sent

freman avatar Feb 17 '18 01:02 freman

Quick question, I tried this last night replacing the key with json you gave, however it just sends an array of commands rather than a block. Any chance you can share your tool or just bash cmd used? Many thanks

Mcgurk125 avatar Mar 06 '18 17:03 Mcgurk125

My code is written in Go, but here's a sample in javascript that should start the browser.

NB, the tv will prompt for permission so you'll need to grant that and run the code twice

ws = new WebSocket('ws://10.10.1.21:8001/api/v2/channels/samsung.remote.control');
ws.onopen = function() {ws.send('{"method":"ms.channel.emit","params":{"event": "ed.apps.launch", "to":"host", "data":{"appId": "org.tizen.browser", "action_type": "NATIVE_LAUNCH"}}}')};
ws.onmessage = function(e) {console.log(e)}

freman avatar Mar 08 '18 23:03 freman

Much appreciated!

Mcgurk125 avatar Mar 09 '18 05:03 Mcgurk125

and launching a url...

{"method":"ms.channel.emit","params":{"event": "ed.apps.launch", "to":"host", "data":{"appId":"org.tizen.browser","action_type":"NATIVE_LAUNCH","metaTag":"http:\/\/hackaday.com"}}}

freman avatar Mar 22 '18 03:03 freman

If you need to send text, base64 encode your string

{"method":"ms.remote.control","params":{"Cmd":"$BASE64ENCODEDSTRING$","TypeOfRemote":"SendInputString","DataOfCmd":"base64"}}

You must connect via wss on port 8002 if you want to send passwords, otherwise you have to post to a https url

edit: Here's some code

https://gist.github.com/freman/8d98742de09d476c4d3d9e5d55f9db63

freman avatar Mar 23 '18 03:03 freman

It is possible to obtain the channel list ?

marius1968 avatar Mar 24 '18 23:03 marius1968

@freman This is awesome! Quick question, any chance you figured out how to determine which app is currently open?

kristenmills avatar Apr 08 '18 20:04 kristenmills

@freman

Thanks for this awesome find. I've tried executing the javascript you posted but sadly it's not doing anything. I'm getting a response though but the browser is not opening on my tv. Is the app-id for the browser generic on all tv models? Also how would i go about retrieving a list of installed apps, i want to open netflix for example.

mr-romeijn avatar Apr 24 '18 11:04 mr-romeijn

I'm having some trouble launching Netflix. When I list all apps a big JSON list is returned among which: {'appId': '11101200001', 'app_type': 2, 'icon': '/opt/share/webappservice/apps_icon/FirstScreen/11101200001/250x250.png', 'is_lock': 0, 'name': 'Netflix'}

But when I send the following JSON over the websocket:

payload = json.dumps({
    "method": "ms.channel.emit",
    "params": {
            "event": "ed.apps.launch",
            "to": "host",
            "data": {
                "appId": "11101200001",
                "action_type": "NATIVE_LAUNCH"
                }
        }
    })

I get an error: ERROR:websocket:close status: 31522, but with org.tizen.browser as appId it works. Would really appreciate it if someone can help me with this.

maartenpeels avatar Apr 30 '18 01:04 maartenpeels

@maartenpeels For netflix and pretty much everything i've tried that wasn't the browser, you should use "action_type": "DEEP_LINK" instead of "action_type": "NATIVE_LAUNCH". Though a quick way to check that, anything with "app_type": 2 uses DEEP_LINK and I believe "app_type": 4 is NATIVE_LAUNCH.

kristenmills avatar Apr 30 '18 01:04 kristenmills

@marius1968 sorry not that I've looked for.

@kristenmills not that I've found, i'd also like to figure out how to see the current open tab in the browser, if you always assume the browser is empty it'll start a new tab (overloading our graphing service), if you always assume it'll work eventually it'll start up and open the 'featured' screen not the 'home' screen despite telling the damn thing to always go to the 'home' screen several times.

@nickyromeijn {"method":"ms.channel.emit","params":{"event": "ed.installedApp.get", "to":"host"}}

@maartenpeels it appears @kristenmills is correct, we only use it to open a web app and see our charts... somewhat unreliably but still easier than doing it by hand every day.

freman avatar Apr 30 '18 01:04 freman

@maartenpeels, @nickyromeijn, @kristenmills It's easier to use the dial protocol for the applications listed in dial registry (include Netflix, Youtube).

So, to identify if a particular application is installed you can use the call : curl -X GET -i 'yourIP:8001/ws/apps/Netflix' and and you will receive the answer : Netflixrunning6.0.003 OR Netflixstopped6.0.003

To launch the desired application you can use : curl -X POST -i 'http://yourIP:8001/ws/apps/Netflix' with response http://yourIP:8001/ws/apps/Netflix/run

@freman How on earth did you managed to identify this logs? The Samsung API documentation does not exist and I'm trying for 3 months (without success) for Samsung Tizen to get channel list and subscription to a channel/volume change event. Can you can give us a hint in this direction?

marius1968 avatar Apr 30 '18 05:04 marius1968

@marius1968 because I couldn't even get the app to work, mostly decompiling their app. Once I did manage to get the app working, tcpdump

freman avatar May 15 '18 00:05 freman

@freman you have no idea the brilliance of this. I have been researching this for over two months right now. Even got into some thread that the guys are trying to reverse engineering the encryption DLL as that was the, thinking as to why no one knows how to communicate with the TV. I have been testing some the codes and this works really well.

Got the Ws app taking to the TV accepted it as a authorised app, can navigate call apps, open browser etc.

Question: once accepting the connection on the TV, and you disconnect for example. When you reconnect my TV is far so didn't see the next time I connected if it asked again for allow? Once you allow the app do I have to. Do this again or will the same ws://ip:8001....app=basecode64 always work?

MyCodeRocks avatar May 16 '18 15:05 MyCodeRocks

Another Q anyone figure out where "/opt/share/webappservice/apps_icon/FirstScreen/11101200001/250x250.png" or any of the icons actually reside? Would be awesome in an app to show these.

MyCodeRocks avatar May 16 '18 15:05 MyCodeRocks

Anyone has able to get if some non-standard app is running?

I can get running status with http://X:8080/ws/apps/Netflix but I can't get if Deezer (3201608010191) or Spotify (3201606009684) is running.

Maybe there is a way using ws?

alexandre-leites avatar Jul 08 '18 23:07 alexandre-leites

@xalexslx only applications listed in Dial Registry ... for Spotify try com.spotify.Spotify

marius1968 avatar Jul 09 '18 04:07 marius1968

@marius1968 - Plex is listed in the DIAL registry as Plex - But i cant get it to load on my TV using the WS method above. YouTube works as does Netflix... Just not Plex unfortunately.

pegatron89 avatar Jul 09 '18 14:07 pegatron89

@marius1968 @pegatron89 Same as you. Tried both (Plex, Spotify, Deezer, Twitch) and it didn't worked, just Netflix and YouTube.

If there is a way to get app status via ws it will be good because we can just pass the AppId.

alexandre-leites avatar Jul 09 '18 14:07 alexandre-leites

@xalexslx a quick google and the App ID for plex is: 111199000681

https://forums.plex.tv/t/home-automation-start-plex-whats-your-appid/38276

Do you know how to pass the appID? I tried 192.168.0.62:8001/ws/apps/111199000681 on the off chance but this did not work.

pegatron89 avatar Jul 09 '18 14:07 pegatron89

Hello! At first thanks for this great possibility. For my understanding i have a question: What do you mean with DIAL Registry?

I tried to start Amazon with a curl Post. Netflix and youtube work great but Amazon doesnt. I got the Applicationname "Amazon Video" . It seems thtat curl cannot handle Applicationnames with a whitespace in it. I have to use the ApplicationID, but with ApplicationID i cant launch Amazon Video.

Any suggestions?

Best regards

DerGute avatar Jul 10 '18 07:07 DerGute

@DerGute Try one of the following instead of amazon video; com.amazon.mp3 Amazon primeLive com.amazon

There are more within the registry (see website below) I am at work at the moment so cant confirm if these work.

http://www.dial-multiscreen.org/dial-registry/namespace-database

pegatron89 avatar Jul 10 '18 13:07 pegatron89

I have tried several ids from DIAL Registry with installed apps on my Samsung TV. None of them worked except for YouTube and Netflix. It seems that Samsung doesn't follow the rules?

Also, I got all app ids using the following command from the websocket

{"method":"ms.channel.emit","params":{"event": "ed.installedApp.get", "to":"host"}}

And I can launch them with

{"method":"ms.channel.emit","params":{"event": "ed.apps.launch", "to":"host", "data":{"appId":"org.tizen.browser","action_type":"NATIVE_LAUNCH","metaTag":"http:\/\/hackaday.com"}}}

But I cant get current status of any running app except for YouTube and Netflix.

alexandre-leites avatar Jul 10 '18 16:07 alexandre-leites

Hi,

I downloaded the whole DIAL registry and ran against my Samsung TV using Postman runner. Unfortunately only Netflix, YouTube and Pandora was found using the DIAL ids.

Here are the list of my TV currently installed apps:

  • YouTube (Found)
  • Hulu
  • Plex
  • HBO NOW
  • Netflix (Found)
  • Web Browser
  • TV Plus
  • YouTube TV
  • e-Manual
  • Spotify
  • Asphalt 8: Airborne
  • Google Play Movies & TV
  • Amazon Video
  • TuneIn
  • SHOWTIME
  • NBC
  • NBC Sports
  • NFL SUNDAY TICKET
  • STARZ
  • FandangoNOW
  • Red Bull TV
  • Dramafever
  • CNBC Real-Time
  • Bloomberg TV
  • AccuWeather - Weather for Life
  • Pluto TV: TV for the Internet
  • CinemaNow
  • ENCORE Play
  • Pandora (Found)
  • Vimeo
  • YuppTV
  • The Weather Network
  • BBC News
  • TED
  • VUDU
  • NBA
  • UFC.TV
  • MLB.TV
  • iHeartRadio
  • Facebook
  • Deezer
  • HGTV
  • Food Network
  • Travel Channel
  • STARZ
  • CNNgo
  • Sotheby's
  • Steam Link
  • Pantaya
  • Sling TV
  • Amazon Music
  • Freeform
  • CBS All Access
  • CBS News: Live Breaking News
  • HBO GO
  • Emby
  • TwitchTV

alexandre-leites avatar Jul 11 '18 01:07 alexandre-leites

Here is, raw, a bunch of (3rd party) app_tizen_id's (to be completed if I find anymore). If some are not explicit enough, don't ask me which app they are: I don't know!

Ahw07WXIjx.Dailymotion
tisT7SVUug.tunein
cexr1qp97S.Deezer
xqqJ00GGlC.okidoki
4ovn894vo9.Facebook
vbUQClczfR.Wuakitv
QizQxC7CUf.PlayMovies
QBA3qXl8rv.Kick
DJ8grEH6Hu.arte
JtPoChZbf4.Vimeo
hIWwRyZjcD.GameFlyStreaming
sHi2hDJGmf.nolim
guMmq95nKK.CanalPlusLauncher
RN1MCdNq8t.Netflix / org.tizen.netflix-app
evKhCgZelL.AmazonIgnitionLauncher2 / org.tizen.ignition
9Ur5IzDKqV.TizenYouTube
gDhibXvFya.HBOGO
EmCpcvhukH.ElevenSports
ASUvdWVqRb.FilmBoxLive
rJeHak5zRg.Spotify
ABor2M9vjb.acc   (AccuWeather)
EkzyZtmneG.My5
yFo6bAK50v.Dennexpres
gdEZI5lLXr.Europa2FHD
bm9PqdAwjv.TvSme
dH3Ztod7bU.IDNES
wsFJCxteqc.OnetVodEden
rZyaXW5csM.TubaFM
4bjaTLNMia.curzon
RVvpJ8SIU6.ocs
bstjKvX6LM.molotov
RffagId0eC.SfrSport
phm0eEdRZ4.ExtraTweetIM2
VAarU8iUtx.samsungTizen   (Vevo)
g0ScrkpO1l.SmartIPTV
kIciSQlYEM.plex
...

zoelechat avatar Jul 13 '18 20:07 zoelechat

None of them worked with dial api.

alexandre-leites avatar Jul 15 '18 01:07 alexandre-leites