-
Notifications
You must be signed in to change notification settings - Fork 2.5k
/
VideoPlayer.bindings.cs
379 lines (290 loc) · 10.9 KB
/
VideoPlayer.bindings.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
// Unity C# reference source
// Copyright (c) Unity Technologies. For terms of use, see
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License
using System;
using UnityEngine.Bindings;
using UnityEngine.Scripting;
namespace UnityEngine.Video
{
[RequiredByNativeCode]
public enum VideoRenderMode
{
CameraFarPlane = 0,
CameraNearPlane = 1,
RenderTexture = 2,
MaterialOverride = 3,
APIOnly = 4
}
[RequiredByNativeCode]
public enum Video3DLayout
{
No3D = 0,
SideBySide3D = 1,
OverUnder3D = 2
}
[RequiredByNativeCode]
public enum VideoAspectRatio
{
NoScaling = 0,
FitVertically = 1,
FitHorizontally = 2,
FitInside = 3,
FitOutside = 4,
Stretch = 5
}
[RequiredByNativeCode]
[System.Obsolete("VideoTimeSource is deprecated. Use TimeUpdateMode instead. (UnityUpgradable) -> VideoTimeUpdateMode")]
public enum VideoTimeSource
{
[System.Obsolete("AudioDSPTimeSource is deprecated. Use DSPTime instead. (UnityUpgradable) -> DSPTime")]
AudioDSPTimeSource = 0,
[System.Obsolete("GameTimeSource is deprecated. Use GameTime instead. (UnityUpgradable) -> GameTime")]
GameTimeSource = 1
}
[RequiredByNativeCode]
public enum VideoTimeReference
{
Freerun = 0,
InternalTime = 1,
ExternalTime = 2
}
[RequiredByNativeCode]
public enum VideoSource
{
VideoClip = 0,
Url = 1
}
[RequiredByNativeCode]
public enum VideoTimeUpdateMode
{
DSPTime = 0,
GameTime = 1,
UnscaledGameTime = 2
}
[RequiredByNativeCode]
public enum VideoAudioOutputMode
{
None = 0,
AudioSource = 1,
Direct = 2,
APIOnly = 3
}
[RequiredByNativeCode]
[RequireComponent(typeof(Transform))]
[NativeHeader("Modules/Video/Public/VideoPlayer.h")]
public sealed class VideoPlayer : Behaviour
{
public extern VideoSource source { get; set; }
public extern VideoTimeUpdateMode timeUpdateMode { get; set; }
[NativeName("VideoUrl")]
public extern string url { get; set; }
[NativeName("VideoClip")]
public extern VideoClip clip { get; set; }
public extern VideoRenderMode renderMode { get; set; }
public extern bool canSetTimeUpdateMode
{
[NativeName("CanSetTimeUpdateMode")]
get;
}
[NativeHeader("Runtime/Camera/Camera.h")]
public extern Camera targetCamera { get; set; }
[NativeHeader("Runtime/Graphics/RenderTexture.h")]
public extern RenderTexture targetTexture { get; set; }
[NativeHeader("Runtime/Graphics/Renderer.h")]
public extern Renderer targetMaterialRenderer { get; set; }
public extern string targetMaterialProperty { get; set; }
internal extern string effectiveTargetMaterialProperty { get; }
public extern VideoAspectRatio aspectRatio { get; set; }
public extern float targetCameraAlpha { get; set; }
public extern Video3DLayout targetCamera3DLayout { get; set; }
[NativeHeader("Runtime/Graphics/Texture.h")]
public extern Texture texture { get; }
public extern void Prepare();
public extern bool isPrepared
{
[NativeName("IsPrepared")]
get;
}
public extern bool waitForFirstFrame { get; set; }
public extern bool playOnAwake { get; set; }
public extern void Play();
public extern void Pause();
public extern void Stop();
public extern bool isPlaying
{
[NativeName("IsPlaying")]
get;
}
public extern bool isPaused
{
[NativeName("IsPaused")]
get;
}
public extern bool canSetTime
{
[NativeName("CanSetTime")]
get;
}
[NativeName("SecPosition")]
public extern double time { get; set; }
[NativeName("FramePosition")]
public extern long frame { get; set; }
public extern double clockTime { get; }
public extern bool canStep
{
[NativeName("CanStep")]
get;
}
public extern void StepForward();
public extern bool canSetPlaybackSpeed
{
[NativeName("CanSetPlaybackSpeed")]
get;
}
public extern float playbackSpeed { get; set; }
[NativeName("Loop")]
public extern bool isLooping { get; set; }
[System.Obsolete("VideoPlayer.canSetTimeSource is deprecated. Use canSetTimeUpdateMode instead. (UnityUpgradable) -> canSetTimeUpdateMode")]
public extern bool canSetTimeSource
{
[NativeName("CanSetTimeSource")]
get;
}
[System.Obsolete("VideoPlayer.timeSource is deprecated. Use timeUpdateMode instead. (UnityUpgradable) -> timeUpdateMode")]
public extern VideoTimeSource timeSource { get; set; }
public extern VideoTimeReference timeReference { get; set; }
public extern double externalReferenceTime { get; set; }
public extern bool canSetSkipOnDrop
{
[NativeName("CanSetSkipOnDrop")]
get;
}
public extern bool skipOnDrop { get; set; }
public extern ulong frameCount { get; }
public extern float frameRate { get; }
[NativeName("Duration")]
public extern double length
{
get;
}
public extern uint width { get; }
public extern uint height { get; }
public extern uint pixelAspectRatioNumerator { get; }
public extern uint pixelAspectRatioDenominator { get; }
public extern ushort audioTrackCount { get; }
public extern string GetAudioLanguageCode(ushort trackIndex);
public extern ushort GetAudioChannelCount(ushort trackIndex);
public extern uint GetAudioSampleRate(ushort trackIndex);
public static extern ushort controlledAudioTrackMaxCount { get; }
public ushort controlledAudioTrackCount
{
get
{
return GetControlledAudioTrackCount();
}
set
{
int maxNumTracks = controlledAudioTrackMaxCount;
if (value > maxNumTracks)
throw new ArgumentException(string.Format("Cannot control more than {0} tracks.", maxNumTracks), "value");
SetControlledAudioTrackCount(value);
}
}
private extern ushort GetControlledAudioTrackCount();
private extern void SetControlledAudioTrackCount(ushort value);
public extern void EnableAudioTrack(ushort trackIndex, bool enabled);
public extern bool IsAudioTrackEnabled(ushort trackIndex);
public extern VideoAudioOutputMode audioOutputMode { get; set; }
public extern bool canSetDirectAudioVolume
{
[NativeName("CanSetDirectAudioVolume")]
get;
}
public extern float GetDirectAudioVolume(ushort trackIndex);
public extern void SetDirectAudioVolume(ushort trackIndex, float volume);
public extern bool GetDirectAudioMute(ushort trackIndex);
public extern void SetDirectAudioMute(ushort trackIndex, bool mute);
[NativeHeader("Modules/Audio/Public/AudioSource.h")]
public extern AudioSource GetTargetAudioSource(ushort trackIndex);
public extern void SetTargetAudioSource(ushort trackIndex, AudioSource source);
public delegate void EventHandler(VideoPlayer source);
public delegate void ErrorEventHandler(VideoPlayer source, string message);
public delegate void FrameReadyEventHandler(VideoPlayer source, long frameIdx);
public delegate void TimeEventHandler(VideoPlayer source, double seconds);
public event EventHandler prepareCompleted;
public event EventHandler loopPointReached;
public event EventHandler started;
public event EventHandler frameDropped;
public event ErrorEventHandler errorReceived;
public event EventHandler seekCompleted;
public event TimeEventHandler clockResyncOccurred;
public extern bool sendFrameReadyEvents
{
[NativeName("AreFrameReadyEventsEnabled")]
get;
[NativeName("EnableFrameReadyEvents")]
set;
}
public event FrameReadyEventHandler frameReady;
[RequiredByNativeCode]
private static void InvokePrepareCompletedCallback_Internal(VideoPlayer source)
{
if (source.prepareCompleted != null)
source.prepareCompleted(source);
}
[RequiredByNativeCode]
private static void InvokeFrameReadyCallback_Internal(VideoPlayer source, long frameIdx)
{
if (source.frameReady != null)
source.frameReady(source, frameIdx);
}
[RequiredByNativeCode]
private static void InvokeLoopPointReachedCallback_Internal(VideoPlayer source)
{
if (source.loopPointReached != null)
source.loopPointReached(source);
}
[RequiredByNativeCode]
private static void InvokeStartedCallback_Internal(VideoPlayer source)
{
if (source.started != null)
source.started(source);
}
[RequiredByNativeCode]
private static void InvokeFrameDroppedCallback_Internal(VideoPlayer source)
{
if (source.frameDropped != null)
source.frameDropped(source);
}
[RequiredByNativeCode]
private static void InvokeErrorReceivedCallback_Internal(VideoPlayer source, string errorStr)
{
if (source.errorReceived != null)
source.errorReceived(source, errorStr);
}
[RequiredByNativeCode]
private static void InvokeSeekCompletedCallback_Internal(VideoPlayer source)
{
if (source.seekCompleted != null)
source.seekCompleted(source);
}
[RequiredByNativeCode]
private static void InvokeClockResyncOccurredCallback_Internal(VideoPlayer source, double seconds)
{
if (source.clockResyncOccurred != null)
source.clockResyncOccurred(source, seconds);
}
internal static event Action<string> analyticsSent;
[RequiredByNativeCode]
private static void InvokeAnalyticsSentCallback_Internal(string analytics)
{
if (analyticsSent != null)
analyticsSent(analytics);
}
[RequiredByNativeCode]
private static bool AnalyticsEventHandlerAttached_Internal()
{
return analyticsSent != null;
}
}
}