0

Playing video

I've done widgets like gallery, news and etc. I am having problem in developing Video Widget. I don't know why even the sample Video widget itself is not working properly(doesn't load categories) . All i wanted to do a simple video list and play video upon selection Is it possible to show media controls while video playing.
It will be great If anyone can provide me a simple code for that or even guide me to develop.


Thanks
~Vinod

by
21 Replies
  • QUOTE (Vinod T @ Apr 13 2009, 02:59 PM) <{POST_SNAPBACK}>
    All i wanted to do a simple video list and play video upon selection Is it possible to show media controls while video playing.
    It will be great If anyone can provide me a simple code for that or even guide me to develop.


    Which version of the WDK do you have?

    -Jeremy
    0
  • QUOTE (Jeremy Johnstone @ Apr 13 2009, 04:41 PM) <{POST_SNAPBACK}>
    Which version of the WDK do you have?

    -Jeremy


    I am using latest release 0.9.5-33
    0
  • Hi there,

    I too am having the same issues as Vinod (categories not loading in Yahoo Video sample) and would really appreciate some sample code or help with playing a list of videos. I'm using Simulator 540 on Linux, and the versions available in /usr/local/Konfabulator/TV/Framework/kontx/ are 0.2.2, 1.0.0 and 1.1. The Yahoo Video sample appears to be refering to '1.1.8' in widget.xml.

    thanks,
    James
    0
  • Hey Guys,

    Let me try making a more basic video test widget and getting that out to you. I will do my best to get that done in the next 48 hours.

    Thanks!

    -Jeremy
    0
  • QUOTE (Jeremy Johnstone @ Apr 14 2009, 11:04 AM) <{POST_SNAPBACK}>
    Hey Guys,

    Let me try making a more basic video test widget and getting that out to you. I will do my best to get that done in the next 48 hours.

    Thanks!

    -Jeremy


    Thanks Jeremy.
    0
  • QUOTE (Vinod T @ Apr 14 2009, 11:19 AM) <{POST_SNAPBACK}>
    Thanks Jeremy.


    My pleasure. Anything I can do to help you guys build widgets please don't hesitate to ask.
    0
  • QUOTE (Jeremy Johnstone @ Apr 14 2009, 11:40 AM) <{POST_SNAPBACK}>
    My pleasure. Anything I can do to help you guys build widgets please don't hesitate to ask.



    Hi Jeremy,

    Once you complete that basic video widget, is that something you can post to the forum, or something we can request via email?

    Thanks!

    Steve
    0
  • QUOTE (Steve W @ Apr 14 2009, 11:46 AM) <{POST_SNAPBACK}>
    Once you complete that basic video widget, is that something you can post to the forum, or something we can request via email?


    I'd like to post it to the forum so that way it gets the most exposure. Let me follow up with someone to make sure that's ok (not sure why it wouldn't be).

    -Jeremy
    0
  • QUOTE (Jeremy Johnstone @ Apr 14 2009, 11:04 AM) <{POST_SNAPBACK}>
    Hey Guys,

    Let me try making a more basic video test widget and getting that out to you. I will do my best to get that done in the next 48 hours.

    Thanks!

    -Jeremy



    Many thanks Jeremy, I look forward to seeing the video test.

    If it's not too much trouble, it would be great for the video test widget to show how one can loop video file playback. Or if that's not possible, perhaps just getting the video to automatically restart after it is finished?

    rgds,
    James
    0
  • QUOTE (james.cumberbatch @ Apr 15 2009, 07:22 AM) <{POST_SNAPBACK}>
    If it's not too much trouble, it would be great for the video test widget to show how one can loop video file playback. Or if that's not possible, perhaps just getting the video to automatically restart after it is finished?


    That's actually much easier and can be illustrated in a small amount of code:

    CODE
                     this.player = new KONtx.videoplayer({
    playlist: [ { url: "http://myvideo.url" } ],
    repeatAll: true,
    events: {
    onStateChange: function(event) {
    if(event.payload.newState == event.payload.videoplayer.states.STOP) {
    KONtx.application.previousView();
    }
    },
    onPlaylistEnd: function(event) {
    KONtx.application.previousView();
    },
    onVideoLoadError: function(event) {
    _showErrorDialog();
    }
    }
    });


    Please note that the code provided in this forum is considered “Sample Code” under the Developer Terms of Use (with specific reference to Section 2.1(iii)).
    0
  • Thanks for the code snippet Jeremy. It kind of makes sense and I added 'this.player.startPlaylist();' to get the video playing. However, the video still stops on the last frame and I get the following in the log:

    SB 00:00:31:627: [T:7738] SurfaceBook: curr = 19.987MB (92) : peak = 20.302MB (98)
    >>>>> EOS
    TV 00:00:33:004: [T:7738] STATE CHANGED CALLBACK : POINTER(0x9db5bc0) POINTER(0xb6435dc0)
    EM 00:00:33:030: [T:7738] SENDING NOTIFICATION FOR tv.media-player.state-changed POINTER((nil)) TO POINTER(0x9db46cc) 3
    TV 00:00:33:030: [T:7738] LOADING URI http://[our_servers_ip_address].wmv
    TV 00:00:33:031: [T:7738] CHANGING URI
    !!STOP PLAYING MEDIA FILE
    !!STOP PLAYING MEDIA FILE

    I placed your code in createView, and replaced the video file with one on our server. I'm using version 1.1. It looks the like the trace '!!STOP PLAYING MEDIA FILE' at the end is from one of the konfabulator files, as it's not in my code. Could that be what is preventing the loop playback ?

    Any help would be appreciated but if you think it's best for me to wait for your full video test widget then I'll wait for that :-)

    thanks,
    James
    0
  • QUOTE (james.cumberbatch @ Apr 16 2009, 04:29 AM) <{POST_SNAPBACK}>
    Thanks for the code snippet Jeremy. It kind of makes sense and I added 'this.player.startPlaylist();' to get the video playing. However, the video still stops on the last frame and I get the following in the log:

    SB 00:00:31:627: [T:7738] SurfaceBook: curr = 19.987MB (92) : peak = 20.302MB (98)
    >>>>> EOS
    TV 00:00:33:004: [T:7738] STATE CHANGED CALLBACK : POINTER(0x9db5bc0) POINTER(0xb6435dc0)
    EM 00:00:33:030: [T:7738] SENDING NOTIFICATION FOR tv.media-player.state-changed POINTER((nil)) TO POINTER(0x9db46cc) 3
    TV 00:00:33:030: [T:7738] LOADING URI http://[our_servers_ip_address].wmv
    TV 00:00:33:031: [T:7738] CHANGING URI
    !!STOP PLAYING MEDIA FILE
    !!STOP PLAYING MEDIA FILE


    I'm going to follow up internally on what reason that message is output. Could be something not being handled correctly and thus why I need to investigate ASAP as we are finalizing the API of the video framework 1.1 this week.

    -Jeremy
    0
  • Hi Jeemy,

    Any luck with Test Video Widget code?

    Thanks
    Vinod
    0
  • QUOTE (Vinod T @ Apr 17 2009, 11:02 AM) <{POST_SNAPBACK}>
    Any luck with Test Video Widget code?


    I just finalized the Video Framework / Speedtest code last night for the official 1.1 shipping release, so I am starting on that today / this weekend. I'll post as soon as it's ready.

    -Jeremy
    0
  • QUOTE (Jeremy Johnstone @ Apr 17 2009, 11:43 AM) <{POST_SNAPBACK}>
    I just finalized the Video Framework / Speedtest code last night for the official 1.1 shipping release, so I am starting on that today / this weekend. I'll post as soon as it's ready.

    -Jeremy


    Any news on basic video widget ?
    0
  • I am having the same issue. I can get the first video to play, but it will not continue down the playlist.

    Has there been any resolution on this matter as of yet?
    0
  • QUOTE (WidgetRealm @ May 1 2009, 02:43 PM) <{POST_SNAPBACK}>
    I am having the same issue. I can get the first video to play, but it will not continue down the playlist.

    Has there been any resolution on this matter as of yet?


    There has been and an update is coming soon. I'll see if I can post just the relevant change once I dig it out of source control.

    -Jeremy
    0
  • QUOTE (Jeremy Johnstone @ Apr 17 2009, 11:43 AM) <{POST_SNAPBACK}>
    I just finalized the Video Framework / Speedtest code last night for the official 1.1 shipping release, so I am starting on that today / this weekend. I'll post as soon as it's ready.

    -Jeremy


    Hi Jeremy,

    Any updates on basic Video widget code?
    0
  • QUOTE (Vinod T @ May 5 2009, 11:32 AM) <{POST_SNAPBACK}>
    Hi Jeremy,

    Any updates on basic Video widget code?


    See here: http://developer.yahoo.net/forum/index.php?showtopic=1407

    (basically need to just email me)
    0
  • QUOTE (Jeremy Johnstone @ May 6 2009, 06:28 PM) <{POST_SNAPBACK}>
    See here: http://developer.yahoo.net/forum/index.php?showtopic=1407

    (basically need to just email me)


    Thanks a lot for you support Jeremey!
    0
  • QUOTE (Jeremy Johnstone @ Apr 15 2009, 04:33 PM) <{POST_SNAPBACK}>
    That's actually much easier and can be illustrated in a small amount of code:

    CODE
                     this.player = new KONtx.videoplayer({
    playlist: [ { url: "http://myvideo.url" } ],
    repeatAll: true,
    events: {
    onStateChange: function(event) {
    if(event.payload.newState == event.payload.videoplayer.states.STOP) {
    KONtx.application.previousView();
    }
    },
    onPlaylistEnd: function(event) {
    KONtx.application.previousView();
    },
    onVideoLoadError: function(event) {
    _showErrorDialog();
    }
    }
    });


    Please note that the code provided in this forum is considered “Sample Code” under the Developer Terms of Use (with specific reference to Section 2.1(iii)).


    Though this code works fine in the simulator, it doesn't seem to work on a production TV. Can you verify this?

    We have a Samsung LED TV Series 7 and I used your alpha release tool to deploy a test widget on the TV. The error dialog fires during updateView and shows the exception "TypeError: this.player has no properties".

    Framework: 1.1
    WDK: 0.9.5-33
    Resolution: 540

    Our PlayerView.js (below) is based on your code above and YahooVideoTV.widget's VideoFullscreenPlayerView.js

    CODE
    var PlayerView = new KONtx.Class({
    ClassName: 'MyPlayerView',
    Extends: KONtx.system.FullscreenView,

    createView: function(){
    this._debugMsg("createView");

    var self = this;
    this.controls.overlay = new KONtx.control.VideoTransportOverlay().appendTo(this);
    this.player = new KONtx.videoplayer({
    playlist: [{
    url: "http://cosmos.bcst.yahoo.com/getPlaylist.php?node_id=12553529&amp;bitrate=1000&amp;tech=wmp"
    }],
    events: {
    onStateChange: function(event){
    if (event.payload.newState == event.payload.videoplayer.states.STOP) {
    self._debugMsg("STOP");
    self._switchBackToSidebar();
    }
    },
    onPlaylistEnd: function(event){
    self._debugMsg("PLAYLIST END");
    self._switchBackToSidebar();
    },
    onVideoLoadError: function(event){
    self._debugMsg("ERROR");
    self._showErrorDialog("onVideoLoadError: " + event);
    }
    }
    });

    this.player.attachAccessory(this.controls.overlay);
    },

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

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

    updateView: function(){
    this._debugMsg("updateView");

    this._boundHandler = this._backHandler.subscribeTo(KONtx.application, ['onActivateBackButton','onViewChangeInitiated'], this);
    this.controls.overlay.resetState();
    try {
    this.player.startPlaylist();
    }
    catch (e) {
    this._debugMsg("Caught an exception, so going back to sidebar");
    this._showErrorDialog("updateView exception: " + e);
    }
    },

    _backHandler: function(event) {
    event.preventDefault();
    this._stopVideoConfirmationDialog();
    },

    _debugMsg: function(msg) {
    log("--------------------------------");
    log(msg);
    log("--------------------------------");
    },

    _showErrorDialog: function(msg) {
    var self = this;
    new KONtx.dialogs.Alert({
    title: $_('video_error_dialog_title'),
    message: msg,
    buttons: [
    { label: $_('dialog_ok_button'), callback: function() {
    self._switchBackToSidebar();
    } }
    ]
    }).show();
    },

    _stopVideoConfirmationDialog: function() {
    log("popping stop confirmation dialog");
    var stopCallback = (function() { this.player.stop(); }).bindTo(this);
    new KONtx.dialogs.Alert({
    title: $_('stop_video_dialog_title'),
    message: $_('stop_video_dialog_message'),
    buttons: [
    { label: $_('continue_playing') },
    { label: $_('stop_playing'), callback: stopCallback }
    ]
    }).show();
    },

    _switchBackToSidebar: function() {
    this._unbindHandler();
    KONtx.application.previousView();
    },

    _unbindHandler: function() {
    if(this._boundHandler) {
    this._boundHandler.unsubscribeFrom(KONtx.application, ['onActivateBackButton','onViewChangeInitiated']);
    this._boundHandler = null;
    }
    }

    });
    0

Recent Posts

in General - Yahoo! TV Widgets