0 Replies Latest reply on Feb 21, 2013 7:58 AM by 5lampsdev

    Cuepoints when changing video




      I am making a video switching project which switches between videos, and resumes at the current time. The project requires the video to pause at certain points to display information. The cuepoints will remain the same between videos and the video length are exactly the same (videos show same scenario but at different angles).

      So far I have made a working video player with one button to switch to another video. If I let the first video play throughout, all cuepoint events are triggered. If I change video before a cuepoint has fired, the cuepoints are no longer triggered throughout the whole video. Here is the code:



          import com.devnet.osmf.events.*;
          import flash.display.MovieClip;
          import flash.events.MouseEvent;
          import flash.events.Event;
          import org.osmf.media.MediaPlayer;
          import org.osmf.events.TimeEvent;
          import org.osmf.containers.MediaContainer;
          import org.osmf.metadata.*;


          public class OSMFComponents extends MovieClip
                  private var curr:Number;
              public function OSMFComponents()
              controlBar.mediaPlayer = mediaDisplay;
              mediaDisplay.load("Scenario A.mp4");
              mediaDisplay.autoPlay = true;


              mediaDisplay.addASCuePoint(10, "Chapter 1");
              mediaDisplay.addASCuePoint(20, "Chapter 2");
              mediaDisplay.addASCuePoint(30, "Chapter 3");
              mediaDisplay.addEventListener(CuePointEvent.CUE_POINT, onCuePointEvent);
              changeVid.addEventListener(MouseEvent.CLICK, changeVideo)



      public function onCuePointEvent( event:CuePointEvent ):void
          trace("Show text or graphics… name = "+event.name+", time = "+event.time);

        private function changeVideo(e:MouseEvent):void
         curr = mediaDisplay.playheadTime;
         mediaDisplay.load("Scenario B.mp4");
         mediaDisplay.addEventListener(Event.ENTER_FRAME, changeVideoNow);

        private function changeVideoNow(e:Event):void
         if(mediaDisplay.bytesLoaded == mediaDisplay.bytesTotal) { // && mediaDisplay.cuePointsLoaded) {
                     mediaDisplay.removeEventListener(Event.ENTER_FRAME, changeVideoNow);
         } else {
                trace("video not fully loaded yet");




      So if changeVideo() is called, the video changes and resumes in the correct place thanks to changeVideoNow(). However, the cuePoints assigned to mediaDisplay no longer fire. Any ideas why?


      I am using the tutorial from here:  http://www.adobe.com/devnet/flash/articles/osmf-media-player.html