3 Replies Latest reply on Jan 12, 2011 4:35 AM by Mykola3296

    timecode OnFI and OSMF

    Evets6bi Level 1

      Hi,

      I want to know how to read the timecode from a video with osmf.
      With  netstream I use onFI() method and in OSMF?

      Thanks

        • 1. Re: timecode OnFI and OSMF
          Mykola3296 Level 2

          Hello!

           

          LightweightVideoElement (and descendants) has a "client" property that is set to org.osmf.net.NetClient class instance upon load.

           

          Upon element load you may use something like this:

           

          var client:NetClient = NetClient(videoElement.client);
          client.addHandler("onFI", onFI);
          
          private function onFI(info:Object):void {
               trace (info["sd"]);
               trace (info["st"]);
               trace (info["tc"]);
          }
          

           

          See NetClient source for details..

          • 2. Re: timecode OnFI and OSMF
            Evets6bi Level 1

            ok Thankks, but i not use video element.

            I'have this:

             

            var f4mLoader:F4MLoader = new F4MLoader(new SmoothedMediaFactory(SMOOTHED));
            mps.media = new F4MElement(new URLResource(pathNC), f4mLoader);

             

             

            where SmoothedMediaFactory is my custom mediafactory

            • 3. Re: timecode OnFI and OSMF
              Mykola3296 Level 2

              I've done it this way:

              1) Created TimeCodeVideoElement with:

              /**
               * @inheritDoc 
               */          
              override protected function processReadyState():void {
                   super.processReadyState();
                   
                   if (null == _watcher) {
                        _watcher = new TimecodeWatcher(this);                    
                   }
                   _watcher.client = client;
              }
              

              Watcher does the job I described above (sets a function listener).

               

              2) Created a MediaFactory override with:

              addItem
                   ( new MediaFactoryItem
                        ( "org.osmf.elements.video"
                             , netLoader.canHandleResource
                             , function():MediaElement
                             {
                                  return new TimecodeVideoElement(null, netLoader);
                             }
                        )
                   );          
              

              for each item you want the default VideoElement to be replaced with a timecode watching.

               

              3) I've outputed time data to the outside world using a custom MetaData - so it is visible through any number of proxies above (F4M in your case).