0

Can't play audio stream if there is no pause/play button?

I would like to have a media transport overlay that doesn't have a play pause button. The documents lead me to believe this is as simple as passing a parameter set to false into the constructor, like this:

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


And the result is a transport control with no play / pause button. But unfortunately I can't play an audio stream when I remove the button because the following generates an error.

CODE
    _startPlaylist: function(playlistID) {
log("jjj next line causes error");
this.controls.overlay.resetState();


Is there something else I should do? Should I 'patch' the overlay source code to fix the bug? Other suggestions?

by
4 Replies
  • A portion of the log when running the previous code as part of the sample media player application:

    CODE
    WM 00:00:09:372: [T:8274] firing event of type:onViewportBoundsChanged
    WM 00:00:09:372: [T:8274] no listeners for event
    WM 00:00:09:372: [T:8274] jjj _handlePlaylistUpdate()
    WM 00:00:09:372: [T:8274] jjj next line causes error
    WE 00:00:09:372: [T:8274] !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    WE 00:00:09:372: [T:8274] ERROR!ERROR!ERROR!ERROR!ERROR!
    WE 00:00:09:372: [T:8274] !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    WE 00:00:09:372: [T:8274] splat.tv [tv.l4.ihr.201099.9999.widget]
    WE 00:00:09:372: [T:8274] TypeError: this._controls.playpausebutton has no properties (control.overlays.js: Line 543)
    WE 00:00:09:372: [T:8274] !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    0
  • I consider this an evil hack, and hope for a better solution:

    CODE
        createView: function() {
    var that = this;
    this.controls.overlay = new KONtx.control.MediaTransportOverlay({
    playButton: false
    }).appendTo(this);
    this.controls.overlay._updateState = function() {
    switch(KONtx.mediaplayer.tvapi.currentPlayerState) {
    case KONtx.mediaplayer.constants.states.PAUSE:
    if (this._controls.playpausebutton) { // <--------------------------------------------------------------------- new
    this._controls.playpausebutton.content.setSources(Theme.storage.get(this.ClassName + 'PlayButtonImage'));
    } // <--------------------------------------------------------------------------------------------------------- new
    this._overlayControlFadeTimer.ticking = false;
    if (!this.visible) {
    if(this.fire("onTransportOverlayShow")) {
    this.visible = true;
    }
    }
    break;
    case KONtx.mediaplayer.constants.states.PLAY:
    case KONtx.mediaplayer.constants.states.BUFFERING:
    this._controls.playpausebutton.content.setSources(Theme.storage.get(this.ClassName + 'PauseButtonImage'));
    break;
    default:
    if (this._controls.playpausebutton) { // <--------------------------------------------------------------------- new
    this._controls.playpausebutton.content.setSources(Theme.storage.get(this.ClassName + 'PlayButtonImage'));
    } // <--------------------------------------------------------------------------------------------------------- new
    break;
    }
    }


    Seems to work so far in my limited testing. But reviewing the source for the overlay, looks like a few other situations where the playpause button is assumed to exist and no test is made.

    Should I just 'patch' by loading that file with similar edits? Or is there a better solution?
    0
  • I would first start with whether it would pass QA approval. ;)What parts of the overlay are you using, if not the play/pause button?
    0
  • Based on a further review of the above and hopefully understanding the desired outcome, I would just build a light weight custom overlay based off the media overlay source. You could possibly strip a lot of the weight on the standard media overlay.
    0

Recent Posts

in Design / Interaction - Yahoo! TV Widgets