millicast / millicast-player-unreal-engine-plugin

Millicast Player plugin for Unreal Engine
Other
19 stars 15 forks source link

Audio errors when using multiple Millicast Instances and closing one of them #79

Open MaxDorn96 opened 7 months ago

MaxDorn96 commented 7 months ago

Hello dear Millicast Team.

I once opened a Thread like this before but after Updating and testing again I still run into Issues when attempting to have mulitple Millicast Streams in one Level at the same Time (Only Audio Issues).

Ive attempted to make a really simple Blueprint which can be seen in the Images below which gets close to the Solution we seek in the hope that you can easily replicate the Issue as well.

I am currently using Unreal Engine 5.2 while having this Plugin Version cd3b18a commit (09.01.2024)

In the following Image you see my newly created BP Actor. It has a Plane to display the Texture, an Aduio Component as well as both Millicast Components

SetupOverview

In the next Image you will see our BeginPlay Setup. We set the Millicast Information through Instance editable Variables so we can change each MillicastSources Informations per Blueprint Instance. Then we set the MillicastSource of the Director and Subscriber after setting the Variables, register our local Audio Component and Start a Timer which will attempt to authenticate.

We want to be able to Set the Millicast Information on runtime since later on we have these Informations connected to a CMS, but for this test all Informations (Token, StreamName, URL, AccountID) were entered in the BP Instance in the Level

SetupBeginPlay

In this Image you can see how we handle all other Events for the Test.

AllEvents

And at last you can see our BP in the Level. In the Inspector of the Blueprint on the Bottom right you see the Variables we set per BP_ManualMillicastTest We Create a MillicastMediaSource and MillicastTexturePlayer2D for each Instance and assign them, so both BP Instanced have a different MediaSource and a different TexturePlayer.

Then we set the StreamName and StreamToken for each Stream Individually

WorldSetup

After all this Setup in theory it kind of works. On Runtime I can Broadcast a VideoTest via the Dolby Dashboard (We use Vp9 and Audio+Video) and as mentioned before we just use the "StartVideoTest" in said Dashboard to test Audio + Video.

I can start these Video Tests and hear the Sound correctly inside the App, I can do so with 1, 2 or even more BP Instances. But If I for example have 2 Streams running and Stop one of them the Audio of the other Blueprint which is still running breaks, it sounds rather glitchy and not correct. Starting the closed Stream again fixed the Audio again.

So to summarize, I can start as many Streams as I want and hear/see them individually but closing one of them apperently breaks the Audio of the other Streams Ingame, even though each one has its own Audio Component etc.

Sorry that it became such a long Text, I wanted to give as many Information as possible

MaxDorn96 commented 7 months ago

As a additional note, even though I expected that already as well, I attempted to use a MillicastAduioActor for each Screen instead of the AudioComponent as well.

Aka I placed them In the Scene, had each BP Screen Instance reference its own Audio Actor and then used that Millicast Audio Actors Audio Component to register instead

image

Based on the Documentation one can also use the MillicastAudioActor Object Reference and connect it to the consumer Input in the AddConsumer Function which is called OnAudioTrack

image

But as far as I can see this isnt an Option anymore? At least a Object of type MillicastAudioActor isnt useable anymore, if Im not mistaken

MaxDorn96 commented 7 months ago

New discoveries xD

I will still have to test this in a Shipping Package Solution, but I believe I may have fixed the Issue. Because of the Documentation which only ever Unsubscribes from the Stream on EndPlay I did the same and assumed this was the way to go.

Now I've tested to Unsubscribe from one Stream completly in the OnInactive Event and attempt to Authenticate/Subscribe again afterwards which seem to fix the Audio Issues im Having.

So Subscribing to multiple Millicast Streams and closing one, at least for me, broke the Audio of the other streams as well. Subscribing to multiple Millicats Streams and unsubscribing it when it closes solves this Issue as far as I've tested in the Editor at least.

I will get back here after testing it further in a Shipping Package