Jump to content


Photo

Xbox smart glass API csharp and emby plugin idea


  • Please log in to reply
19 replies to this topic

#1 chef OFFLINE  

chef

    Advanced Member

  • Developers
  • 3578 posts
  • Local time: 10:56 AM
  • LocationPeterborough, Canada

Posted 29 January 2019 - 11:08 AM

I was looking around GitHub recently and stumbled upon a netstandard library which controls Xbox through smart glass.

https://github.com/O...artglass-csharp

After fiddling with it for a couple days I was finally able to build the libraries.

So technically, and finally I have added these .dlls to an emby plugin.

But, alas I haven't quite got everything working together properly... It's taking me a while to completely understand what I'm supposed to do.

But I am confident that I can make a plug-in that controls Xbox.

This means starting the emby app from dashboard, shutting down the Xbox, and turning it on (turning it on is actually easy because you just have to send bits of data to the IP and it starts up from sleep).

I thought about creating a netstandard 2.0;net472 version if the library but building the project just wants to fail, so I'm back to the drawing board.

This is when I decided to piggy back on the emby netstandard 2.0 plug-in framework.

Maybe the plug-in should create API endpoints?

Maybe there is a way to host a virtual device for emby theater which is always on and cast-able, which triggers the Xbox to turn on, and open the emby app?

I dunno.

First thing first is get the smart glass library working properly.

I'm up for any ideas, if anyone wants to chime in.

Edited by chef, 29 January 2019 - 11:12 AM.


#2 jachin99 OFFLINE  

jachin99

    Advanced Member

  • Members
  • 515 posts
  • Local time: 10:56 AM

Posted 29 January 2019 - 11:41 AM

I have been looking at the python implementation but a server plugin would be cool especially if you could include game streaming, which I believe that project allows. 


  • chef likes this

#3 chef OFFLINE  

chef

    Advanced Member

  • Developers
  • 3578 posts
  • Local time: 10:56 AM
  • LocationPeterborough, Canada

Posted 29 January 2019 - 11:58 AM

I have been looking at the python implementation but a server plugin would be cool especially if you could include game streaming, which I believe that project allows.


Yes that part if the library is called Smartglass.Nano

I wonder if I'm good enough of a coder to do that?

#4 chef OFFLINE  

chef

    Advanced Member

  • Developers
  • 3578 posts
  • Local time: 10:56 AM
  • LocationPeterborough, Canada

Posted 29 January 2019 - 09:43 PM

OH YEAH! got it working! the Xbox one smart glass libraries are awesome. I can now completely control the xbox one.

 

The best part is that I can get Alexa to start Emby on my xbox one, then use the Alexa skill to control Emby!

 

This just got a whole lot more interesting.


  • jachin99 likes this

#5 jachin99 OFFLINE  

jachin99

    Advanced Member

  • Members
  • 515 posts
  • Local time: 10:56 AM

Posted 29 January 2019 - 10:45 PM

That's awesome!!!

#6 chef OFFLINE  

chef

    Advanced Member

  • Developers
  • 3578 posts
  • Local time: 10:56 AM
  • LocationPeterborough, Canada

Posted 29 January 2019 - 11:07 PM

Holy mackerel! We can stream games...

I wonder if can we stream Xbox one games to an emby channel?

But first, I gotta figure out how to get a list of games and apps from the console.

But holy macaroni, I've been waiting for something like this forever!!

#7 jachin99 OFFLINE  

jachin99

    Advanced Member

  • Members
  • 515 posts
  • Local time: 10:56 AM

Posted 29 January 2019 - 11:12 PM

I'm just as excited about this as you are!!! Well probably not but still really excited!!!



#8 chef OFFLINE  

chef

    Advanced Member

  • Developers
  • 3578 posts
  • Local time: 10:56 AM
  • LocationPeterborough, Canada

Posted 30 January 2019 - 12:30 AM


  • Luke likes this

#9 chef OFFLINE  

chef

    Advanced Member

  • Developers
  • 3578 posts
  • Local time: 10:56 AM
  • LocationPeterborough, Canada

Posted 30 January 2019 - 02:17 PM

@Luke,

 

Each Xbox One app has a {titleid} attached to it, and I'm pretty sure that these IDs are the same across the board.

 

Meaning that my xbox one emby theater app would have the same ID as yours.

 

If that is true, would you guys be alright with sharing the apps title id here on this thread?


Edited by chef, 30 January 2019 - 02:42 PM.


#10 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 119080 posts
  • Local time: 10:56 AM

Posted 30 January 2019 - 02:18 PM

that means you wouldn't be able to submit to the store,r ight?



#11 chef OFFLINE  

chef

    Advanced Member

  • Developers
  • 3578 posts
  • Local time: 10:56 AM
  • LocationPeterborough, Canada

Posted 30 January 2019 - 02:42 PM

that means you wouldn't be able to submit to the store,r ight?

 

Oh I didn't know that it was sensitive.

 

Smart glass uses it start apps on the console.

 

I think I can figure out another way to run apps.


Edited by chef, 30 January 2019 - 02:48 PM.


#12 chef OFFLINE  

chef

    Advanced Member

  • Developers
  • 3578 posts
  • Local time: 10:56 AM
  • LocationPeterborough, Canada

Posted 30 January 2019 - 03:27 PM

