yokkals 0 Posted May 22, 2015 Share Posted May 22, 2015 Hey guys, I want to write an external (for now) tool to fling HTTP Live Streaming (m3u8) URLs to my client devices. It would be ideal to have this working for Chromecast, DLNA, and Emby clients -- although if I had to pick one, it would be Chromecast. Unfortunately, my WD TV Live players don't play them, and Chromecast is CORS-enabled, so I'd have to set up a proxy for that. I'm wondering (hoping) there's a way to tell Emby: "play this web URL on Device X" and have Emby do the heavy lifting to figure out what that device needs, and deliver it. Here's an example URL that I've been testing with (to no avail): http://www.nasa.gov/multimedia/nasatv/NTV-Public-IPS.m3u8 Is there a way, either with the REST API or Client API, to do this? If not, how much effort would it take to add support for something like this? Admittedly, my weak spot is media codecs and related topics , but if someone could point me to the right classes / methods, I can take a stab at it. Link to comment Share on other sites More sharing options...
Luke 37060 Posted May 22, 2015 Share Posted May 22, 2015 we don't currently have raw url, so it does already have to be a library item. that said it could probably be figured out by having the remote control api quickly generate a library record based off a url. but have you tried the IPTV plugin? that's what this is intended for. Link to comment Share on other sites More sharing options...
yokkals 0 Posted May 22, 2015 Author Share Posted May 22, 2015 Excellent, thanks! This works on my Chromecast at least (not WD TV), so IPTV looks good. For the curious folks reading this, I'm going to try the following steps: Grab an HLS URL via my own code (outside of Emby) Loop through [GET] /Plugins to find the ID for the "IPTV" plugin /Plugins/<ID>/Configuration, using my HLS URL and the default user's ID: {"Bookmarks": [{ "Name": "NASA", "Image": "", "Path": "http:\/\/www.nasa.gov\/multimedia\/nasatv\/NTV-Public-IPS.m3u8", "Protocol": "Http", "UserId": "43933940f6c94baa93f891564b60a3e5" }]} Get a Session ID to play with (find the Chromecast device and select it, I'm guessing -- just inspect Firebug in the Emby web client for this) Grab the Item ID for the bookmark created in #3 (same as above, just find out what to call via Firebug) /Sessions/<Session ID>/Playing?ItemIds=<Item ID>&PlayCommand=PlayNow By the way, my ultimate goal for this is to use Tasker+AutoVoice on my android phone to say things like "play channel <name> on <device>" -- so I could say "play channel NASA on master chromecast" and it would start streaming whatever channel I have mapped to "NASA" in my own system on a device that is called "master chromecast". Could be either static or dynamic URLs (the NASA example is static), so that's why I need to use the Emby API. Somewhat related note: It would be really cool if voice commands were built into Emby. Capturing voice commands in Android is trivial (so I'm guessing other platforms are as well), and I already have some code/logic (external) that I wrote to query my Plex server for movies / TV shows that I want to play. It does phonetic matching to assist with "close enough" phrases (e.g. "southpark" = "south park"). Should be easy enough to bring to Emby, if those features are wanted. Link to comment Share on other sites More sharing options...
Luke 37060 Posted May 22, 2015 Share Posted May 22, 2015 Yes they are, just list out the desired commands and we can look into it. Link to comment Share on other sites More sharing options...
yokkals 0 Posted May 22, 2015 Author Share Posted May 22, 2015 Here's a list of the voice commands I set up: play|watch movie <moviename> [on <devicename>] play|watch random|any movie with actor <actorname> [on <devicename>] play|watch random|any movie with genre <genre> [on <devicename>] play|watch random|any episode of|for <tvshowname> [on <devicename>] play|watch latest|newest|recent episode of|for <tvshowname> [on <devicename>] play|watch next episode of|for <tvshowname> [on <devicename>] play|watch|shuffle playlist <playlistname> [on <devicename>] Then ideally.... play game <gamename> with <gamesystem> [on <devicename>] play|watch channel <Live TV channel name/number or IPTV channel name> [on <devicename>] "on <devicename>" is optional if there's only 1 device (or a default device). Link to comment Share on other sites More sharing options...
Luke 37060 Posted May 22, 2015 Share Posted May 22, 2015 right. we have those kinds of commands already it's just that you have to piece together the information yourself. In other words, search for the movie with a given name then remote play it to the client you want. we can always look to add shortcuts such as these but in the meantime, it's still possible without them Link to comment Share on other sites More sharing options...
yokkals 0 Posted May 23, 2015 Author Share Posted May 23, 2015 I followed my steps outlined above, and I'm getting an error when calling: http://localhost:8096/Sessions/<SessionID>/Playing?ItemIds=<ItemID>&PlayCommand=PlayNow&api_key=<ApiKey> {"ErrorCode":"ArgumentException","Message":"Nexus Player is unable to play the requested media type.","StackTrace":"[Play: 5/23/2015 6:49:30 AM]:\n[REQUEST: {Id:fceb3e87a08a063b3d1b837adbd2af5b,ItemIds:2671664d29e9718348f8b007209d7b4a,PlayCommand:PlayNow}]\nSystem.ArgumentException: Nexus Player is unable to play the requested media type.\r\n at MediaBrowser.Server.Implementations.Session.SessionManager.SendPlayCommand(String controllingSessionId, String sessionId, PlayRequest command, CancellationToken cancellationToken)\r\n at MediaBrowser.Api.Session.SessionsService.Post(Play request)\r\n at lambda_method(Closure , Object , Object )\r\n at ServiceStack.Host.ServiceExec`1.<>c__DisplayClass6.<CreateExecFn>b__5(Object service, Object request)\r\n at ServiceStack.Host.ServiceRunner`1.Execute(IRequest request, Object instance, TRequest requestDto)","Errors":[]} One thing I noticed is that the Chromecast devices don't come back in my call to /Sessions?ControllableByUserId=<UserId> Then, just /Sessions returned the Chromecast devices, but looks like it's having trouble playing that IPTV video item (error above). I can stream the video to Chromecast (normal CC and Nexus Player) in both the Emby Web Client, as well as the Android client, by doing it manually. Am I missing the appropriate API call to make this happen? It seems that Chromecast might be 'played to' a little differently. Link to comment Share on other sites More sharing options...
ebr 14910 Posted May 23, 2015 Share Posted May 23, 2015 If you are trying to play to the Emby ATV app on your Nexus Player it doesn't support that yet. That is what the message is telling you. Link to comment Share on other sites More sharing options...
yokkals 0 Posted May 23, 2015 Author Share Posted May 23, 2015 Ah, good to know. That's not what I'm trying though -- the "client" I'm trying to play to is named "Chromecast" (either for the Nexus Player, or a regular Chromecast stick). I see, for the session object, that "SupportsRemoteControl = false" and that PlayableMediaTypes and SupportedCommands are both empty arrays. It looks like when I'm idle for a while, then call /Sessions, I don't get the Chromecast sessions. But, when I use the Emby Web Client to connect to a Chromecast device, that device will then show up under /Sessions. The Emby Web Client appears to rely on the Chromecast browser plugin though. So, I'm wondering if there's a good way to establish a 'real' session to a Chromecast device, sort of like the Android app does. But I can't use Firebug on that to know which calls are being made. Any pointers? Link to comment Share on other sites More sharing options...
Luke 37060 Posted May 23, 2015 Share Posted May 23, 2015 yes that's correct. the web client has to establish a session with chromecast first and that requires user interaction to click on the extension Link to comment Share on other sites More sharing options...
yokkals 0 Posted May 23, 2015 Author Share Posted May 23, 2015 Are there any REST API endpoints available to establish a Chromecast session by itself (i.e. what does the Android app do)? I see I can post /Sessions/Capabilities, but not sure if that would do anything useful. Link to comment Share on other sites More sharing options...
Luke 37060 Posted May 23, 2015 Share Posted May 23, 2015 no, it requires user interaction. those are the rules of the google cast javascript sdk. the android and ios sdk's are different. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now