Using ControlBarSample to Play Multiple Videos

I'm trying to modify the ControlBarSample to play multiple videos and I'm running into a wall. I've made a few simple modifications to the control bar sample to try to play a second video file. The problem I'm having is the control bar doesn't have a reference to the new video I play and therefore can't update it's view. I'd like to be able to remove the video element playing in the ParallelElement and add a new child MediaElement and have the controlbar refresh it's reference to the new target. Also the controlbar shouldn't have to reload itself, but should stay right where it is in the display list and in the root parallel element. Can someone guide through this? Here is my simple modification to the ControlBarSample class as a starting point.
package
     import flash.display.Sprite;
     import flash.events.MouseEvent;
     import flash.text.TextField;
     import org.osmf.elements.ParallelElement;
     import org.osmf.events.MediaFactoryEvent;
     import org.osmf.layout.HorizontalAlign;
     import org.osmf.layout.LayoutMetadata;
     import org.osmf.layout.VerticalAlign;
     import org.osmf.media.*;
     import org.osmf.metadata.Metadata;
     [SWF(width="640", height="360", backgroundColor="0x000000",frameRate="25")]
     public class ControlBarPluginSampleMod extends Sprite
          public function ControlBarPluginSampleMod()
               // Construct an OSMFConfiguration helper class:     
               osmf = new OSMFConfiguration();
               // Construct the main element to play back. This will be a
               // parallel element, that will hold the main content to
               // playback, and the control bar (from a plug-in) as its
               // children:
               osmf.mediaElement = constructRootElement();
               osmf.view = this;
               // Add event listeners to the plug-in manager so we'll get
               // a heads-up when the control bar plug-in finishes loading:
               osmf.factory.addEventListener(MediaFactoryEvent.PLUGIN_LOAD, onPluginLoaded);
               osmf.factory.addEventListener(MediaFactoryEvent.PLUGIN_LOAD_ERROR, onPluginLoadError);
               // Ask the plug-in manager to load the control bar plug-in:
               osmf.factory.loadPlugin(pluginResource);
               // button to play the next item
               var label:TextField = new TextField();
               label.text = "PLAY NEXT";
               label.x = 10;
               label.y = 3;
               label.mouseEnabled = false
               button = new Sprite();
               button.buttonMode = true;
               button.addChild( label );
               button.graphics.beginFill(0x00FFFF,1);
               button.graphics.drawRect(0,0,90,20);
               button.addEventListener(MouseEvent.CLICK, onButtonClick);
               addChild(button);
          // Internals
          private var osmf:OSMFConfiguration;
          private var rootElement:ParallelElement;
          private var button:Sprite;
          private function onPluginLoaded(event:MediaFactoryEvent):void
               // The plugin loaded successfully. We can now construct a control
               // bar media element, and add it as a child to the root parallel
               // element:
               rootElement.addChild(constructControlBarElement());
          private function onPluginLoadError(event:MediaFactoryEvent):void
               trace("ERROR: the control bar plugin failed to load.");
          private function constructRootElement():MediaElement
               // Construct a parallel media element to hold the main content,
               // and later on, the control bar.
               rootElement = new ParallelElement();
               rootElement.addChild( constructVideoElement(VIDEO_HTTP) );
               // Use the layout api to set the parallel element's width and
               // height. Make it as big as the stage currently is:
               var rootElementLayout:LayoutMetadata = new LayoutMetadata();
               rootElement.addMetadata(LayoutMetadata.LAYOUT_NAMESPACE, rootElementLayout);
               rootElementLayout.width = stage.stageWidth;
               rootElementLayout.height = stage.stageHeight;
               return rootElement;
          private function constructVideoElement(url:String):MediaElement
               // Construct a metadata object that we can append to the video's collection
               // of metadata. The control bar plug-in will use the metadata to identify
               // the video element as its target:
               var controlBarTarget:Metadata = new Metadata();
               controlBarTarget.addValue(ID, "mainContent");
               // Construct a video element:
               var video:MediaElement = osmf.factory.createMediaElement(new URLResource(url));
               // Add the metadata to the video's metadata:
               video.addMetadata(ControlBarPlugin.NS_CONTROL_BAR_TARGET, controlBarTarget);
               return video;
          private function constructControlBarElement():MediaElement
               // Construct a metadata object that we'll send to the media factory on
               // requesting a control bar element to be instantiated. The factory
               // will use it to parameterize the element. Specifically, the ID field
               // will tell the plug-in what the ID of the content it should control
               // is:
               var controlBarSettings:Metadata = new Metadata();
               controlBarSettings.addValue(ID, "mainContent");
               // Add the metadata to an otherwise empty media resource object:
               var resource:MediaResourceBase = new MediaResourceBase();
               resource.addMetadataValue(ControlBarPlugin.NS_CONTROL_BAR_SETTINGS, controlBarSettings);
               // Request the media factory to construct a control bar element. The
               // factory will infer a control bar element is requested by inspecting
               // the resource's metadata (and encountering a metadata object of namespace
               // NS_CONTROL_BAR_SETTINGS there):
               var controlBar:MediaElement = osmf.factory.createMediaElement(resource);
               // Set some layout properties on the control bar. Specifically, have it
               // appear at the bottom of the parallel element, horizontally centererd:
               var layout:LayoutMetadata = controlBar.getMetadata(LayoutMetadata.LAYOUT_NAMESPACE) as LayoutMetadata;
               if (layout == null)
                    layout = new LayoutMetadata();
                    controlBar.addMetadata(LayoutMetadata.LAYOUT_NAMESPACE, layout);
               layout.verticalAlign = VerticalAlign.BOTTOM;
               layout.horizontalAlign = HorizontalAlign.CENTER;
               // Make sure that the element shows over the video: element's with a
               // higher order number set are placed higher in the display list:
               layout.index = 1;
               return controlBar;
          private function onButtonClick(event:MouseEvent):void
               playNext(VIDEO_RTMP);
          private function playNext(url:String):void
               rootElement.removeChildAt(0);
               rootElement.addChild( constructVideoElement(url) );
          /* static */
          private static const VIDEO_HTTP:String = "http://mediapm.edgesuite.net/osmf/content/test/logo_animated.flv";
          private static const VIDEO_RTMP:String = "rtmp://cp67126.edgefcs.net/ondemand/mediapm/strobe/content/test/SpaceAloneHD_sounas_640_500_short";
          private static var ID:String = "ID";
          // Comment out to load the plug-in for a SWF (instead of using static linking, for testing):     
          //private static const pluginResource:URLResource = new URLResource("http://mediapm.edgesuite.net/osmf/swf/ControlBarPlugin.swf");
          private static const pluginResource:PluginInfoResource = new PluginInfoResource(new ControlBarPlugin().pluginInfo);

