Download

Networking a Media Player?

Hello, good afternoon.

Is it possible to replicate this tutorial for multiplayer?I have been trying with a server function, but so far the closest result I got is that when the client press P(play the media) it will play on the listen server client only.

Any help would be appreciated.

thanks

As long as the media is accessible to both players, it should be straight forward.
I guess your media is only accessible to one of the machines?
If so, you’d need to find a way to share the files or use a webserver to access and playback the media.

I put the videos in the content/movies folder. Is not that the workflow?

Thanks.

Sorry, I didn’t go through the exact tutorial that you’ve linked.
If you include the media files in the project it should work, yes.
Can you show us what you’ve done so far and what exactly doesn’t work?

Sure:

In my thirdPersonCharacter .h I have this:

UPROPERTY(EditAnywhere, BlueprintReadWrite, replicated)
class UMediaPlayer* charVideoMediaPlayer;

UPROPERTY(EditAnywhere, BlueprintReadWrite, replicated)
class UMediaSource* videoSource;

UFUNCTION(Server, Reliable)
void Server_PlayeMovie();

void Server_PlayeMovie_Implementation();

in the .cpp file for the same character:

void AVentriBudsCharacter::Server_PlayeMovie_Implementation()
{
if (GetLocalRole() == ROLE_Authority)
{

  if (charVideoMediaPlayer)
  {
  	if (videoSource)
  	{
  		charVideoMediaPlayer->OpenSource(videoSource);
  		charVideoMediaPlayer->Play();
  	}
  	
  }

}
if (IsLocallyControlled())
{
if (videoSource)
{
charVideoMediaPlayer->OpenSource(videoSource);
charVideoMediaPlayer->Play();
}

}
}

and in the input setup, I have this:

PlayerInputComponent->BindAction(“PlayMovie”, IE_Released, this,&AVentriBudsCharacter::Server_PlayeMovie);

Which then I connected to the P letter in my project settings.

EDIT:

I have this in the constructor of the thirdPersonCharacter:

charVideoMediaPlayer = CreateDefaultSubobject(“videoPlayer”);

Thanks

Sorry, I should add this:

I have this material:

assigned to this actor, which is external from the character I control:
image

Thanks again