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
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.
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).
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.
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…
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.
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”.