0

media player sample

Hello. i have been working on the basic media sample and i am receiving this error when trying to play a playlist.

WM 00:02:08:876: [T:14590] no listeners for event
WM 00:02:08:876: [T:14590] [KONtx/UARLIVE] {ControlVideoTransportOverlayButton-24} :: focus
WE 00:02:08:877: [T:14590] !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
WE 00:02:08:877: [T:14590] ERROR!ERROR!ERROR!ERROR!ERROR!
WE 00:02:08:877: [T:14590] !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
WE 00:02:08:877: [T:14590] UARLIVE [tv.mave.widgets.uarlive]
WE 00:02:08:877: [T:14590] TypeError: json is undefined (basicplayer.js: Line 77)
WE 00:02:08:877: [T:14590] !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
WM 00:02:08:879: [T:14590] [KONtx/UARLIVE] {HostEventManager} :: Got HostEvent: onUnselect
WM 00:02:08:879: [T:14590] [KONtx/UARLIVE] {SampleSidebarView-14} :: _onUnselectView
WM 00:02:08:880: [T:14590] [KONtx/UARLIVE] {HostEventManager} :: Got HostEvent: onSelect
WM 00:02:08:881: [T:14590] [KONtx/UARLIVE] {BasicPlayerView-20} :: _onSelectView
WM 00:02:08:881: [T:14590] calling window.navigate()
WM 00:02:08:881: [T:14590] gainfocus: view-Player

here is the section in question. basicplayer.js: Line 77

_createPlaylist: function(playlistID) {
var playlist = new KONtx.media.Playlist();
playlist.PlaylistID = playlistID;

var json = KONtx.messages.fetch("playlist." + playlistID);
for each(var entry in json.entries) {
var playlistEntry = new KONtx.media.PlaylistEntry(entry);
playlistEntry.entryID = entry.entryID;
playlist.addEntry(playlistEntry);
}

return playlist;
},

any help is appreciated. thanks.

1 Reply
  • here is my basicplayer.js

    CODE
    /**
    * @author jstone
    */

    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.previousView();
    } },
    ]
    });
    },

    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(this.persist.PlaylistID);
    },

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

    _handlePlaylistUpdate: function(playlistID) {
    if(KONtx.mediaplayer.isPlaylistEntryActive) {
    if(!playlistID) {
    // we have no new playlist we've been asked to play, so keep playing what we already are playing
    return;
    }
    if(playlistID == KONtx.mediaplayer.playlist.get().PlaylistID) {
    // we have been asked to play the same playlist we are already playing, so just keeping playing it
    return;
    }
    }

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

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

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

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

    _createPlaylist: function(playlistID) {
    var playlist = new KONtx.media.Playlist();
    playlist.PlaylistID = playlistID;

    var json = KONtx.messages.fetch("playlist." + playlistID);
    for each(var entry in json.entries) {
    var playlistEntry = new KONtx.media.PlaylistEntry(entry);
    playlistEntry.entryID = entry.entryID;
    playlist.addEntry(playlistEntry);
    }

    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();
    }
    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();
    break;
    case 'onStreamLoadError':
    this.dialogs.error.show();
    break;
    default:
    break;
    }
    }
    });
    0

Recent Posts

in Getting Started / Beginners - Yahoo! TV Widgets