0

Reset video in onPlaylistEnd event

I'm adding some functionality to the widget and i was trying to reset a video to the start when if finishes playing, but i can't find a way to do it.
I've tried with
CODE
_registerHandlers: function() {
if(this._boundPlayerHandler) {
this._unregisterHandlers();
}
this._boundPlayerHandler = this._playerDispatcher.subscribeTo(KONtx.mediaplayer, ['onStateChange', 'onPlaylistEnd', 'onStreamLoadError'], this);
},
_playerDispatcher: function(event) {
switch(event.type) {
case 'onPlaylistEnd':
KONtx.mediaplayer.control.seek(0, true);
break;
}
}


But it's not working, i've also tried
CODE
_playerDispatcher: function(event) {
switch(event.type) {
case 'onPlaylistEnd':
KONtx.mediaplayer.playlist.loadEntry(0);
KONtx.mediaplayer.control.pause();
break;
}

and
CODE
_playerDispatcher: function(event) {
switch(event.type) {
case 'onPlaylistEnd':
self.controls.overlay.resetState();
self.controls.tempOverlay.resetState();
KONtx.mediaplayer.control.stop();
KONtx.mediaplayer.playlist.loadEntry(0);
KONtx.mediaplayer.playlist.start();
KONtx.mediaplayer.control.pause();
break;
}
}

And that actually crashes both the simulator and the tv, i looked into the api but couldn't find a function that does it, is there a way to do without restarting all?

by
2 Replies
  • CODE
    _playerDispatcher: function(event) {
    switch(event.type) {
    case 'onPlaylistEnd':
    KONtx.mediaplayer.playlist.loadEntry(0);
    break;
    }
    }

    This works for me (only tested in the wdk).

    A couple things to note. There is a way to carousel, but there's a known bug with that. That would be the optimal way to do this, as it's a property you'd set in the playlist's constructor and no other code would be necessary. In the meantime you could do the above. It's essentially the same thing, just more code.

    We have a patch for that and some other things that we are going to release soon. One of the other known issues is the engine crashing when trying to switch to another stream when one is currently playing. This shouldn't effect your use case.

    - Ben
    0
  • Sadly not working for me, simulator ( Gstreamer specifically) crashes when i do that and trying to load that on the tv just makes it stop and reset, i've found away around it in the meantime, on playlist end i just set a boolean videoEnded to true, and on the onTransportButtonPress event ot the mediatransport overlay i check for the payload 'playpause'. If i'm there and videoEnded is true i reset the flag to false and recall my function for loading the video. Just a little hack that seems to work for now :D
    0

Recent Posts

in General - Yahoo! TV Widgets