Wowza Community

sample code for sending/recording live stream in Java code from server

Hi, I want to know the procedures/step to send/receiveing live stream from Java code via wowza media server. Any sample code/example is appreciated.

I think you already found the method for receiving packets in the video pass thru package. We do not have a public api for publishing to the server at this time. You can package your stream as either an RTSP/RTP or MPEG-TS stream using H.264/AAC and we can accept it that way. It is probably the easiest way to get it done.

Charlie

I am not sure what you are asking. The example .fla that is included with this package is a little misleading. It is just a quick way of testing the live stream record package. All that is really needed is the subscribe stream. The play stream is just for playing the stream that is being published. So to record a stream all you need is the publish stream. If you also want to view the stream that is being recorded/published then you need the play stream.

Charlie

1, You pass the name of a stream that is already being published with the “live” or “live-lowlatency” stream type, usually a stream that is being published from that client. Take a look at the source code of the example: LiveStreamRecord\client\livestreamrecord.fla that is in the package.

nc.call("startRecording", null, publishName.text);

2, Yes, the same live stream can be viewed by clients while recording.

Richard

Charlie,

Thanks for your response and sample codes. I am new to wowza and then please excuse me for some basic questions,

(1) in startRecording() of class ModuleLiveStreamRecord, it looks like that the client application sends an event to trigger the function in server side. My confusion is about the stream. Is the stream_name passed by the client app? If yes, how does the client generate the stream name? Should the stream name be unique, and associate with some hardware (i.e., webcam) in client side?

(2) Can the “stream” be used to pass only one-way or two-way media traffic bewteen the client app and server? In other word, if I want to send/publish my live stream to this client, do I need to create another stream or can I use this stream to both send/publish and record?

Thanks for your clarification

Hi,

I read the .fla and .java code from LiveStreamRecord package. It looks like that the client app (.as/.fla file) defines two streams(names), subscriberName for receiving the video/audio from the server and publishName for sending the video/audio from the camera or speaker attached in client side. netstream.play(subscriberName) and netstream.publis(publishName) are used to associated with the device with the server. Then, the app in the servers records the audio/video from the client side via publishName; the app in the server sends the audio/video to the client via subscriberName. So, generally, one connection needs two single-direction streams. Please clarify it. Thanks,