It appears that this may be accomplished more easily if I do something similar to the StrobeMediaPlayback implementation. Looking at the StrobeMediaPlayback source code it looks like Adobe has done something a little different than their ControlBarPlugin, placing the controlbar and root media element inside separate MediaContainers and then adding those containers to the display list. Is this recommended over using the frameworks ParallelElements? If so, is communication between the control bar and root media element still a matter of just updating the target reference via metadata?

Similar Messages

  • I was downloading podcast video in my itouch using wifi, but suddenly my wifi got disconnected and now there is a link in my podcast list which on opening uses wifi to play that video. I want to delete that link. Right to left swapping is not working.

    I was downloading podcast video in my itouch using wifi, but suddenly my wifi got disconnected and now there is a link in my podcast list which on opening uses wifi to play that video. I want to delete that link. Right to left swapping is not working.

    I bet this is too late but...
    Are you trying to print through the airport express wirelessly or the built in wireless of the lexmark? If you want to use the airport express, there is no need to mess with the wireless printing on the lexmark at all. The airport express will be easy to set up, all the wireless setups through the printers are a pain.

  • Snow Leopard iTunes 10.5 will not play multiple video tracks in QuickTime .MOV files

    I recently discovered that Snow Leopard iTunes version 10.5 won't play multiple video tracks in a QuickTime .MOV file.
    Both video tracks appear and play correctly when playing the file in:
    - QuickTime Player 10 or QuickTime Player 7.7 on the same Snow Leopard machine
    - iTunes 10.3.1 on another Snow Leopard machine
    - iTunes 10.5 on Leopard or Windows 7
    So I think the problem is iTunes 10.5 on Snow Leopard (although I haven't been able to test iTunes 10.4).
    First test file is two 640x480 video tracks side-by-side (total dimensions 1280x480):
    http://160.94.17.23/demo/two-video-tracks-1280x480.mov
    All I see is the first (left) video track, and not the right one.  iTunes "Get Info" command incorrectly reports the video dimensions of the file as 640x480.
    Second test file is two 640x480 video tracks played one after another (duration of 10 seconds each):
    http://160.94.17.23/demo/two-video-tracks-640x480.mov
    All I see is the first video track, and although it reports the correct file duration (20 seconds), the second video track never appears -- it simply freezes on the final frame of the first video track for the last 10 seconds.
    Anyone else see similar behavior?  Unless I'm missing something, I suppose I should submit this as a bug to Apple.

    I have the same problem, i tried re-installing, converting it to AVC H264 but none seems to work so far

  • Playing multiple videos in sequence

    Hello all. I'm a complete newbie to Flash development, but
    have been thrown into it with not just a deadline, but a (to me)
    "complex" project. I have a Flash project which currently opens and
    plays a video as part of whats on "the stage". I now need to add 2
    more videos which will play, in sequence, after the first one
    finishes. I've gone through the tutorials, read the help files, and
    now I'm just feeling a bit "DUH" because I still can't figure out
    how to do this. Anybody out there care to help a poor ol' graphics
    guy avoid the bitter wrath of his boss?

    A single instance of FLVPlayback can handle multiple videos.
    I can't remember what the upper limit is. So you can switch between
    them based on user input. But I believe it can only ever play one
    at any one time. I've used FLVPlayback quite a lot but not for what
    you're describing, so can't answer from direct experience.
    Check out this page, and the trivial example at the end
    (whether its streaming or progressive is irrelevant here, streaming
    should work just as well, but perhaps you need to use SMIL files
    for the streaming contentPath?)
    http://livedocs.adobe.com/flash/9.0/main/00002980.html#wp3780233

  • What is good practice for playing multiple video's in a single swf?

    Hello,
    I have build in the past a video wall with video's inside. After building this i came across some problems.
    If you have too many video players loading at once it takes a lot of processing and the tweens in the
    page while loading the video's where not moving fluidly, but more in a stuttering way.
    After lot's of test i found a good working solution.  I imported the flv video's into flash en exported them on the timeline
    as a embedded swf.  Then i externally loaded these swf files and that performed much better.
    Is it even good practice to load multiple video instances at once? I used this time the LoaderMax of greensock but the video's
    only play after it's completely loaded. I would like to find a way to progressive play all video's at.
    Does someone has experience with this?
    Regards,
    Chris.

    How about an XML file which supplies the title for each movie and the location or source of the video to be played?  Simple version below.
    <?xml version="1.0" ?>
    - <playlist>
    <video src="Gfx/video/Alex1.f4v" title="John Deere 330" />
    <video src="Gfx/video/Benni1.f4v" title="Hitachi Z240F" />
    <video src="Gfx/video/Scotti1.f4v" title="Hitachi Z350F" />
    <video src="Gfx/video/Scotti2.f4v" title="Hitachi Z350F" />
    </playlist>
    JR

  • Playing multiple videos in single FLV instance.

    Hi, I'm trying to get a video application to work. The basic
    question I have is: can i get multiple videos on a flash streaming
    server to play in a single FLVPlayback instance? (I want the user
    to be able to choose the video based on a button, not play in
    succession.) Or do I have to set up a custom player using
    NetConnection and NetStream classes along with the
    NetStream.play(vidname) method ?
    I really need to be pointed in the right direction on this
    because the project is due asap.
    Thanks!!!

    A single instance of FLVPlayback can handle multiple videos.
    I can't remember what the upper limit is. So you can switch between
    them based on user input. But I believe it can only ever play one
    at any one time. I've used FLVPlayback quite a lot but not for what
    you're describing, so can't answer from direct experience.
    Check out this page, and the trivial example at the end
    (whether its streaming or progressive is irrelevant here, streaming
    should work just as well, but perhaps you need to use SMIL files
    for the streaming contentPath?)
    http://livedocs.adobe.com/flash/9.0/main/00002980.html#wp3780233

  • Play multiple videos in sequence

    Hi,
    I've multiple videos stored in FMS and would like to merge them into a single video object in order to play all of them in sequence (so that a user thinks it's a single longer video). Is it possible?

    This is a link from 3.5 but have you tried this:
    http://www.overdigital.com/2009/08/02/flash-media-server-as-video-editingstitching-tool/

  • How to use JMF to play the video data in a array(not in a local file)?

    dear all:
    I am a newer to JMF.
    Now My program has a thread which is always inputing mpg video data into a static array, so I want to wrap this array as a DataSource, then let the player play the video.
    But I don't know how to wrap that as a DataSource, What I know is just play a media file.
    So could any guy give me some advice??
    Really appreciate your help!
    Thanks
    Sam
    MSN: [email protected]
    Email: [email protected]

    I have never tried doing what you are soing so I am just thinking aloud. I think that using datamerge for this is going to assign the same ID to the fields, which is why the checkboxes are filling when selecting one of them. Open the PDF in Acrobat to check it though.
    Another thought. Are you merging to a new document or direct to PDF? If going direct to PDF, try creating the merge document first. If that doesn't work, I think it will be the field IDs being also replicated. If so, then the only course of action would be either manually changing them in Acrobat, or an ID script and or an Acrobat script. Neither of which I have heard of. But if they do have the same IDs, then I would inquire in both the ID scripting forum and the Acrobat forum.
    Good luck. Interesting use of datamerge. I hope you find a suitable answer.
    Mike

  • StageVideo play multiple videos in sequence (playlist) on iOS

    Hi everyone!
    I have to play severals locals videos in sequence with stageVideo (imagine an dynamic background wich runs an playlist).
    Its runs very well (the MP4 videos play smoothly) but when the videos are switching appear an full sreen white frame for 3 seconds and later the second video start to play (on my iPhone4). 
    private function netStreamStatus(event:NetStatusEvent):void{
             if (event.info.code == "NetStream.Play.Stop"){
                     netStream.play(VIDEO2)
    If i rewind the first video (loop) the white frame never appear:
    private function netStreamStatus(event:NetStatusEvent):void{
               if (event.info.code == "NetStream.Play.Stop"){
                     netStream.seek(0)
    ¿How can i do an smooth video change with an stageVideo and ios devices?
    Thanks a lot!

    Here i attach an FXP project (Flex 4.6 Mobile APP) wich play some videos with stageVideo.
    You can see in a real device like iPhone 4 (not desktop) an BLACK screen when swtiching videos (about 3 seconds).
    Can anyone helpme please?
    Thanks a lot!
    http://goo.gl/75tBz

  • Quicktime playing multiple videos question

    Hello Everyone.
    This is probably more of a html/java/flash based question but I thought I would start here as it revolves around the QT Player.
    I have a webpage
    http://www.drewwfilms.com/Temp/Ket/KetWedding.html
    On this page is the QT Player.
    Beneath the player are 3 buttons. When a viewer clicks one of those buttons I want it to load the respective video related to that button into the player without the browser loading a new page. Is this possible?
    Can someone steer me the right direction? Or help me out? I'm not even sure how to google search this. I tried Multiple Videos, 1 QT player Web - and I didn't get anything that helped.
    Thanks!

    I've been having this truly obnoxious problem ever since I installed Lion. Whenever I open a Quicktime video or a preview jpeg (and sometimes a Word document) - the last two or three documents I've viewed in these programs also open.
    This is the normal default mode for Lion which now "remembers" what documents (files, movies, images, etc) were opn when you last "Quit" each application. Either learn to close the documents before "quitting" the app or turn this feature off. (I.e., deselect the "System Preferences > Personal > General > Restore windows when quitting and re-opening apps" option.)

  • Playing multiple videos on the same page in Dreamweaver CS4?

    Suppose on my website, I have a few dozen videos, all of them embedded YouTube videos. When the user goes to the page, Video 1 is up and ready to be played. Below Video 1 is a list of the other videos (Video 2, Video 3, and so on), each with a thumbnail picture. When the user clicks this thumbnail page, the new video is loaded (eg: if they click on the thumbnail for Video 2, Video 2 is up and ready to be played).
    What do I do in Dreamweaver CS4 so the new video loads without redirecting the user to another page? With so many videos, I imagine that it isn't efficient to have a separate page for each video. 

    Hi
    You can do this by using an xml playlist for your videos, (do a search for "creating flash xml playlists").
    PZ

  • Captivate 7 HTML 5 publish does not play multiple videos on same slide on Android devices

    Hello,
    I have a captivate module which has 2 videos on same slide. There are 2 buttons, clicking on which the videos appears. However when i test this on iPad or any Android device, it plays on 1 video. I used Event video. Can someone please help me on this?
    Regards
    Manoj

    I don't think you are missing anything. I am using the "Light_PAssage" animantion, but switching to the one you used has no impact.
    For me, if there is a text animation on slide one, it will play in File->Preview->Play Slide. It will not play in FIle->Preview->Project, From this slide, or Next 5 slides.
    The issue occurs in all my Captivate 5 projects, including projects that previously generated properly working outputs as recently as 2/23/2011.
    Is it possible it's related to Flash player? I am using Adobe Flash Player 10 ActiveX 10.2.152.26.
    I will send an example cptx to your email address. The example includes a blank slide one, and the text on slide 2 plays as expected in the previews and in the generated output. If I remove the blank slide 1, the text animation on the new slide 1 no longer plays.
    Thanks.

  • Is it possible to play multiple videos in sync?

    I need to build a website which shows multiple instruments in a band, being played in sync.  Each camera/video block is a different instrument, and played together, they constitute an entire band.  I have been searching high and low for ways to do this, and it definitely appears that HTML5 is out.  It looks like standard FLV progressive download is out, too, because it's impossible to get 4-8 videos to sync perfectly.
    I see on the FMS page that it has some abilities in synching.  How would one (conceptually) go about making a webpage where say 4-8 videos begin to buffer, then when ready, play in sync?  And they would also need to, when the location is changed, all sync to that location and rebuffer. 
    The objective is so that the user can mute/solo each video's audio, to remove an instrument(s) from the "mix" at any time.
    An alternative way of doing this, I think, would be to just put the 4-8 videos together in video editing, and encode this into one video, but have each video's audio track be a separate audio channel.  If FMS can do multichannel audio on one video, this might work, if it could mix them in/out individually, as the user requires.
    Any insights on this problem would be greatly, greatly appreciated. 
    Thanks!

    sandyaudiovisual,
    Very good point.  I was, in a way, asking both.
    Yes, it appears that actually streaming multiple streams of video while visibly playing in synchronization simultaneously will be very difficult.
    So, I was thinking that as an alternative, I could pre-mix the multiple "streams" of video into just one video.  E.g., a single video file, with for example five squares each with a different video inside of it.  So to the view, in a sense, it looks like five streaming videos in sync.
    What I would then want to do, in that situation, is be able to mute/solo an audio track associated with each "video".  In reality, it would be a single video channel, with five audio channels, switchable while maintaining synchronicity.  Though the extra wiggle is that rather than simply switching between 1 and 5, it would be preferable to actually mix in/out channels 1-5, so that at any time, 1, 2, 3, 4, or 5 audio channels would be playing, in synchronicity, and could be muted/soloed.
    To give a visual idea, there would likely be a mute and solo button composited on top of each "video" box inside the main video.
    It would be easier if we could actually stream five separate video files and have them be in sync, with all stopping to wait should one need to rebuffer, and all sharing the same transport controls, because then if we want to swap out one video, we just swap that file, rather than remake the entire file in Final Cut or whatever.  But this is sounding less and less possible.

  • Play multiple video clips in slide show

    I have 4 video clips (or I can do it in 1 movie) I want to have a menu screen with one of the themes. Then I want the viewer to be able to choose clip 1 and then play all the way through the other 3 clips in succession. Or I want them to be able to click clip 3 and then have it play clip 3 and then through to clip 4 and return back to the menu. So basically I would like to work like a standard movie DVD you purchase at a store. Is this possible?
    I know you can put clips into slide shows (hence the title of this thread), but when I do that, it automatically starts to play through the clips. Is there a way to choose the slide show and then to give you the option in there to choose which clip your want, and then to play through the rest sequentially?

    Here's a technique I like to use...
    Create a shape -- It will be black and white where the white is what you want to show video. In the control tab of the shape you can change size/softness/location/aspect... etc.
    Lay the video on the track above - Change the VIDEO track's composite mode to TravelMatte-Luma.
    Use the video's motion tab viewer and image/wireframe in the canvas to center up the image you want.
    Add another shape above that and then video track and change to TravelMatte-Luma etc.
    The plus for this way is that you can change the video without have to reset all the croping and trying to match it all.
    Timeline pic: http://homepage.mac.com/captmench/Timeline.png
    ExampleVideo: http://homepage.mac.com/captmench/LumaMatte.mov
    Good luck,
    CaptM

  • Playing Multiple Video Clips on the Same page

    Hi Folks,
    Let's try this again. If I set up a page with a single flv
    playing off our Flash Media Server 2, everything works just fine.
    If I create a page with several flv files on it, some of them load
    and then I get nailed with Certificate Alerts. All of the videos
    are coming from the same server, same designation and work fine -
    just not when there are several of them on the same page.
    Thoughts and comments are most welcomed
    Thanks - Greg

    Certificate alerts, as in SSL certs? I'm wondering if you
    have some sort of connection shotgun that's causing some of the
    connections to try an rtmps or rtmpts connection. If you have a lot
    of connections trying at once and something botttlenecks, that
    might be the result.
    It would be helpful if you provide some more details,
    including the text of the alret and the code you're using to
    connect to FMS.
    Incidentally, does your application absolutely require that
    you have separate swf's making connections to FMS? It would be a
    shame to waste all of those connections if there is any practical
    way around it.

Maybe you are looking for

  • Disk Utility won't create Disc Image from DVD

    I'm trying to copy a DVD that I made in iMovie and iDVD. The DVD plays fine, using DVD Player. I open Disc Utility, select the DVD, click "New Image," and save to a directory. The hard drive has plenty of room. Disk Utility then shows a stop sign and

  • How to allow create different transaction type for different customer

    We are using CRM 7.0 now. We have two types customer, one is sap customer, the other is potential customer. We want to distinguish the two types customer. And user can create all transaction (for example: quotation, opportunity, activity) the sap cus

  • FaceTime can't sign in.

    FaceTime can't sign in with good Apple ID.

  • Anyone successfully imported MYOB data to SAP B1?

    Hi, Does anyone successfully imported/migrated an MYOB data into SAP B1? What actually the necessary steps prior to importing legacy data into SAP B1 after creating the Company Database? After successfully created a company data file in SAP B1, can I

  • Two questions about smart cards

    Hi there, I've got some problems with my smart card. It's greater than my skills. Here's what I would like to ask you: - I'm using GPShell to list all applications. Here's output: mode_201 enable_trace establish_context card_connect -readerNumber 2 *