Files
UnrealEngineUWP/Engine/Source/Runtime/MediaAssets/Private/Assets/MediaComponent.cpp
andrew rodham a569c9da74 Updating copyright notices to the new standard
#rb None


#ROBOMERGE-SOURCE: CL 10940872 via CL 10940874
#ROBOMERGE-BOT: (v632-10940481)

[CL 10940879 by andrew rodham in Main branch]
2020-01-10 09:15:30 -05:00

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();
}
}
}