using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using Cpp2IlInjected;
using MEC;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Video;

// Token: 0x020002BC RID: 700
[Token(Token = "0x20002BC")]
[RequireComponent(typeof(RawImage))]
public class UIVideoPlayer : MonoBehaviour
{
	// Token: 0x17000109 RID: 265
	// (get) Token: 0x06001A63 RID: 6755 RVA: 0x00040CCC File Offset: 0x0003EECC
	// (set) Token: 0x06001A64 RID: 6756 RVA: 0x00040CE0 File Offset: 0x0003EEE0
	[Token(Token = "0x17000109")]
	public bool HasEnd
	{
		[Token(Token = "0x6001A63")]
		[Address(RVA = "0xCC86F0", Offset = "0xCC76F0", VA = "0x180CC86F0")]
		get;
		[Token(Token = "0x6001A64")]
		[Address(RVA = "0xC92660", Offset = "0xC91660", VA = "0x180C92660")]
		private set;
	}

	// Token: 0x1700010A RID: 266
	// (get) Token: 0x06001A65 RID: 6757 RVA: 0x00040CF4 File Offset: 0x0003EEF4
	[Token(Token = "0x1700010A")]
	public bool IsPlaying
	{
		[Token(Token = "0x6001A65")]
		[Address(RVA = "0xCC8700", Offset = "0xCC7700", VA = "0x180CC8700")]
		get
		{
			VideoPlayer videoPlayer = this.videoPlayer;
			int num = 0;
			bool flag = videoPlayer != num;
			if (!flag)
			{
				return flag;
			}
			return this.videoPlayer.isPlaying;
		}
	}

	// Token: 0x1700010B RID: 267
	// (get) Token: 0x06001A66 RID: 6758 RVA: 0x00040D2C File Offset: 0x0003EF2C
	// (set) Token: 0x06001A67 RID: 6759 RVA: 0x00040D40 File Offset: 0x0003EF40
	[Token(Token = "0x1700010B")]
	public bool IsPaused
	{
		[Token(Token = "0x6001A66")]
		[Address(RVA = "0xC92070", Offset = "0xC91070", VA = "0x180C92070")]
		get;
		[Token(Token = "0x6001A67")]
		[Address(RVA = "0xC92410", Offset = "0xC91410", VA = "0x180C92410")]
		private set;
	}

	// Token: 0x1700010C RID: 268
	// (get) Token: 0x06001A68 RID: 6760 RVA: 0x00040D54 File Offset: 0x0003EF54
	// (set) Token: 0x06001A69 RID: 6761 RVA: 0x00040D68 File Offset: 0x0003EF68
	[Token(Token = "0x1700010C")]
	public bool IsSeeking
	{
		[Token(Token = "0x6001A68")]
		[Address(RVA = "0xCC8790", Offset = "0xCC7790", VA = "0x180CC8790")]
		get;
		[Token(Token = "0x6001A69")]
		[Address(RVA = "0xCC88F0", Offset = "0xCC78F0", VA = "0x180CC88F0")]
		private set;
	}

