Skip to main content
October 3, 2010
Question

How to publish self-composed bytes array as video ?

  • October 3, 2010
  • 7 replies
  • 2153 views

So far I only find the way to publish camera video as stream: attachCamera()


Is it possible to publish self-composed bytes array as video ?

    This topic has been closed for replies.

    7 replies

    April 13, 2011

    thanks Mike, it's perfectly clear now.

    April 13, 2011

    ok it's more clear now thanks.

    you talk about video, but for sound is it the same ?

    if yes so the only way to play it on a client would be

    a handler that catch these bytes and put it on a video or sound object ?

    Thanks

    Adobe Employee
    April 13, 2011

    NetStream.appendBytes() lets you add video, audio, and data (NetStream.send()) messages to the display/render pipeline.  appendBytes() takes FLV data of any valid FLV message types.

    whatever you put into a NetStream.send() will come out at all the subscribers.  NetStreams play back video, audio, and data (that's how your NetStream.send() on the publisher turns into a callback at the subscribers).  so if you appendBytes an FLV with timestamped audio, video, and data, then the video, audio, and data will play back on that NetStream just as if the messages came over the network.

    April 12, 2011

    in other word I would like to inject these bytes and play it from fms

    with a Stream object and play it from any rtmp player...

    Adobe Employee
    April 12, 2011

    NetStream.send() messages a part of the stream, just like video and audio messages.  if you publish a stream to FMS that has NetStream.send()s in it, and republish that stream on FMS, then any subscribers will get the corresponding callback for what you specified in NetStream.send().

    you can't inject a video or audio message into a stream programatically.  FMS does not have anything like NetStream.appendBytes().  appendBytes() is only for playback in the client; the bytes you append only go into the display pipeline, never into the network pipeline.

    April 12, 2011

    ok understood.

    but will it work if :

    - is use netstream.send():

    - I grab this stream on fms side and publish from it to another fms/rtmp server

    ??

    thanks

    April 12, 2011

    Hi Mike,

    what about use what you said with FMS ? is it theorically should work ?

    as I use netstream.send("onVideoBlah",byteArray) to fms and on fms should I use

    nestream.play(null) also to broadcast the stream to other clients ?

    thanks

    Adobe Employee
    April 12, 2011

    FMS doesn't have appendBytes.

    if your publisher is doing NetStream.send(), then all subscribers (whether P2P or through FMS) will receive your onVideoBlah callback.  the subscribers can use appendBytes to inject the ByteArray for display.

    Adobe Employee
    October 7, 2010

    i don't believe there's a way to inject bytes into a publishing NetStream and have it encapsulated as though it was a video message.

    however, you could do NetStream.send("onVideoBytes", myBytes) at the publisher, and receiver(s) could, in their onVideoBytes() handler, use NetStream.appendBytes() on a different NetStream (connected to a video component) to display your generated video data.

    using appendBytes() properly for this purpose is an exercise for the reader. 

    -mike

    Participating Frequently
    October 6, 2010

    I don't think this is possible - as far as i know there is no such API in Flash Player which would allow publishing the way you are asking.