UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
AndroidJavaMediaPlayer.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#if USE_ANDROID_JNI
8#include "RHI.h"
9#include "RHIResources.h"
10
12{
13public:
15
18
19public:
20 int64 GetSize();
21 int64 GetCurrentPosition();
23
24private:
27
29 mutable FCriticalSection CriticalSection;
30};
31
32
33namespace UE::Jni::Nio
34{
35 struct FByteBuffer: Java::Lang::FObject
36 {
37 static constexpr FAnsiStringView ClassName = "java/nio/ByteBuffer";
38 };
39}
40
41namespace UE::Jni
42{
43 struct FMediaPlayer14: Java::Lang::FObject
44 {
45 static constexpr FAnsiStringView ClassName = "com/epicgames/unreal/MediaPlayer14";
46
48
50
51 static constexpr FMember Members[]
52 {
54 };
55
56 static constexpr FNativeMethod NativeMethods[]
57 {
59 };
60 };
61
62 template struct TInitialize<FMediaPlayer14>;
63}
64
65// Wrapper for com/epicgames/unreal/MediaPlayer*.java.
66class FJavaAndroidMediaPlayer : public UE::Jni::TClassObject<UE::Jni::FMediaPlayer14>
67{
68public:
69 struct FAudioTrack
70 {
72 FString MimeType;
73 FString DisplayName;
74 FString Language;
75 FString Name;
77 uint32 SampleRate;
78 };
79
80 struct FCaptionTrack
81 {
83 FString MimeType;
84 FString DisplayName;
85 FString Language;
86 FString Name;
87 };
88
89 struct FVideoTrack
90 {
92 FString MimeType;
93 FString DisplayName;
94 FString Language;
95 FString Name;
97 FIntPoint Dimensions;
98 float FrameRate;
99 };
100
101public:
103 virtual ~FJavaAndroidMediaPlayer();
104 int32 GetDuration();
105 void Reset();
106 void Stop();
107 int32 GetCurrentPosition();
108 bool IsLooping();
109 bool IsPlaying();
110 bool IsPrepared();
111 bool DidComplete();
112 bool SetDataSource(const FString & Url);
114 bool SetDataSource(const FString& MoviePathOnDevice, int64 offset, int64 size);
115 bool SetDataSource(jobject AssetMgr, const FString& AssetPath, int64 offset, int64 size);
116 bool Prepare();
117 bool PrepareAsync();
119 void SetLooping(bool Looping);
120 void Release();
123 void SetVideoEnabled(bool enabled = true);
124 void SetAudioEnabled(bool enabled = true);
125 void SetAudioVolume(float Volume);
129 void Start();
130 void Pause();
132 bool SelectTrack(int32 index);
136 bool DidResolutionChange();
138 bool UpdateVideoFrame(int32 ExternalTextureId, int32 *CurrentPosition, bool *bRegionChanged);
139
140private:
141 static FName GetClassName();
142
144
178 // new way of getting video frame data
181
182 // FrameUpdateInfo member field ids
191
192 // AudioDeviceInfo member field ids
200
201 // AudioDeviceInfo member field ids
207
208 // AudioDeviceInfo member field ids
218
221
222 float UScale, UOffset;
223 float VScale, VOffset;
224
227
229 {
230 Unknown,
231 Legacy,
233 };
234
235 BitmapRendererSelection BRSelection; // BR - BitmapRenderer
237
239
240public:
242 {
243 return VideoTexture;
244 }
245
247 {
249 }
250
251 void SetVideoTextureValid(bool Condition)
252 {
253 bVideoTextureValid = Condition;
254 }
255
257 {
258 return bVideoTextureValid;
259 }
260
261 float GetUScale() { return UScale; }
262 float GetUOffset() { return UOffset; }
263
264 float GetVScale() { return VScale; }
265 float GetVOffset() { return VOffset; }
266
267protected:
270
271public:
274};
275
276#endif
int Volume
Definition AndroidPlatformMisc.cpp:380
FPlatformTypes::int64 int64
A 64-bit signed integer.
Definition Platform.h:1127
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
UE::FPlatformRecursiveMutex FCriticalSection
Definition CriticalSection.h:53
T * New(FMemStackBase &Mem, int32 Count=1, int32 Align=DEFAULT_ALIGNMENT)
Definition MemStack.h:259
@ Stop
Definition PrecomputedVolumetricLightmapStreaming.cpp:26
@ Milliseconds
uint32 Offset
Definition VulkanMemory.cpp:4033
uint8_t uint8
Definition binka_ue_file_header.h:8
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition NameTypes.h:617
Definition Array.h:670
Definition UnrealString.h.inl:34
Definition SharedPointer.h:692
Definition SharedPointer.h:153
@ ReadAt
Definition NetworkMessage.h:49
@ Start
Definition GeoEnum.h:100
FValue::Member FMember
Definition RapidJsonUtils.h:62
const FName Channels("Channels")
Definition NetworkMetricsDefs.h:64
@ DisplayName
[ClassMetadata] [PropertyMetadata] [FunctionMetadata] The name to display for this class,...
Definition ObjectMacros.h:1240
U16 Index
Definition radfft.cpp:71
Definition IntPoint.h:25