We should capture the other play states and send them via timeline endpoint
At least loading (buffering in our state) and paused are interesting to us.
atv.player.playerStateChanged = function(newState, timeIntervalSec)
{
/*
atv.player.states.FastForwarding
atv.player.states.Loading
atv.player.states.Paused
atv.player.states.Playing
atv.player.states.Rewinding
atv.player.states.Stopped
*/
}
Hi Elan, What exactly should we be doing to handle the Paused state? Some people are reporting issues on the forum if they leave a video paused and then resume. I'm assuming there is some command we should be issuing to the transcoder to tell it the video is paused.
Ah yes, there is a /ping endpoint (just like stop) which stops the session from timing out (in 180 seconds).
So when paused, hit the ping endpoint every 60 seconds or so. The session itself will be idle, so it won't take up CPU.
Excellent, thanks. I'll look into it.
So all I need to call is:
loadPage(addrPMS + '/video/:/transcode/universal/ping?session=' + atv.device.udid);
every 60 seconds or so?
Yup, that should do it! (Only when paused, of course, although calling it during regular playback won't cause any issues...)
Ok, thanks.
Umm.. this may be harder than I expected, seems ATV javascript doesn't have the setTimeout functions :(
Doh! If nothing else, they could call PlexConnect on pause/play and PlexConnect could take care of it.
No, wait. All is not lost :) the ATV has it's own versions called:-
atv.setInterval and atv.clearInterval
Ah nice! I spent some time before my first commit doing a bunch of for i in atv diving down and exploring the tree :)
Nice.. I found them by doing a string search for "timer" in all the files I pulled from that sample-xml site :)
Ah, nice. Love those samples. As as aside, do you know how to make it so that a page reloads when you navigate back to it (e.g. the On Deck screen)? Is there some magic in the XML I'm not aware of, or does it take an HTTP "no-cache" header, maybe?
Which other states should we be handling? You mentioned loading (buffing).
The ones the server supports are:
enum PlexPlayState
{
PLAYING,
PAUSED,
BUFFERING,
STOPPED
};
Ah, nice. Love those samples. As as aside, do you know how to make it so that a page reloads when you >navigate back to it (e.g. the On Deck screen)? Is there some magic in the XML I'm not aware of, or does it take >an HTTP "no-cache" header, maybe?
I was using the following in my version of On Deck:-
<listWithPreview id="com.sample.menu-items-with-sections" volatile="true" onVolatileReload="reloadPMS_XML('{{getPath()}}')">
Set the top level item as volatile then every time you navigate back to the page the function in onVolatileReload is called, which I used to do just that, reload the xml. However I haven't had much luck getting it to work with the top nav bar. Maybe you'll have more luck.
Have you seen the ATV xml schema file? It's a list of all the available xml elements and attributes. If not I'll post it somewhere for you.
Ah no, I haven't! That would be great.
The ones the server supports are:
Excellent, so the only one we're not handling is BUFFERING. Is there anything special we need to do here.
And I've forgot I've had a video paused for the last 15 minutes, testing the pause state.... It works perfectly :)
Excellent! All you need to do on any state change is issue the /:/timeline request with appropriate update.
Ah no, I haven't! That would be great.
Can I email it to you. It's a file ripped from a jailbroken ATV2 so I don't want to publically post it :) Or if you have a jailbroken ATV to hand you can rip it out yourself.