2 Replies Latest reply on Sep 14, 2010 10:01 AM by weizhangstrobe

    can I use the FLVTagScriptDataObject to call a function when the netstream byte parser gets to it?

    everythingelsewastakentoo

      Hi,

       

      I am trying to trigger an event when the netstream begins to play a certain portion of a flv file that is being fed into the stream via the appendBytes method.  Is there anyway to feed the event, or a function, or any means of communicating that playback has reached this point into the byte parser?  I figured it would be possible using the FLVTagScriptDataObject but I cannot get any sort of callback when I pass the bytes generated from the tag into the appendBytes method.

       

      var dataTag:FLVTagScriptDataObject = new FLVTagScriptDataObject();
                  
                  dataTag.objects = [{"textData":"text"}];
                  
                  var bytes:ByteArray = new ByteArray();
                  dataTag.write(bytes);
                  appendBytes(bytes);

       

       

      I tried something like this trying to create a onCuePoint or onTextData callback but I didn't have any success.

       

      Any pointers?

       

      Thanks.

        • 1. Re: can I use the FLVTagScriptDataObject to call a function when the netstream byte parser gets to it?
          everythingelsewastakentoo Level 1

          I found a code example in the HTTPNetStream.as around line 1171:

           

          case HTTPStreamingState.STOP:
                                  var playCompleteInfo:Object = new Object();
                                  playCompleteInfo.code = NetStreamCodes.NETSTREAM_PLAY_COMPLETE;
                                  playCompleteInfo.level = "status";
                                                         
                                  var playCompleteInfoSDOTag:FLVTagScriptDataObject = new FLVTagScriptDataObject();
                                  playCompleteInfoSDOTag.objects = ["onPlayStatus", playCompleteInfo];
                     
                                  var tagBytes:ByteArray = new ByteArray();
                                  playCompleteInfoSDOTag.write(tagBytes);
                     
                                     CONFIG::FLASH_10_1
                                  {
                                      appendBytesAction(NetStreamAppendBytesAction.END_SEQUENCE);
                                      appendBytesAction(NetStreamAppendBytesAction.RESET_SEEK);
                                  }
                                 
                                  attemptAppendBytes(tagBytes);
                                  setState(HTTPStreamingState.HALT);
                                   
                                  break;

          • 2. Re: can I use the FLVTagScriptDataObject to call a function when the netstream byte parser gets to it?
            weizhangstrobe Level 2

            There are two things you may want to know.

             

            1. The parsing of the stream data does not happen all the time. We only parse it for specific purposes, such as enhanced seek, where you must know the timestamp in order to accelerate the playback to a specific point. To do thing, you need to have a derived class of HTTPNetStream, a major undertake IMHO.

             

            3. Even if you successfully manage to send the data object to appendBytes, still you are required to implement a callback function and register with the NetClient object that gets attached to the HTTPNetStream object at runtime.

             

             

             

            -Wei Zhang

            Senior Computer Scientist

            Adobe Systems, Inc.

            weizhang@adobe.com