Media Player (for background music) does not trigger on clients

Hello,

I have multiplayer game with background music player (Media Player controlled via “Open Playlist Index”) that can be controlled by everyone in the game.

Testing with double/triple PIEs windows.

The actual play events trigger on the listen server and all the clients, (song names etc. work on every player as expected) but the audio itself is not playing on clients, only on the server. I switch between the PIE windows and host blasts music as expected but clients remain silent even though they indicate that they have received the command to play music :frowning:

First I had a client → server → Multicast chain for this but because of this whole “music not playing on clients” problem changed the system to use RepNotify. No change.

Any tips / help would be appreciated :slight_smile:

in the rep_notify function you should PLAY the audio track.

Ultimately you should check “Get Local Role” == Autonomous Proxy (Branch True) → Play track

Thanks!

I think I am actually playing the audio track with the “Open Playlist Index”, according to the docs it should act as a “auto play” trigger for the media, and it does that on the host… And I don’t know what other Play nodes there could be if using a playlist?

And the BP “triggers” on the client too because all the BP nodes after the “Open Playlist Index” do work on both host & clients.

I tried the “ROLE Autonomous Proxy” detection but that only makes the player work on client like expected (again, it triggers but no actual audio is being output when the client PIE window is active).

Hmm! Strange…

However you are “starting” the audio should be triggered in the On_Rep function.


The Local Role check simply ensures that clients w/controllers (Actual players) are running the audio vs every simulated proxy. This type of flow control will massively reduce overhead across your project. Bots and sims of actual players don’t need audio or UI etc.

In a 4 player game there is 1 Autonomous and 3 sims per screen. Those sims don’t need all the extra stuff executing.

Thanks again :slight_smile:

This is the actual BP I have. It is inside a On_Rep function…

I thought I (somewhat) understood what I’m doing :smiley: But, clearly not enough.

I get the song name etc. on the host and client, all the sound effects etc. work on both, but the music: nothing on client.

What Type the “Play Music” variable?

Preferably that variable should be the “next song index”.

You’d RPC the server have it go through and SET the Next Song Index.

OnRep_NextSongIndex: Branch check local role [TRUE] → Open Playlist index (Next Song Index)

Clients should never have to check, nor configure the next song. It should be handled on the server and passed to them.

I see! I’ll refactor this a little bit and see what happens. Thanks!

Forgot to ask is the Audio Component that plays the track a world component (managed by Level BP), part of UI, part of the pawn?

Nooo… not working yet :smiley:

But at least I got the logic closer to the right way of doing things, thanks!

The OnRep variable is integer.

This is all just a temp testing “code” to get things working, a lot of actual needed details missing to make this usable.

The Media Player is part of the Pawn, could that be the problem?

No, but it doesn’t have to be. You could have a single Audio Component in the level and have the Level BP manage it via trigger boxes etc.

If it’s part of the pawn then you have to set the on_rep var for each pawn. If it’s a world actor you can just set the on_rep in the actor class, on the server. But the Actor itself has to be set to replicate.

I might need to get an another PC to test the standalone package, if the same problem persists. I have a feeling this all is down to multiple PIE windows or similar.

I have hard time finding any similar issues by just googling…

I’ll build one out in a few minutes. Should be fine testing in PIE w/Netmode client.

This might be completely different problem then network/client etc. I just tested in standalone with only one instance. And there’s no music!

Only way the music is audible is using the PIE and having the host window active.

I’m propably doing something wrong with the media player. I have the files in movies folder and “File Media Source” files are working etc. Playlist is working.

I have to check some things. I might need to try different player or similar.

I’ve got a setup running…simple play a random on begin play. I’m getting no audio on player 2. Even with a direct input that forces it to play, there’s nothing.

I’m thinking that there can only be one instance of the Media Player per game instance. I’ll do some more testing and get back to you. So don’t go crazy coding chasing your tail.


Process works perfectly with a standard audio component.

1 Like

Ah! Thank you sooo much for the help!

Might be best to just choose the standard audio component route then. Would have loved to use the playlists etc.

I’ll test a bit more tomorrow, now it’s 2am and have to be at work in 6 hours :smiley:

Thanks!

To finalize this topic: I ended up going the standard audio component way: Placing the music player actor to the scene and using structs & tables as a “playlist”.

Everything replicates properly.

Thanks!

Just FYI, the setup will work with the media player. You just need multiple PC’s to test.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.