	// Token: 0x1700010D RID: 269
	// (get) Token: 0x06001A6A RID: 6762 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x1700010D")]
	public double Length
	{
		[Token(Token = "0x6001A6A")]
		[Address(RVA = "0xCC87A0", Offset = "0xCC77A0", VA = "0x180CC87A0")]
		get
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}
	}

	// Token: 0x1700010E RID: 270
	// (get) Token: 0x06001A6B RID: 6763 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x1700010E")]
	public float Time
	{
		[Token(Token = "0x6001A6B")]
		[Address(RVA = "0xCC8850", Offset = "0xCC7850", VA = "0x180CC8850")]
		get
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}
	}

	// Token: 0x06001A6C RID: 6764 RVA: 0x00040D7C File Offset: 0x0003EF7C
	[Token(Token = "0x6001A6C")]
	[Address(RVA = "0xCC7EC0", Offset = "0xCC6EC0", VA = "0x180CC7EC0")]
	public void InitVideoPlayer([Optional] VideoPlayer videoTargetPlayer, [Optional] AudioSource audioTargetPlayer)
	{
		if (!this.isInitialized)
		{
			RawImage component = base.GetComponent<RawImage>();
			this.rawImage = component;
			Texture texture = this.rawImage.m_Texture;
			this.mask = texture;
			int num = 0;
			if (!(videoTargetPlayer != num))
			{
				VideoPlayer videoPlayer = base.gameObject.AddComponent<VideoPlayer>();
			}
			this.videoPlayer = videoTargetPlayer;
			int num2 = 0;
			AudioSource audioSource;
			if (!(audioTargetPlayer != num2))
			{
				audioSource = base.gameObject.AddComponent<AudioSource>();
			}
			this.audioSource = audioSource;
			VideoPlayer videoPlayer2 = this.videoPlayer;
			VideoPlayer.EventHandler eventHandler = delegate(VideoPlayer source)
			{
				UIVideoPlayer.VideoPlayerEventHandler onPlayerSeekCompleted = this.OnPlayerSeekCompleted;
				if (onPlayerSeekCompleted != 0)
				{
					onPlayerSeekCompleted();
				}
				this.<IsSeeking>k__BackingField = false;
			};
			videoPlayer2.seekCompleted += eventHandler;
			VideoPlayer videoPlayer3 = this.videoPlayer;
			int num3 = 0;
			videoPlayer3.playOnAwake = num3 != 0;
			AudioSource audioSource2 = this.audioSource;
			int num4 = 0;
			audioSource2.playOnAwake = num4 != 0;
			this.audioSource.Pause();
			this.audioSource.volume = 0.7f;
			VideoPlayer videoPlayer4 = this.videoPlayer;
			VideoPlayer.EventHandler eventHandler2 = new VideoPlayer.EventHandler(this.ReachedVideoEnd);
			videoPlayer4.loopPointReached += eventHandler2;
			this.isInitialized = true;
		}
	}

	// Token: 0x06001A6D RID: 6765 RVA: 0x00040E88 File Offset: 0x0003F088
	[Token(Token = "0x6001A6D")]
	[Address(RVA = "0xCC8350", Offset = "0xCC7350", VA = "0x180CC8350")]
	private void ReachedVideoEnd(VideoPlayer source)
	{
		this.<HasEnd>k__BackingField = true;
	}

	// Token: 0x06001A6E RID: 6766 RVA: 0x00040E9C File Offset: 0x0003F09C
	[Token(Token = "0x6001A6E")]
	[Address(RVA = "0xCC8360", Offset = "0xCC7360", VA = "0x180CC8360")]
	public void ResetVideoData()
	{
		RawImage rawImage = this.rawImage;
		this.<IsPaused>k__BackingField = false;
		Texture texture = this.mask;
		rawImage.texture = texture;
		string empty = string.Empty;
		this.videoClipName = empty;
		throw new NullReferenceException();
	}

	// Token: 0x06001A6F RID: 6767 RVA: 0x00040ED8 File Offset: 0x0003F0D8
	[Token(Token = "0x6001A6F")]
	[Address(RVA = "0xCC7E30", Offset = "0xCC6E30", VA = "0x180CC7E30")]
	public void Dispose()
	{
		this.OnPlayerStarted = (ulong)0L;
		RawImage rawImage = this.rawImage;
		this.<IsPaused>k__BackingField = false;
		Texture texture = this.mask;
		rawImage.texture = texture;
		string empty = string.Empty;
		this.videoClipName = empty;
		throw new NullReferenceException();
	}

	// Token: 0x06001A70 RID: 6768 RVA: 0x00040F1C File Offset: 0x0003F11C
	[Token(Token = "0x6001A70")]
	[Address(RVA = "0x475600", Offset = "0x474600", VA = "0x180475600")]
	public void UpdateVideoClipName(string clipName)
	{
		/*
An exception occurred when decompiling this method (06001A70)

ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void UIVideoPlayer::UpdateVideoClipName(System.String)

 ---> System.Exception: Basic block has to end with unconditional control flow. 
{; 	Block_0:; 	stfld:string(UIVideoPlayer::videoClipName, ldloc:UIVideoPlayer(this), ldloc:string(clipName)); }; 
   at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1810
   at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.Optimize(DecompilerContext context, ILBlock method, AutoPropertyProvider autoPropertyProvider, StateMachineKind& stateMachineKind, MethodDef& inlinedMethod, AsyncMethodDebugInfo& asyncInfo, ILAstOptimizationStep abortBeforeStep) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 344
   at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 123
   at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88
   --- End of inner exception stack trace ---
   at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92
   at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1618
*/;
	}

	// Token: 0x06001A71 RID: 6769 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x6001A71")]
	[Address(RVA = "0xCC8220", Offset = "0xCC7220", VA = "0x180CC8220")]
	public void Play()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x06001A72 RID: 6770 RVA: 0x00040F30 File Offset: 0x0003F130
	[Token(Token = "0x6001A72")]
	[Address(RVA = "0xCC8200", Offset = "0xCC7200", VA = "0x180CC8200")]
	public void PlayFromBeginning()
	{
		this.Stop();
		this.Play();
	}

	// Token: 0x06001A73 RID: 6771 RVA: 0x00040F4C File Offset: 0x0003F14C
	[Token(Token = "0x6001A73")]
	[Address(RVA = "0xCC81C0", Offset = "0xCC71C0", VA = "0x180CC81C0")]
	public void Pause()
	{
		if (!this.<IsPaused>k__BackingField)
		{
			this.videoPlayer.Pause();
			this.audioSource.Pause();
			this.<IsPaused>k__BackingField = true;
		}
	}

	// Token: 0x06001A74 RID: 6772 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x6001A74")]
	[Address(RVA = "0xCC83D0", Offset = "0xCC73D0", VA = "0x180CC83D0")]
	public void Resume()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x06001A75 RID: 6773 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x6001A75")]
	[Address(RVA = "0xCC84A0", Offset = "0xCC74A0", VA = "0x180CC84A0")]
	public void Stop()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x06001A76 RID: 6774 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x6001A76")]
	[Address(RVA = "0xCC8530", Offset = "0xCC7530", VA = "0x180CC8530")]
	public bool TryJumpTo(int seconds, out double targetTime)
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x06001A77 RID: 6775 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x6001A77")]
	[Address(RVA = "0xCC8150", Offset = "0xCC7150", VA = "0x180CC8150")]
	private IEnumerator<float> InitVideoPlayer()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x06001A78 RID: 6776 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x6001A78")]
	[Address(RVA = "0xCC7DC0", Offset = "0xCC6DC0", VA = "0x180CC7DC0")]
	private IEnumerator<float> CheckVideoPlaying()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x06001A79 RID: 6777 RVA: 0x00040F88 File Offset: 0x0003F188
	[Token(Token = "0x6001A79")]
	[Address(RVA = "0x328C40", Offset = "0x327C40", VA = "0x180328C40")]
	public UIVideoPlayer()
	{
	}

	// Token: 0x040024BB RID: 9403
	[Cpp2IlInjected.FieldOffset(Offset = "0x18")]
	[Token(Token = "0x40024BB")]
	[SerializeField]
	private string videoClipName;

	// Token: 0x040024BC RID: 9404
	[Cpp2IlInjected.FieldOffset(Offset = "0x20")]
	[Token(Token = "0x40024BC")]
	[SerializeField]
	private bool isStreamingMode;

	// Token: 0x040024BD RID: 9405
	[Cpp2IlInjected.FieldOffset(Offset = "0x28")]
	[Token(Token = "0x40024BD")]
	public UIVideoPlayer.VideoPlayerEventHandler OnPlayerStarted;

	// Token: 0x040024BE RID: 9406
	[Cpp2IlInjected.FieldOffset(Offset = "0x30")]
	[Token(Token = "0x40024BE")]
	public UIVideoPlayer.VideoPlayerEventHandler OnPlayerFinished;

	// Token: 0x040024BF RID: 9407
	[Cpp2IlInjected.FieldOffset(Offset = "0x38")]
	[Token(Token = "0x40024BF")]
	public UIVideoPlayer.VideoPlayerEventHandler OnPlayerSeekCompleted;

	// Token: 0x040024C0 RID: 9408
	[Cpp2IlInjected.FieldOffset(Offset = "0x40")]
	[Token(Token = "0x40024C0")]
	private RawImage rawImage;

	// Token: 0x040024C1 RID: 9409
	[Cpp2IlInjected.FieldOffset(Offset = "0x48")]
	[Token(Token = "0x40024C1")]
	private Texture mask;

	// Token: 0x040024C2 RID: 9410
	[Cpp2IlInjected.FieldOffset(Offset = "0x50")]
	[Token(Token = "0x40024C2")]
	private VideoPlayer videoPlayer;

	// Token: 0x040024C3 RID: 9411
	[Cpp2IlInjected.FieldOffset(Offset = "0x58")]
	[Token(Token = "0x40024C3")]
	private AudioSource audioSource;

	// Token: 0x040024C4 RID: 9412
	[Cpp2IlInjected.FieldOffset(Offset = "0x60")]
	[Token(Token = "0x40024C4")]
	private CoroutineHandle videoInitializationProcessor;

	// Token: 0x040024C5 RID: 9413
	[Cpp2IlInjected.FieldOffset(Offset = "0x64")]
	[Token(Token = "0x40024C5")]
	private CoroutineHandle videoPlayingProcessor;

	// Token: 0x040024C6 RID: 9414
	[Cpp2IlInjected.FieldOffset(Offset = "0x68")]
	[Token(Token = "0x40024C6")]
	private bool isInitialized;

	// Token: 0x020002BD RID: 701
	[Token(Token = "0x20002BD")]
	public sealed class VideoPlayerEventHandler : MulticastDelegate
	{
		// Token: 0x06001A7C RID: 6780 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6001A7C")]
		[Address(RVA = "0x4932A0", Offset = "0x4922A0", VA = "0x1804932A0")]
		public VideoPlayerEventHandler(object @object, IntPtr method)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06001A7D RID: 6781 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6001A7D")]
		[Address(RVA = "0x6D7F40", Offset = "0x6D6F40", VA = "0x1806D7F40", Slot = "13")]
		public void Invoke()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06001A7E RID: 6782 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6001A7E")]
		[Address(RVA = "0x6D7F10", Offset = "0x6D6F10", VA = "0x1806D7F10", Slot = "14")]
		public IAsyncResult BeginInvoke(AsyncCallback callback, object @object)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06001A7F RID: 6783 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6001A7F")]
		[Address(RVA = "0x492FC0", Offset = "0x491FC0", VA = "0x180492FC0", Slot = "15")]
		public void EndInvoke(IAsyncResult result)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}
	}
}
