Calling AVMix module's public methods from http provider

Hi,

Referring to the AVMix module,

https://www.wowza.com/docs/how-to-mix-audio-and-video-from-different-live-sources-moduleavmix

Any lead or example on how to call the public methods available in this from an httpprovider? Looking for a basic example for this specific module, not generic httpprovider example.

Thanks!

Never mind. There was another module, as usual, conflicting.

Thanks!

Inderjeet

Ok thank you for updating us @Inderjeet S Sodhi. I checked with one of our engineers and he said that you would need to get a reference to the appInstance and then do something like the following from your Http Provider:

ModuleAVMix mixer = (ModuleAVMix)appInstance.getModuleInstance("ModuleAVMix"); //name used in Application.xml.
if (mixer != null)
{
    // call one or more of the mixer methods
    mixer.addOrUpdateOutputStream(...); 
}

Hello Rose,

Thank you for the reply. Yes, that’s correct. Although I had included it in the same package just needed an instance of the class instead of the module :-).

By the way, calling mixer.addorUpdate… runs into a problem when publishing the stream as the stream already exists (streampublisher says so and gets into a loop there). To workaround, shutdown the stream before calling addorUpdateOutputStream(…). This works, however, creates a break in the player side connection (obviously) and the player has to be re-started (play again).

What could be a better way to get it going without shutting down the stream, something like a seamless switch? Or at least the player need not be restarted?

Thanks

Inderjeet

I’m sorry @Inderjeet S Sodhi, I’m not familiar enough with that workflow to provide an answer, but you could receive some suggestions from our engineering team if you submit a support ticket.

https://www.wowza.com/support/open-ticket

One solution would be to immediately create a new stream using AVMix and use that one for playback from the start. Then, when you want to make the switch, you can simply update the audio and video source of this stream, instead of shutting it down and starting a new one.

Hi SiggDev,

Thank you for your input.

Yes, that’s the concept. The stream to be updated (and is the output stream) is created initially by the AVMix module only, using the Application properties (also tried creating it onPublish of a live stream via AVMix - same result) and then being updated via http. I haven’t been able to test this further but will do and update. Although I suspect some change would be needed in the module, since when it is run the first time, there won’t be any other stream by that name as it gets initiated on Application start. Over the weekend, I’ll try making a call from another module then see what happens and update here.

Also wondering if any way to mix a stream from another application. Not worked on this yet just a thought.

Thanks,

Inderjeet

Hi Rose,

Thank you for the update. Although a support request wasn’t necessary, I heeded your request and created one. Just thought that the module might actually be needing an update (although I am most likely wrong) or some modification which could improve it. So working with @Roger Littin on the same via a ticket.

I will try to test this over the weekend most likely then post the outcome.

Thank you for your time to read, review and reply to the message.

Warm regards,

Inderjeet

I’m not sure if there is any way to directly use a stream from a different app. You can however dynamically push a stream from a second app to the first app, and then use it directly in the first app.

Bear in mind that while pushing streams will work nicely, it may not be the best approach if you need a large number of streams, as pushing adds additional load to the server.