Skip to main content
Inspiring
November 28, 2012
Question

How can you use one NetStream to publish video and audio from another NetStream in AS3?

  • November 28, 2012
  • 1 reply
  • 3566 views

Let's say one of your client programs in AS3 is able to receive live video and audio from a NetStream and play it on the screen.  How could you make it also take that video/audio stream that it's receiving, copy it over into another NetStream, and publish it elsewhere?  I need to know how to do with this regardless of whether RTMP, RTMFP, or some mixture is involved.  The reason why the stream needs to be relayed this way is a real long story, but it's necessary in this particular case. Thanks!

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
November 28, 2012

if you can load the video file you can use the appendBytes method of the netstream class.

Inspiring
November 29, 2012

Can this be used to facilitate a live, three-way video chat?

sinious
Legend
November 30, 2012

i think (but haven't tried) each client can use the same generic header for each message.  but, if the op intends to send continuous video, i think you're correct, performance will be problematic.

i was thinking about sending a video snippet only when one of the peers had something to say.  even with that limitation, if there are more than 2 people connected, this will be a mess with each client (trying to) display feeds from every peer.


You can reuse the same meta for each connect as long as you send the end to flush the FIFO so it presents and restarts.

The CPU threads everything it's doing so fast it gives the illusion that iTunes is somehow dedicatedly playing your music while also dedicatedly playing your video game, with no studders, on a single CPU system (pre-multi-core). It's an illusion. The CPU was always chopping each task into tiny bits, processing them so fast the audio never studdered and the game FPS stayed smooth.

This is the same basic illusion only the wildcard here is the network. With RTMFP offering direct connections (after negotiation), the video quality will rely on the users system to relay the feed. Not ideal but possible. If all conditions are ideal (fast computers, fast broadband), it's feasible the same illusion could happen, especially LAN.

Mixing RTMP (tcp) and RTMFP (udp) together (as I saw in your other post), well, now you're getting into some really exotic requirements that an internet service should be handling for you.