You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#rb None #ROBOMERGE-SOURCE: CL 10940872 via CL 10940874 #ROBOMERGE-BOT: (v632-10940481) [CL 10940879 by andrew rodham in Main branch]
49 lines
972 B
C++
49 lines
972 B
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "MediaComponent.h"
|
|
#include "MediaPlayer.h"
|
|
#include "MediaTexture.h"
|
|
#include "IMediaEventSink.h"
|
|
|
|
UMediaComponent::UMediaComponent(const FObjectInitializer& ObjectInitializer)
|
|
: Super(ObjectInitializer)
|
|
{
|
|
PrimaryComponentTick.bCanEverTick = true;
|
|
bAutoActivate = true;
|
|
|
|
if (!HasAnyFlags(RF_ClassDefaultObject))
|
|
{
|
|
MediaPlayer = NewObject<UMediaPlayer>(this, "MediaPlayer", RF_Transient);
|
|
MediaPlayer->SetLooping(false);
|
|
MediaPlayer->PlayOnOpen = false;
|
|
|
|
MediaTexture = NewObject<UMediaTexture>(this, "MediaTexture", RF_Transient);
|
|
}
|
|
}
|
|
|
|
|
|
UMediaPlayer* UMediaComponent::GetMediaPlayer() const
|
|
{
|
|
return MediaPlayer;
|
|
}
|
|
|
|
|
|
UMediaTexture* UMediaComponent::GetMediaTexture() const
|
|
{
|
|
return MediaTexture;
|
|
}
|
|
|
|
void UMediaComponent::OnRegister()
|
|
{
|
|
Super::OnRegister();
|
|
|
|
if (MediaPlayer)
|
|
{
|
|
if (MediaTexture)
|
|
{
|
|
MediaTexture->SetMediaPlayer(MediaPlayer);
|
|
MediaTexture->UpdateResource();
|
|
}
|
|
}
|
|
}
|