Oh this isn't in the Smartglass docs, but it is super important to implement. this finds the consoles live ID! Thank goodness.

 

And if you know the Name you gave your Xbox One, you can conditionally find the console name and then request the LiveId.

 

this will make device searching and connection much faster, with less user input and explaining for configuration in an emby plug-in.

 

But, the console would have to be on during first run of the plugin setup.

var discovered = await SmartGlass.Device.DiscoverAsync();
if (discovered.Count < 1)
{
    // No consoles discovered
    return;
}

// Enumerate first console
SmartGlass.Device device = discovered[0];
var liveId = device.Certificate.SubjectDN.GetValueList()[0];

var liveId;
foreach(var device in discovered)

{
   if(device.Name == "THE_CONSOLE_YOU_WANT")
   {
       liveId = device.Certificate.SubjectDN.GetValueList()[0];
   }
}


Edited by chef, 30 January 2019 - 03:29 PM.


#13 chef OFFLINE  

chef

    Advanced Member

  • Developers
  • 3578 posts
  • Local time: 10:56 AM
  • LocationPeterborough, Canada

Posted 30 January 2019 - 11:16 PM

The API sends event codes consistently. In order to wrap the code further, I'll wait and parse code until emby shows up and target the ACKMessages. Once it's been found, the emby configuration will kick in and save.



#14 chef OFFLINE  

chef

    Advanced Member

  • Developers
  • 3578 posts
  • Local time: 10:56 AM
  • LocationPeterborough, Canada

Posted 09 February 2019 - 04:15 PM

So back over here to this thread! I have been able to narrow my results and have found the title.Id for Emby theater.

 

I have been successful in creating an alexa controller for Xbox One.



#15 WilhelmStroker OFFLINE  

WilhelmStroker

    Advanced Member

  • Members
  • 127 posts
  • Local time: 03:56 PM

Posted 09 February 2019 - 08:20 PM

I use the official skill to yell stop, pause and play to my xbox which works well. Is yours any different or better?
  • chef likes this

#16 chef OFFLINE  

chef

    Advanced Member

  • Developers
  • 3578 posts
  • Local time: 10:56 AM
  • LocationPeterborough, Canada

Posted 09 February 2019 - 08:51 PM

I use the official skill to yell stop, pause and play to my xbox which works well. Is yours any different or better?


Well, not any different really.



But these commands will actually startup emby theater on your Xbox one. Turn off and on your Xbox one with Alexa.

Here in Canada you can't do that yet because Amazon has to translate everything en Francais...
So we get everything late...


Edited by chef, 10 February 2019 - 02:50 PM.


#17 chef OFFLINE  

chef

    Advanced Member

  • Developers
  • 3578 posts
  • Local time: 10:56 AM
  • LocationPeterborough, Canada

Posted 10 February 2019 - 02:40 PM

Okay, because I don't know where else to post my findings. What I have created is an OWIN  .NetCore based web service (Cross-platform).

 

What's cool about it is that it allows Alexa to control Xbox One.

 

Alexa has access to endpoints which switches Xbox One to Emby Theater, Netflix, The Xbox Dashboard.

 

Any playback/browsing options are then handed over to the Emby API when Emby is open.

 

It is pretty seamless so far.

 

Does it have anything to do, specifically with Emby?  No not really, other then starting up Emby Theater and handing control over to it's API.

 

Still a very cool project, and learning a lot of behind the scenes stuff regarding the Xbox One.

 

Not sure If I want to create a Plugin specifically for emby server or if it should stay standalone OWIN API app.

 

If it was an emby plugin, it could persist in the background as an emby api endpoint, and alexa could contact it.

 

If the endpoint was created, then the offical Alexa-Emby Skill could contact it for control.

 

And also, Google Home could also contact it for Xbox One control as well.

 

Still not sure.

 

 

Note: Luke mentioned it might not be allowed in the Emby store. I'm not sure if that is because it would host private information, like the title-Id for the emby theater app? Or if it is because of the libraries that are used to gain access to Xbox?

 

 

Also, Note: Accessing Smartglass is super finicky. The Client connection is nowhere as solid as the Emby Api Client. The Emby Client will persist until the end of time, the SmartGlassClient will lose connection for no reason.

 

I had to create a custom "heartbeat" function just to monitor it. Geesh!


Edited by chef, 10 February 2019 - 02:49 PM.


#18 chef OFFLINE  

chef

    Advanced Member

  • Developers
  • 3578 posts
  • Local time: 10:56 AM
  • LocationPeterborough, Canada

Posted 10 February 2019 - 06:43 PM

@Luke check this out sir!



#19 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 119080 posts
  • Local time: 10:56 AM

Posted 10 February 2019 - 06:53 PM

Cool, thanks !



#20 WilhelmStroker OFFLINE  

WilhelmStroker

    Advanced Member

  • Members
  • 127 posts
  • Local time: 03:56 PM

Posted 13 February 2019 - 11:40 AM

Well, not any different really.

But these commands will actually startup emby theater on your Xbox one. Turn off and on your Xbox one with Alexa.
Here in Canada you can't do that yet because Amazon has to translate everything en Francais...
So we get everything late...

Ah I'm in the UK so we're behind the US but obviously ahead of Canada. Cool stuff, great job.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users