Video playback and control

Video playback and control

trying to control video selection and playback via the data grid.

Getting overlapping playback, despite use of a function to select video, stop present video and play selected video:

 private function showVideo(event:Event):void{
                //user clicks grid item, selects URL for video playback
                myVid.source = eventData.getItemAt(event.currentTarget.selectedIndex).videoUrl;
               
                if (myVid.playing)
                //if there is already a video playing, stop it
                        myVid.stop();
                else
                //otherwise, just play the selection
                        myVid.play();

            }

the VideoDisplay has ID= myVid and is set autoPlay = False. When tested, the first video selected, and subsequent ones, continue to play (audio) even thought video is replaced by new selection.

Do I need a return or refresh somehow to reset the selection or clear it? Any help would be appreciated.

Scott B

grouchoman
11/18/2009 - 16:39

figured it out...

private function showVideo(event:Event):void{
                //user clicks grid item, selects URL for video playback
           
                myVid.source = eventData.getItemAt(event.currentTarget.selectedIndex).videoUrl;
                myVid.load();
               
                if (myVid.playing)
                //if there is already a video playing, stop it
                        myVid.stop();
                       
                        else
                //otherwise, just play the selection
                        myVid.play();

            }

reply

azhar.shah
03/07/2010 - 13:26

As I am a newbie to flex. Please guide me as I am trying to make an application which would stream live video from sites like justin.tv, etc. Kindly guide me or give me sample code to make such kind of application.
Thanks in advance!!!

reply

Add Comment

Put code snippets inside language tags:
[language] [/language]

Examples:
[javascript] [/javascript]
[actionscript] [/actionscript]
[csharp] [/csharp]

See here for supported languages.

Javascript must be enabled to submit anonymous comments - or you can login.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.