7 Replies Latest reply on Feb 16, 2012 6:15 PM by ReDrUmNZ

    SerialElement and preloading DynamicStreaming

    carlodemarchis

      HI,

      We are trying to create a solution where each video is prefixed by a 5 seconds videoBumper intro, that is defined upfront not ad-served.

      The videos are all using dynamicstreaming and the bumper is a simple video.

      We are using a SerialElement adn trying to use a preload function (with play/pause) to achieve smooth transition between the bumper and the real video.

      Preload works ok for the normal video but for the Dynamic streaming for some reason it create an issue: when the player reaches the dynamicstreaming video it continue to play until the end but the video player shows no video = black screen.

       

      I don't understand why it doesn't work.

      Any idea?

        • 1. Re: SerialElement and preloading DynamicStreaming
          bringrags Level 4

          Can you post a code snippet we can use to reproduce the problem?  Thanks!

          • 2. Re: SerialElement and preloading DynamicStreaming
            carlodemarchis Level 1

            Thanks Brian,

            Please find the code below - "res" is the dynamic streaming smil loaded - please note that if i remove the preload calls everything works.

             

             

               var resource:URLResource = new URLResource(new FMSURL('rtmp://cp67126.edgefcs.net/ondemand/mediapm/strobe/content/test/SpaceAloneHD_sounas_640_5 00_short'));

            var kvFacet:KeyValueFacet = new KeyValueFacet(MetadataNamespaces.SUBCLIP_METADATA);

            kvFacet.addValue(MetadataNamespaces.SUBCLIP_START_ID, 0);

            kvFacet.addValue(MetadataNamespaces.SUBCLIP_END_ID, 5);

            resource.metadata.addFacet(kvFacet);

            bumperElement = new VideoElement(new NetLoader(), resource);

            preload(bumperElement);

             

            mediaElement = new VideoElement(new DynamicStreamingNetLoader(), res);

            mediaElement.addEventListener(MediaErrorEvent.MEDIA_ERROR, onMediaError);

            preload(mediaElement);

             

            serialElement = new SerialElement();

            serialElement.addChild(bumperElement);

            serialElement.addChild(mediaElement);

             

                 function preload(mediaElement:MediaElement):void

                 {

            var loadTrait:LoadTrait = mediaElement.getTrait(MediaTraitType.LOAD) as LoadTrait;

            loadTrait.addEventListener(LoadEvent.LOAD_STATE_CHANGE, onLoadStateChange2);

            loadTrait.load();

             

            function onLoadStateChange2(event:LoadEvent):void

            {

            if (event.loadState == LoadState.READY)

            {

            loadTrait.removeEventListener(LoadEvent.LOAD_STATE_CHANGE, onLoadStateChange2);

             

            var playTrait:PlayTrait = mediaElement.getTrait(MediaTraitType.PLAY) as PlayTrait;

            playTrait.play();

            playTrait.pause();

            }

            }

                 }

            wrapper.element = serialElement;

            wrapper.mediaPlayer.autoPlay = true;

            • 3. Re: SerialElement and preloading DynamicStreaming
              bringrags Level 4

              What you're doing looks valid -- can you file a bug on the issue?

               

              Another approach you could try if you're aiming for seamless transitions is to use a ProxyElement to toggle between two different MediaElements (thus allowing you to control the state of the non-visible one while the visible one is playing).  I recently added such an example to the ExamplePlayer, see http://opensource.adobe.com/svn/opensource/osmf/trunk/apps/samples/framework/ExamplePlayer /org/osmf/examples/switchingproxy/SwitchingProxyElement.as.  In this example, the proxy switches based on a Timer, but you could modify this to switch in response to the "complete" event of the bumper video.

              • 4. Re: SerialElement and preloading DynamicStreaming
                rshin Level 3

                Hi,

                I just happend to look at this and filed here with an example based on your description : https://bugs.adobe.com/jira/browse/FM-343  where

                you can trace this issue.  (If this is not what you described, please feel free to file it).

                 

                 

                Ryan

                • 5. Re: SerialElement and preloading DynamicStreaming
                  carlodemarchis Level 1

                  Thanks Brian and Ryan,

                  I've tested the SwitchingProxy samples and have a similar issue, the second video (same as for my serial test - the elephant video smil) will only play audio and show no video.

                  Also in your example app it happens the same the second video has audio only and the main video freezes.

                  Could be something wrong with my setup?

                  • 6. Re: SerialElement and preloading DynamicStreaming
                    rshin Level 3

                    This issue has been addressed in this Sprint11.

                     

                    Ryan

                    • 7. Re: SerialElement and preloading DynamicStreaming
                      ReDrUmNZ

                      Hi Ryan,

                       

                      I'm experiencing the same issue with OSMF 1.6.1. In a SerialElement with two PreloadingProxyElements which contain dynamic streaming videos. When the second video starts it plays audio but displays no video. Removing the PreloadingProxyElement wrapper shows both videos correctly.

                       

                      I'm using the PreloadingProxyElement from the ExamplePlayer sample org.osmf.examples.seeking.PreloadingProxyElement.as

                       

                      // NOTE: these videoElements use DynamicStreamingResource's

                       

                      // Attempt at preloading

                      var serialElement:SerialElement = new SerialElement();

                      serialElement.addChild(new PreloadingProxyElement(videoElement)); // plays video

                      serialElement.addChild(new PreloadingProxyElement(videoElement2)); // plays audio only

                       

                      // No preloading - both videos play video correctly

                      var serialElement:SerialElement = new SerialElement();

                      serialElement.addChild(videoElement);

                      serialElement.addChild(videoElement2);

                       

                      Any idea's?