0

Video is playing in another view

HI,

Clicking on view video opening in new window / view.
If I give the hard coded the url of the video to be played coming in same view... if its coming dynamically (basically from global variable), video is playing in new view / window / media player...
Below is the code

var BasicPlayerView = new KONtx.Class({
ClassName: 'BasicPlayerView',

Extends: KONtx.system.FullscreenView,
initView: function() {
KONtx.mediaplayer.initialize();
this.dialogs = {};
this.dialogs.error = new KONtx.dialogs.Alert({
title: $_('video_error_dialog_title'),
message: $_('video_error_dialog_message'),
buttons: [
{ label: $_('dialog_retry_button'), callback: function() {
KONtx.mediaplayer.playlist.start();
} },
{ label: $_('dialog_cancel_button'), callback: function() {
KONtx.application.loadView('view-images');
} },
]
});
},

createView: function() {
this.controls.overlay = new KONtx.control.MediaTransportOverlay().appendTo(this);
},

focusView: function() {
this.controls.overlay.focus();
},

updateView: function() {
this._registerHandlers();
this._resetViewport();
this._handlePlaylistUpdate();
},

hideView: function() {
this._unregisterHandlers();
},

_handlePlaylistUpdate: function() {

// Otherwise, we need to start this new playlist
this._startPlaylist();
},

_startPlaylist: function() {
this.controls.overlay.resetState();

KONtx.mediaplayer.playlist.set(this._createPlaylist());

KONtx.mediaplayer.setConnectionBandwidth(KONtx.messages.fetch("bandwidth") || 1);
KONtx.mediaplayer.playlist.start();
},

_createPlaylist: function() {
var playlist = new KONtx.media.Playlist();
playlist.addEntry(new KONtx.media.PlaylistEntry({
streams: [
{url: selectedVideo}, // selectedVideo is the global variable, assigning the video url in previous view
]
}));
return playlist;
},

_resetViewport: function() {
var bounds = KONtx.mediaplayer.getDefaultViewportBounds();
KONtx.mediaplayer.setViewportBounds(bounds);
},

_registerHandlers: function() {
if(this._boundPlayerHandler) {
this._unregisterHandlers();
}
this._boundPlayerHandler = this._playerDispatcher.subscribeTo(KONtx.mediaplayer, ['onStateChange', 'onPlaylistEnd', 'onStreamLoadError'], this);
},

_unregisterHandlers: function() {
if(this._boundPlayerHandler) {
this._boundPlayerHandler.unsubscribeFrom(KONtx.mediaplayer, ['onStateChange', 'onPlaylistEnd', 'onStreamLoadError']);
this._boundPlayerHandler = null;
}
},

_playerDispatcher: function(event) {
switch(event.type) {
case 'onStateChange':
if(event.payload.newState == KONtx.mediaplayer.constants.states.STOP) {
//KONtx.application.previousView();
KONtx.application.loadView('view-images');
}
if(event.payload.newState == KONtx.mediaplayer.constants.states.ERROR || event.payload.newState == KONtx.mediaplayer.constants.states.UNKNOWN) {
this.dialogs.error.show();
}
break;
case 'onPlaylistEnd':
//KONtx.application.previousView();
KONtx.application.loadView('view-images');
break;
case 'onStreamLoadError':
this.dialogs.error.show();
break;
default:
break;
}
}
});

Regards
Swarupa

by
3 Replies
  • Are you using the simulator? if this is the case that's a known bug
    0
  • QUOTE (Gades @ Nov 18 2010, 01:40 AM) <{POST_SNAPBACK}>
    Are you using the simulator? if this is the case that's a known bug


    Yeah I am testing on the simulator.

    Thanks
    Swarupa
    0
  • QUOTE (swarupa @ Nov 18 2010, 02:59 AM) <{POST_SNAPBACK}>
    Yeah I am testing on the simulator.

    Thanks
    Swarupa


    I had the same problem as well but then set the alt_gstreamer value to 1 in Konfabulator.env.
    0

Recent Posts

in Getting Started / Beginners - Yahoo! TV Widgets