Jump to content

Running Emby on Apple TV 3


sw1tchm4st3r

Recommended Posts

sw1tchm4st3r

Would anyone know if its possible to jailbreak the new apple tv3 to run MB3?

 

I know that it can run XMBC but was wondering if that applied to MB3 as well.

Link to comment
Share on other sites

  • 5 weeks later...

A feature request of mine would be a client for Apple TV, even if it requires the same Apple TV Trailers hack that Plex uses.

At the moment the hack requires installation of a self-signed SSL cert on the Apple TV, and to modify the DNS server IP entry on the Apple TV to point to some IP of a host running software to intercept requests and masquerade as Apple TV's Trailer server. See http://langui.sh/2013/08/27/appletv-ssl-plexconnect/ and http://elan.plexapp.com/2013/06/04/introducing-plexconnect-an-appletv-client-which-thinks-different/

 

What is stopping MB3 from pulling this off?

Link to comment
Share on other sites

A feature request of mine would be a client for Apple TV, even if it requires the same Apple TV Trailers hack that Plex uses.

At the moment the hack requires installation of a self-signed SSL cert on the Apple TV, and to modify the DNS server IP entry on the Apple TV to point to some IP of a host running software to intercept requests and masquerade as Apple TV's Trailer server. See http://langui.sh/2013/08/27/appletv-ssl-plexconnect/ and http://elan.plexapp.com/2013/06/04/introducing-plexconnect-an-appletv-client-which-thinks-different/

 

What is stopping MB3 from pulling this off?

 

The lack of enough ios developers. So go find us another, and perhaps we may do that.

Link to comment
Share on other sites

At the moment its cost prohibitive (and possibly something apple wouldnt allow) to make a real app, Plex works around that by just intercepting calls the Apple TV's native 'Trailers' app makes to trailers.apple.com . This is why a dev is not needing to develop an app on the ATV, just some server side plugin for MB3

 

see http://www.youtube.com/watch?v=E0zPkJS4fC0 for a short demo of what the hack looks like on the ATV.

Edited by BC101
Link to comment
Share on other sites

Then what are those plex presentation elements? you're saying those are not stored on the device?

 

it's a neat trick but it's still pretty lame, don't you think? 

  • Like 1
Link to comment
Share on other sites

@ebr: correct, check the youtube video http://www.youtube.com/watch?v=E0zPkJS4fC0 for how Plex has done it. Other Chinese and Russian movie providers have also done it this way to get their content onto ATV's.

Ex. of chinese interface: http://www.youtube.com/watch?v=wtIou93JVWs#t=140

 

@Luke: Lame or not, it gets you entry to the 6 million ATV Gen 3 devices out there without needing to develop a local client. Gen 2 is jailbreak-able and people would just install XMBC, but they miss out on 1080p output.

 

Plex proved this method works and isn't all that difficult to do. If a user has the skill to install MB3, they can do what it takes to get it working on an Apple TV gen 3 without too much hassle.

 

Someone could start a kickstarter for the dev of the MB3 plugin (to interface with the ATV) and I know i'd jump on that. Or sell the finished product in the plugin catalog, just beat Plex's price and I wouldn't think too many people would be opposed to pay for it.

Edited by BC101
Link to comment
Share on other sites

ok but you didn't quite answer my question. where to the plex presentation elements come from? that looks like a UI running on the box.

Link to comment
Share on other sites

Could rip it off from https://github.com/iBaa/PlexConnect if you wanted to see exactly how it responds to the HTTP requests from the ATV to build the UI. Edit: since 27th Aug 2013 the ATV uses HTTPS instead of HTTP to pull content from trailers.apple.com, thus the self-generated trailers.apple.com SSL cert needed to be installed on the ATV since that point.

Edited by BC101
Link to comment
Share on other sites

Apple TV != IOS afaik

 

It's a server side thing needed to spoof as the Apple TV Trailers App, but I don't even know what codecs ATV can support without transcoding needing to be done by the MB3 server software but that would be a awesome feature for the MB3 server to support.

 

Would it be considered a plugin/module to the MB3 server to support this? It would obviously need a developer but don't think they'd have to know too much or anything about IOS development.

Edited by BC101
Link to comment
Share on other sites

Looking at logs, XML files, javascript files, etc and trying to understand how PlexConnect instructs the Apple TV into talking to it  (using a <ATV> xml & javascript) then calling PMS for the backend info and displaying what it should display, without knowing a thing about advanced js/python is hard.

 

Just a first obstacle of trying to find a way to display MB3 users and let the ATV pick one is ... an interesting challenge for me.

 

Here's the first call it makes when loading the application I decided to spoof: WSJ (wall street journal) instead of Trailers app:

ATV> GET /mw2/api-video/appletv/wsjlive/main.js

WebServer> serves /js/application.js instead.
 
