Untitled

mail@pastecode.io avatar
unknown
c_cpp
a year ago
1.1 kB
5
Indexable
Never
// All Rights Reserved

#pragma once

#include "CoreMinimal.h"
#include "Components/ActorComponent.h"

#include "MediaPlayerComponent.generated.h"

class UMediaSoundComponent;
class UMediaPlayer;

UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
class VSIDE_API UMediaPlayerComponent : public UActorComponent
{
	GENERATED_BODY()

	UMediaPlayerComponent();
	
	UFUNCTION()
	void OnStreamOpened(FString OpenedUrl);

	UFUNCTION()
	void OnStreamOpenFailed(FString FailedUrl);

	UFUNCTION()
	void OnStreamClosed();

	UFUNCTION()
	void OnStreamPaused();

	UFUNCTION()
	void OnStreamResumed();

protected:
	UPROPERTY(BlueprintReadOnly, EditInstanceOnly)
	TObjectPtr<UMediaSoundComponent> MediaSoundComponent;

	UPROPERTY(BlueprintReadOnly, EditInstanceOnly)
	TObjectPtr<UMediaPlayer> MediaPlayer;

public:
	UFUNCTION(BlueprintCallable)
	void FadeIn();

	UFUNCTION(BlueprintCallable)
	void FadeOut();

	UFUNCTION(BlueprintCallable)
	void PlayURL(const FString& URL);
	
	UFUNCTION(BlueprintCallable)
	void Stop();
};