Hello, I’ve been having a hard time solving this, so I decided to post here.
What I’m trying to do is basically stream h264+aac content with the addVideoData/addAudioData functions.
I managed so far to implement an IServerNotify2 class that creates a publisher and streams the data correctly, adding the video and audio frames in the publisher.
This works perfectly, but now I’m trying to do the same on a per client basis, in a ModuleBase class as I assume I should.
I manage to take the current stream and add the video/audio data to the stream apparently correct in the play function (meaning that if I grab the current stream from another part of the code and use the ‘createSnapshot’ sample function, I get back perfectly healthy frames).
The problem is the stream never gets sent to the actual player.
In (very) short, what I have now in the module is:
public class streamer extends ModuleBase
{
...
public void PublishVideo(IMediaStream ims)
{
ByteArrayBuffer vc = new ByteArrayBuffer();
... // create/get the video data to send
ims.setVideoTC(DTS, true);
ims.setVideoSize(vc.size());
ims.startVideoPacket();
ims.addVideoData(vc.getRawData(), 0, vc.size());
}
public void play(IClient client, RequestFunction function, AMFDataList params)
{
IMediaStream ims = client.getAppInstance().getStreams().getStream(client, function.getSrc());
... // set stuff on stream
while(true)
{
PublishVideo(ims);
}
}
}
Now, before anyone asks, the problem isn’t related to the actual video content/headers I pass in, as the same functions are used in the publisher, and that works fine, only difference I see is that in the publisher I have a clientless stream that I get from startup, and I add frames to it through the publisher, and here I’m trying to add frames directly into a client stream I get on ‘play’.
Any suggestions will be welcome