which contains
atv.onAppEntry = function()
{
    fv = atv.device.softwareVersion.split(".");
    firmVer = fv[0] + "." + fv[1];
    if (parseFloat(firmVer) >= 5.1)
    {
        // discover - trigger PlexConnect, ignore response
        var url = "{{URL(/)}}&PlexConnect=Discover&PlexConnectUDID="+atv.device.udid
        var req = new XMLHttpRequest();
        req.open('GET', url, false);
        req.send();
        
        // load main page
        atv.loadURL("{{URL(/PlexConnect.xml)}}&PlexConnectUDID=" + atv.device.udid);
    }
    else
 

ATV>

http request header:
Host: secure.marketwatch.com
X-Apple-Store-Front: 143455-6,19
Accept: */*
Accept-Encoding: gzip, deflate
Accept-Language: en;q=0.9
Cookie: kayla=g=2737a1b1xxxxxxxxxxxxxxxxxxxxxxxxxxx
Connection: keep-alive
X-Apple-TV-Resolution: 1080
X-Apple-TV-Version: 6.0.2
User-Agent: iTunes-AppleTV/6.0.2 (3; 8GB; dt:12)
http request path:
/&PlexConnect=Discover&PlexConnectUDID=DY5LMXXXXXXX
 
You can then differentiate Apple TV's by UDID.
Link to comment
Share on other sites

MongooseMan

Considering you're attempting to build only the second ATV media client in the world, with minimal dev experience, I don't think that's trivial at all.

 

fwiw, leave the hard stuff til last.

Take all the short cuts you can to get something playing:

-Hard code the user on the server-side

-Make assumptions

-Return only one video

 

I've found the difficult things become easier once you've tackled the "easy" things.

Edited by MongooseMan
  • Like 1
Link to comment
Share on other sites

Thanks,

I had to install Plex so I could find what format the ATV expected. I played with Transcoder Action setting , there's two settings , "Auto" is default , "DirectPlay" and "Transcode" are options.

 

Something that was widely known but I wanted to confirm for myself....

 

I found Apple TV didn't support the mkv served to it directly (in DirectPlay mode):

 

ATV> GET /library/parts/1/file.mkv?X-Plex-Token=gJQ25gK2hTJqY8DJmtf8 HTTP/1.1

PlexMediaServer>

HTTP/1.1 206 Partial Content

Cache-Control: public, max-age=604800
Accept-Ranges: bytes
Connection: close
Content-Range: bytes 0-1/1506329585
Content-Length: 2
Content-Type: video/x-matroska
X-Plex-Protocol: 1.0
 
It failed.
 
However my video worked in "Auto" mode (as it obviously would, as Plex is known working product on ATV and transcodes it to a format that works on the ATV)
ATV>
GET /video/:/transcode/universal/start.m3u8?maxVideoBitrate=3000&videoQuality=75&subtitleSize=100&fastSeek=1&session=DY5LXXXXX&audioBoost=100&protocol=hls&path=%2Flibrary%2Fmetadata%2F6&videoResolution=1280x720&directStream=1&X-Plex-Token=gJQ25gK2hTJqY8DJmtf8&X-Plex-Platform=iOS&X-Plex-Model=3%2C1&X-Plex-Client-Capabilities=protocols%3Dhttp-live-streaming%2Chttp-mp4-streaming%2Chttp-streaming-video%2Chttp-streaming-video-720p%2Chttp-mp4-video%2Chttp-mp4-video-720p%3BvideoDecoders%3Dh264%7Bprofile%3Ahigh%26resolution%3A1080%26level%3A41%7D%3BaudioDecoders%3Dmp3%2Caac%7Bbitrate%3A160000%7D&X-Plex-Client-Platform=iOS&X-Plex-Client-Identifier=DY5LXXXXX&X-Plex-Device=AppleTV&X-Plex-Product=PlexConnect&X-Plex-Platform-Version=6.0.2&X-Plex-Version=0.3.1%2B HTTP/1.1
Host: 24.XX.xx.xx:32400
X-Playback-Session-Id: B7649094-7CFC-4376-ADC3-68C360F82779
Accept-Encoding: gzip
Accept: */*
Accept-Language: en-us
Connection: keep-alive
User-Agent: AppleCoreMedia/1.0.0.11B554a (Apple TV; U; CPU OS 7_0_4 like Mac OS X; en_us)
Link to comment
Share on other sites

Is this the right call to make?:

http://localhost:8096/mediabrowser/Videos/9aa15e8dcc7b90989a977dfa068d9f6d/stream.m3u8?VideoBitRate=3000&AudioBitRate=200 (i used Swagger UI to generate that)

 

the important part is, to append  to the end of /mediabrowser/Videos/$videoID the /stream.m3u8?VideoBitRate=<somevalue>&AudioBitRate=<otherValue> stuff?

Edited by BC101
Link to comment
Share on other sites

No your bitrate is too low and you will need a little more info

http://server-ip:8096/mediabrowser/Videos/502e652c886521c5d2bda00dffd6371c/stream.m3u8?audioCodec=Aac&VideoCodec=h264&VideoBitRate=3000000&AudioBitRate=128000&audiochannels=2&maxwidth=1280

will give you 3mb/s h264 video and 128kb/s aac stereo hls  which is almost what you were shooting for

 

 

You can use maxwidth/width/maxheight/height to get the right size for you screen (above will do 1280 as max width)

Edited by Tikuf
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...