Copy link to clipboard
Copied
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 ?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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...
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
thanks Mike, it's perfectly clear now.