commit 47a5cff08b0ff2ce107478996b9eeb8b2834aa7d Author: BobSong <605277374@qq.com> Date: Mon Feb 9 20:10:14 2026 +0800 first commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6d310a7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,21 @@ +/Library +/Logs +/obj +/Build +/Temp +/.vs +/copydll.bat +/Debug +/.idea/ +/update_unity_libil2cpp.bat +/*.csproj +/*.sln +/UserSettings/Layouts +/Release +/Assembly-CSharp-Editor.csproj.user +/Assets/StreamingAssets +/Assets/ResRaw/Effect/Z_Test +/Assets/ResRaw/Effect/Z_Test.meta +/Bundles/ +Assets/Scripts/sync.ffs_db +Assets/Scripts/sync.ffs_db.meta diff --git a/Assets/AVProVideo.meta b/Assets/AVProVideo.meta new file mode 100644 index 0000000..dfe81c2 --- /dev/null +++ b/Assets/AVProVideo.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 60c6325e06cf6b645a1f3786c592b971 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AVProVideo/Demos.meta b/Assets/AVProVideo/Demos.meta new file mode 100644 index 0000000..04f6029 --- /dev/null +++ b/Assets/AVProVideo/Demos.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: ac9801f71509e0a4c949a03ae8940ecf +folderAsset: yes +timeCreated: 1438729080 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AVProVideo/Demos/Common.meta b/Assets/AVProVideo/Demos/Common.meta new file mode 100644 index 0000000..3e8c61f --- /dev/null +++ b/Assets/AVProVideo/Demos/Common.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 50a3b8d1bf24f2943bd18205a6ad0cce +folderAsset: yes +timeCreated: 1609504095 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AVProVideo/Demos/Common/Demo-360.mat b/Assets/AVProVideo/Demos/Common/Demo-360.mat new file mode 100644 index 0000000..206ab72 --- /dev/null +++ b/Assets/AVProVideo/Demos/Common/Demo-360.mat @@ -0,0 +1,107 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Demo-360 + m_Shader: {fileID: 4800000, guid: 46b84ca7ab6291e4fb6c57ac48d01e8f, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: + - FORCEEYE_NONE + - MONOSCOPIC + m_InvalidKeywords: + - LAYOUT_NONE + - STEREO_NONE + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ChromaTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ChromaTex_R: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: -1} + m_Offset: {x: 0, y: 1} + - _MainTex_R: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - ForceEye: 0 + - Layout: 0 + - Stereo: 0 + - _ApplyGamma: 0 + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _HighQuality: 0 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _StereoDebug: 0 + - _UVSec: 0 + - _UseYpCbCr: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _CroppingScalars: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + m_BuildTextureStacks: [] diff --git a/Assets/AVProVideo/Demos/Common/Demo-360.mat.meta b/Assets/AVProVideo/Demos/Common/Demo-360.mat.meta new file mode 100644 index 0000000..6fcee8e --- /dev/null +++ b/Assets/AVProVideo/Demos/Common/Demo-360.mat.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: db39bb6249db0924bb87d6e0bb294ed3 +timeCreated: 1609503593 +licenseType: Store +NativeFormatImporter: + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AVProVideo/Demos/Common/Demo-Cube.mat b/Assets/AVProVideo/Demos/Common/Demo-Cube.mat new file mode 100644 index 0000000..26e7cc2 --- /dev/null +++ b/Assets/AVProVideo/Demos/Common/Demo-Cube.mat @@ -0,0 +1,99 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Demo-Cube + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: + - _GLOSSYREFLECTIONS_OFF + - _SPECULARHIGHLIGHTS_OFF + m_InvalidKeywords: + - APPLY_GAMMA + - MONOSCOPIC + - STEREO_NONE + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ChromaTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: -1} + m_Offset: {x: 0, y: 1} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - Stereo: 0 + - _ApplyGamma: 0 + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _Exposure: 1 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 0 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _Rotation: 0 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 0 + - _SrcBlend: 1 + - _StereoDebug: 0 + - _UVSec: 0 + - _UseYpCbCr: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _Tint: {r: 0.5, g: 0.5, b: 0.5, a: 0.5} + m_BuildTextureStacks: [] diff --git a/Assets/AVProVideo/Demos/Common/Demo-Cube.mat.meta b/Assets/AVProVideo/Demos/Common/Demo-Cube.mat.meta new file mode 100644 index 0000000..5ba3d70 --- /dev/null +++ b/Assets/AVProVideo/Demos/Common/Demo-Cube.mat.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 3c2c8026b487d4d4a84e01da83637ceb +timeCreated: 1609505219 +licenseType: Store +NativeFormatImporter: + mainObjectFileID: -1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AVProVideo/Demos/Common/Demo-Skybox.mat b/Assets/AVProVideo/Demos/Common/Demo-Skybox.mat new file mode 100644 index 0000000..6ac63e0 --- /dev/null +++ b/Assets/AVProVideo/Demos/Common/Demo-Skybox.mat @@ -0,0 +1,99 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Demo-Skybox + m_Shader: {fileID: 4800000, guid: d7bb9d4ea887e4041877356986247bba, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: + - APPLY_GAMMA + - MONOSCOPIC + m_InvalidKeywords: + - LAYOUT_NONE + - STEREO_NONE + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ChromaTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - Layout: 0 + - Stereo: 0 + - _ApplyGamma: 0 + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _Exposure: 1 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _Rotation: 0 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _StereoDebug: 0 + - _UVSec: 0 + - _UseYpCbCr: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _Tint: {r: 0.5, g: 0.5, b: 0.5, a: 0.5} + m_BuildTextureStacks: [] diff --git a/Assets/AVProVideo/Demos/Common/Demo-Skybox.mat.meta b/Assets/AVProVideo/Demos/Common/Demo-Skybox.mat.meta new file mode 100644 index 0000000..06186ba --- /dev/null +++ b/Assets/AVProVideo/Demos/Common/Demo-Skybox.mat.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 276368b4e7f7f044e8288312f105954e +timeCreated: 1601367715 +licenseType: Store +NativeFormatImporter: + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AVProVideo/Demos/Common/LookAround360.cs b/Assets/AVProVideo/Demos/Common/LookAround360.cs new file mode 100644 index 0000000..a6b4e5d --- /dev/null +++ b/Assets/AVProVideo/Demos/Common/LookAround360.cs @@ -0,0 +1,117 @@ +using UnityEngine; +using System.Collections.Generic; + +//----------------------------------------------------------------------------- +// Copyright 2015-2021 RenderHeads Ltd. All rights reserved. +//----------------------------------------------------------------------------- + +namespace RenderHeads.Media.AVProVideo.Demos +{ + /// + /// Rotate the transform (usually with Camera attached) to look around during playback of 360/180 videos. + /// Unity will rotate the camera automatically if VR is enabled, in which case this script does nothing. + /// Otherwise if there is a gyroscope it will be used, otherwise the mouse/touch can be used. + /// + public class LookAround360 : MonoBehaviour + { + [SerializeField] bool _lockPitch = false; + [SerializeField] float _maxSpinSpeed = 40f; + [SerializeField, Range(1f, 10f)] float _spinDamping = 5f; + + private float _spinX; + private float _spinY; + + private static bool IsVrPresent() + { + bool result = false; + #if UNITY_2019_3_OR_NEWER + var xrDisplaySubsystems = new List(); + #if UNITY_2020_2_OR_NEWER + SubsystemManager.GetSubsystems(xrDisplaySubsystems); + #else + SubsystemManager.GetInstances(xrDisplaySubsystems); + #endif + foreach (var xrDisplay in xrDisplaySubsystems) + { + if (xrDisplay.running) + { + result = true; + break; + } + } + #else + #if UNITY_2018_1_OR_NEWER + result = (UnityEngine.XR.XRDevice.isPresent); + #else + result = (UnityEngine.VR.VRDevice.isPresent); + #endif + #endif + return result; + } + + void Start() + { + if (IsVrPresent()) + { + this.enabled = false; + return; + } + + if (SystemInfo.supportsGyroscope) + { + Input.gyro.enabled = true; + } + } + + void Update() + { + if (SystemInfo.supportsGyroscope && Input.gyro.enabled) + { + RotateFromGyro(); + } + else + { + RotateFromMouseOrTouch(); + } + } + + void OnDestroy() + { + if (SystemInfo.supportsGyroscope) + { + Input.gyro.enabled = false; + } + } + + void RotateFromGyro() + { + // Invert the z and w of the gyro attitude + this.transform.localRotation = new Quaternion(Input.gyro.attitude.x, Input.gyro.attitude.y, -Input.gyro.attitude.z, -Input.gyro.attitude.w); + } + + void RotateFromMouseOrTouch() + { + if (Input.GetMouseButton(0)) + { + float h = _maxSpinSpeed * -Input.GetAxis("Mouse X") * Time.deltaTime; + float v = 0f; + if (!_lockPitch) + { + v = _maxSpinSpeed * Input.GetAxis("Mouse Y") * Time.deltaTime; + } + h = Mathf.Clamp(h, -0.5f, 0.5f); + v = Mathf.Clamp(v, -0.5f, 0.5f); + _spinX += h; + _spinY += v; + } + if (!Mathf.Approximately(_spinX, 0f) || !Mathf.Approximately(_spinY, 0f)) + { + this.transform.Rotate(Vector3.up, _spinX); + this.transform.Rotate(Vector3.right, _spinY); + + _spinX = Mathf.MoveTowards(_spinX, 0f, _spinDamping * Time.deltaTime); + _spinY = Mathf.MoveTowards(_spinY, 0f, _spinDamping * Time.deltaTime); + } + } + } +} \ No newline at end of file diff --git a/Assets/AVProVideo/Demos/Common/LookAround360.cs.meta b/Assets/AVProVideo/Demos/Common/LookAround360.cs.meta new file mode 100644 index 0000000..4b20340 --- /dev/null +++ b/Assets/AVProVideo/Demos/Common/LookAround360.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 0e87d2abb8af1da4aa3e1949ee6d680d +timeCreated: 1609504095 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AVProVideo/Demos/Common/MediaPlayerUI.meta b/Assets/AVProVideo/Demos/Common/MediaPlayerUI.meta new file mode 100644 index 0000000..fceb7ff --- /dev/null +++ b/Assets/AVProVideo/Demos/Common/MediaPlayerUI.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 402779202fe06894099308e5b767c9c4 +folderAsset: yes +timeCreated: 1546680669 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AVProVideo/Demos/Common/MediaPlayerUI/AudioTrackLine.prefab b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/AudioTrackLine.prefab new file mode 100644 index 0000000..44be2bd --- /dev/null +++ b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/AudioTrackLine.prefab @@ -0,0 +1,365 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &182445281595923392 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 182445281595923399} + - component: {fileID: 182445281595923402} + - component: {fileID: 182445281595923403} + - component: {fileID: 182445281595923396} + - component: {fileID: 182445281595923397} + - component: {fileID: 182445281595923398} + m_Layer: 5 + m_Name: AudioTrackLine + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &182445281595923399 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 182445281595923392} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 182445281708277157} + - {fileID: 182445281755328645} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 40} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &182445281595923402 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 182445281595923392} + m_CullTransparentMesh: 1 +--- !u!114 &182445281595923403 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 182445281595923392} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 0} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &182445281595923396 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 182445281595923392} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 0 + m_Colors: + m_NormalColor: {r: 0.08088237, g: 0.08088237, b: 0.08088237, a: 0.972549} + m_HighlightedColor: {r: 0.08088237, g: 0.08088237, b: 0.08088237, a: 0.972549} + m_PressedColor: {r: 0.36764705, g: 0.36764705, b: 0.36764705, a: 0.972549} + m_SelectedColor: {r: 0.08088237, g: 0.08088237, b: 0.08088237, a: 0.972549} + m_DisabledColor: {r: 0.08088237, g: 0.08088237, b: 0.08088237, a: 0.972549} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Highlighted + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 182445281595923403} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!114 &182445281595923397 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 182445281595923392} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Padding: + m_Left: 16 + m_Right: 16 + m_Top: 16 + m_Bottom: 16 + m_ChildAlignment: 4 + m_Spacing: 14 + m_ChildForceExpandWidth: 0 + m_ChildForceExpandHeight: 1 + m_ChildControlWidth: 0 + m_ChildControlHeight: 1 + m_ChildScaleWidth: 0 + m_ChildScaleHeight: 0 + m_ReverseArrangement: 0 +--- !u!114 &182445281595923398 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 182445281595923392} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalFit: 2 + m_VerticalFit: 0 +--- !u!1 &182445281708277158 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 182445281708277157} + - component: {fileID: 182445281708277162} + - component: {fileID: 182445281708277163} + - component: {fileID: 182445281708277156} + m_Layer: 5 + m_Name: TickIcon + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &182445281708277157 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 182445281708277158} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 182445281595923399} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 23, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &182445281708277162 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 182445281708277158} + m_CullTransparentMesh: 1 +--- !u!114 &182445281708277163 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 182445281708277158} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreLayout: 0 + m_MinWidth: 23 + m_MinHeight: 23 + m_PreferredWidth: 23 + m_PreferredHeight: 23 + m_FlexibleWidth: -1 + m_FlexibleHeight: -1 + m_LayoutPriority: 1 +--- !u!114 &182445281708277156 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 182445281708277158} + m_Enabled: 0 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: f654eb4cabde0d241abf6194d289baeb, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &182445281755328646 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 182445281755328645} + - component: {fileID: 182445281755328650} + - component: {fileID: 182445281755328651} + - component: {fileID: 182445281755328644} + m_Layer: 5 + m_Name: TitleText + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &182445281755328645 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 182445281755328646} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 182445281595923399} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 260, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &182445281755328650 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 182445281755328646} + m_CullTransparentMesh: 1 +--- !u!114 &182445281755328651 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 182445281755328646} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 0 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 18 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 0 + m_MaxSize: 20 + m_Alignment: 3 + m_AlignByGeometry: 0 + m_RichText: 0 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: +--- !u!114 &182445281755328644 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 182445281755328646} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreLayout: 0 + m_MinWidth: -1 + m_MinHeight: 40 + m_PreferredWidth: 140 + m_PreferredHeight: 22 + m_FlexibleWidth: -1 + m_FlexibleHeight: -1 + m_LayoutPriority: 1 diff --git a/Assets/AVProVideo/Demos/Common/MediaPlayerUI/AudioTrackLine.prefab.meta b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/AudioTrackLine.prefab.meta new file mode 100644 index 0000000..c0a521c --- /dev/null +++ b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/AudioTrackLine.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: a4d6a235b924028458c2acce3d42cdc4 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AVProVideo/Demos/Common/MediaPlayerUI/BackingGradient.png b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/BackingGradient.png new file mode 100644 index 0000000..6456a05 Binary files /dev/null and b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/BackingGradient.png differ diff --git a/Assets/AVProVideo/Demos/Common/MediaPlayerUI/BackingGradient.png.meta b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/BackingGradient.png.meta new file mode 100644 index 0000000..74de2e0 --- /dev/null +++ b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/BackingGradient.png.meta @@ -0,0 +1,128 @@ +fileFormatVersion: 2 +guid: e8fa92438398bb240b71be8b23d90df5 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + applyGammaDecoding: 1 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + - serializedVersion: 3 + buildTarget: iPhone + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + - serializedVersion: 3 + buildTarget: Android + maxTextureSize: 256 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AVProVideo/Demos/Common/MediaPlayerUI/HorizontalSegmentsPrimitive.cs b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/HorizontalSegmentsPrimitive.cs new file mode 100644 index 0000000..08695c3 --- /dev/null +++ b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/HorizontalSegmentsPrimitive.cs @@ -0,0 +1,89 @@ +// UnityEngine.UI was moved to a package in 2019.2.0 +// Unfortunately no way to test for this across all Unity versions yet +// You can set up the asmdef to reference the new package, but the package doesn't +// existing in Unity 2017 etc, and it throws an error due to missing reference +#define AVPRO_PACKAGE_UNITYUI +#if (UNITY_2019_2_OR_NEWER && AVPRO_PACKAGE_UNITYUI) || (!UNITY_2019_2_OR_NEWER) + +using UnityEngine; +using UnityEngine.UI; + +namespace RenderHeads.Media.AVProVideo.Demos.UI +{ + /// Fill a rectangle region with horizontal segments along it + [ExecuteInEditMode] + public class HorizontalSegmentsPrimitive : Graphic + { + private float[] _segments = { 0f, 0f }; + public float[] Segments { get { return _segments; } set { SetSegments(value); } } + + private void SetSegments(float[] segments) + { + if (segments != null && segments.Length > 1) + { + _segments = segments; + } + else + { + _segments = new float[] { 0f, 0f }; + } + + // TODO: detect whether a change actually occured before setting to dirty + SetVerticesDirty(); + } + + protected override void OnPopulateMesh(VertexHelper vh) + { + Vector2 corner1 = Vector2.zero; + Vector2 corner2 = Vector2.zero; + + corner1.x = 0f; + corner1.y = 0f; + corner2.x = 1f; + corner2.y = 1f; + + corner1.x -= rectTransform.pivot.x; + corner1.y -= rectTransform.pivot.y; + corner2.x -= rectTransform.pivot.x; + corner2.y -= rectTransform.pivot.y; + + corner1.x *= rectTransform.rect.width; + corner1.y *= rectTransform.rect.height; + corner2.x *= rectTransform.rect.width; + corner2.y *= rectTransform.rect.height; + + vh.Clear(); + + int numQuads = _segments.Length / 2; + + UIVertex vert = UIVertex.simpleVert; + int vi = 0; + for (int i = 0; i < numQuads; i++) + { + float x1 = _segments[i * 2 + 0] * (corner2.x - corner1.x) + corner1.x; + float x2 = _segments[i * 2 + 1] * (corner2.x - corner1.x) + corner1.x; + + vert.position = new Vector2(x1, corner1.y); + vert.color = color; + vh.AddVert(vert); + + vert.position = new Vector2(x1, corner2.y); + vert.color = color; + vh.AddVert(vert); + + vert.position = new Vector2(x2, corner2.y); + vert.color = color; + vh.AddVert(vert); + + vert.position = new Vector2(x2, corner1.y); + vert.color = color; + vh.AddVert(vert); + + vh.AddTriangle(0 + vi, 1 + vi, 2 + vi); + vh.AddTriangle(2 + vi, 3 + vi, 0 + vi); + vi += 4; + } + } + } +} +#endif \ No newline at end of file diff --git a/Assets/AVProVideo/Demos/Common/MediaPlayerUI/HorizontalSegmentsPrimitive.cs.meta b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/HorizontalSegmentsPrimitive.cs.meta new file mode 100644 index 0000000..5dfbc01 --- /dev/null +++ b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/HorizontalSegmentsPrimitive.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: a922ae46315cc884c879056759d73251 +timeCreated: 1546854091 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-AudioSpectrum.mat b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-AudioSpectrum.mat new file mode 100644 index 0000000..6d83eca --- /dev/null +++ b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-AudioSpectrum.mat @@ -0,0 +1,90 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: MediaPlayerUI-AudioSpectrum + m_Shader: {fileID: 4800000, guid: 8b83f1522b53ad44a9a271e7db8aa527, type: 3} + m_ShaderKeywords: DRAW_OUTLINE UI_SPECTRUM + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - UI: 10 + - _BumpScale: 1 + - _ColorMask: 15 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DrawOutline: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _Morph: 1 + - _Mute: 0 + - _OcclusionStrength: 1 + - _OutlineOpacity: 1 + - _OutlineSize: 0.02 + - _OutlineSoftness: 0.069 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _Stencil: 0 + - _StencilComp: 8 + - _StencilOp: 0 + - _StencilReadMask: 255 + - _StencilWriteMask: 255 + - _UVSec: 0 + - _Volume: 1 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-AudioSpectrum.mat.meta b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-AudioSpectrum.mat.meta new file mode 100644 index 0000000..9f35d39 --- /dev/null +++ b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-AudioSpectrum.mat.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: af11c0475fc59fd46ae3d7101e9cb7ad +timeCreated: 1600732643 +licenseType: Store +NativeFormatImporter: + mainObjectFileID: -1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Buffering.mat b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Buffering.mat new file mode 100644 index 0000000..90ce071 --- /dev/null +++ b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Buffering.mat @@ -0,0 +1,90 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: MediaPlayerUI-Buffering + m_Shader: {fileID: 4800000, guid: 8b83f1522b53ad44a9a271e7db8aa527, type: 3} + m_ShaderKeywords: DRAW_OUTLINE UI_BUFFERING + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - UI: 4 + - _BumpScale: 1 + - _ColorMask: 15 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DrawOutline: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _Morph: 0.276 + - _Mute: 0 + - _OcclusionStrength: 1 + - _OutlineOpacity: 0.5 + - _OutlineSize: 0.0063 + - _OutlineSoftness: 0 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _Stencil: 0 + - _StencilComp: 8 + - _StencilOp: 0 + - _StencilReadMask: 255 + - _StencilWriteMask: 255 + - _UVSec: 0 + - _Volume: 1 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Buffering.mat.meta b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Buffering.mat.meta new file mode 100644 index 0000000..00fc67d --- /dev/null +++ b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Buffering.mat.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 9c36a7d03d5746f4bab781d213a86f49 +timeCreated: 1546682531 +licenseType: Store +NativeFormatImporter: + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-CC.mat b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-CC.mat new file mode 100644 index 0000000..3190ab4 --- /dev/null +++ b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-CC.mat @@ -0,0 +1,90 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: MediaPlayerUI-CC + m_Shader: {fileID: 4800000, guid: 8b83f1522b53ad44a9a271e7db8aa527, type: 3} + m_ShaderKeywords: DRAW_OUTLINE UI_CC + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - UI: 8 + - _BumpScale: 1 + - _ColorMask: 15 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DrawOutline: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _Morph: 1 + - _Mute: 0 + - _OcclusionStrength: 1 + - _OutlineOpacity: 1 + - _OutlineSize: 0.02 + - _OutlineSoftness: 0.069 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _Stencil: 0 + - _StencilComp: 8 + - _StencilOp: 0 + - _StencilReadMask: 255 + - _StencilWriteMask: 255 + - _UVSec: 0 + - _Volume: 1 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-CC.mat.meta b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-CC.mat.meta new file mode 100644 index 0000000..2625177 --- /dev/null +++ b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-CC.mat.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 8e67518da82e8334685a53cd09579095 +timeCreated: 1546682531 +licenseType: Store +NativeFormatImporter: + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Circle.mat b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Circle.mat new file mode 100644 index 0000000..814e938 --- /dev/null +++ b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Circle.mat @@ -0,0 +1,88 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: MediaPlayerUI-Circle + m_Shader: {fileID: 4800000, guid: 8b83f1522b53ad44a9a271e7db8aa527, type: 3} + m_ShaderKeywords: UI_CIRCLE + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - UI: 0 + - _BumpScale: 1 + - _ColorMask: 15 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _Morph: 0 + - _Mute: 0 + - _OcclusionStrength: 1 + - _OutlineOpacity: 0 + - _OutlineSize: 0 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _Stencil: 0 + - _StencilComp: 8 + - _StencilOp: 0 + - _StencilReadMask: 255 + - _StencilWriteMask: 255 + - _UVSec: 0 + - _Volume: 1 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Circle.mat.meta b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Circle.mat.meta new file mode 100644 index 0000000..5a0975d --- /dev/null +++ b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Circle.mat.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 42d01ca03bef81a4db5efcc72b712aca +timeCreated: 1546682531 +licenseType: Store +NativeFormatImporter: + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Feedback.mat b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Feedback.mat new file mode 100644 index 0000000..a8e32e8 --- /dev/null +++ b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Feedback.mat @@ -0,0 +1,90 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: MediaPlayerUI-Feedback + m_Shader: {fileID: 4800000, guid: 8b83f1522b53ad44a9a271e7db8aa527, type: 3} + m_ShaderKeywords: DRAW_OUTLINE UI_PAUSE + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - UI: 2 + - _BumpScale: 1 + - _ColorMask: 15 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DrawOutline: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _Morph: 0 + - _Mute: 0 + - _OcclusionStrength: 1 + - _OutlineOpacity: 0.5 + - _OutlineSize: 0.0063 + - _OutlineSoftness: 0 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _Stencil: 0 + - _StencilComp: 8 + - _StencilOp: 0 + - _StencilReadMask: 255 + - _StencilWriteMask: 255 + - _UVSec: 0 + - _Volume: 1 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Feedback.mat.meta b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Feedback.mat.meta new file mode 100644 index 0000000..2138d7a --- /dev/null +++ b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Feedback.mat.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 1d9b78c72d0d96c4ea3ffb49880bf0c6 +timeCreated: 1546682531 +licenseType: Store +NativeFormatImporter: + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-NavBack.mat b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-NavBack.mat new file mode 100644 index 0000000..414f577 --- /dev/null +++ b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-NavBack.mat @@ -0,0 +1,90 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: MediaPlayerUI-NavBack + m_Shader: {fileID: 4800000, guid: 8b83f1522b53ad44a9a271e7db8aa527, type: 3} + m_ShaderKeywords: DRAW_OUTLINE UI_BACK + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - UI: 7 + - _BumpScale: 1 + - _ColorMask: 15 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DrawOutline: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _Morph: 1 + - _Mute: 0 + - _OcclusionStrength: 1 + - _OutlineOpacity: 1 + - _OutlineSize: 0.02 + - _OutlineSoftness: 0.069 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _Stencil: 0 + - _StencilComp: 8 + - _StencilOp: 0 + - _StencilReadMask: 255 + - _StencilWriteMask: 255 + - _UVSec: 0 + - _Volume: 1 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-NavBack.mat.meta b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-NavBack.mat.meta new file mode 100644 index 0000000..694d89a --- /dev/null +++ b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-NavBack.mat.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 3defb26db59b1fa489c3d83b2dda2210 +timeCreated: 1546682531 +licenseType: Store +NativeFormatImporter: + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-NavForward.mat b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-NavForward.mat new file mode 100644 index 0000000..7dfd421 --- /dev/null +++ b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-NavForward.mat @@ -0,0 +1,90 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: MediaPlayerUI-NavForward + m_Shader: {fileID: 4800000, guid: 8b83f1522b53ad44a9a271e7db8aa527, type: 3} + m_ShaderKeywords: DRAW_OUTLINE UI_FORWARD + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - UI: 6 + - _BumpScale: 1 + - _ColorMask: 15 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DrawOutline: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _Morph: 1 + - _Mute: 0 + - _OcclusionStrength: 1 + - _OutlineOpacity: 1 + - _OutlineSize: 0.02 + - _OutlineSoftness: 0.069 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _Stencil: 0 + - _StencilComp: 8 + - _StencilOp: 0 + - _StencilReadMask: 255 + - _StencilWriteMask: 255 + - _UVSec: 0 + - _Volume: 1 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-NavForward.mat.meta b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-NavForward.mat.meta new file mode 100644 index 0000000..ff5ed1e --- /dev/null +++ b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-NavForward.mat.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: fc3335a6cd5229642a818d162865fe8a +timeCreated: 1546682531 +licenseType: Store +NativeFormatImporter: + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Options.mat b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Options.mat new file mode 100644 index 0000000..194ce73 --- /dev/null +++ b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Options.mat @@ -0,0 +1,90 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: MediaPlayerUI-Options + m_Shader: {fileID: 4800000, guid: 8b83f1522b53ad44a9a271e7db8aa527, type: 3} + m_ShaderKeywords: DRAW_OUTLINE UI_OPTIONS + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - UI: 9 + - _BumpScale: 1 + - _ColorMask: 15 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DrawOutline: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _Morph: 0 + - _Mute: 0 + - _OcclusionStrength: 1 + - _OutlineOpacity: 1 + - _OutlineSize: 0.02 + - _OutlineSoftness: 0.069 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _Stencil: 0 + - _StencilComp: 8 + - _StencilOp: 0 + - _StencilReadMask: 255 + - _StencilWriteMask: 255 + - _UVSec: 0 + - _Volume: 1 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Options.mat.meta b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Options.mat.meta new file mode 100644 index 0000000..40025ed --- /dev/null +++ b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Options.mat.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: dced9abe5e3da3e47bbaa9d7febe796e +timeCreated: 1546682531 +licenseType: Store +NativeFormatImporter: + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-PlayPause.mat b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-PlayPause.mat new file mode 100644 index 0000000..1016d16 --- /dev/null +++ b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-PlayPause.mat @@ -0,0 +1,90 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: MediaPlayerUI-PlayPause + m_Shader: {fileID: 4800000, guid: 8b83f1522b53ad44a9a271e7db8aa527, type: 3} + m_ShaderKeywords: DRAW_OUTLINE UI_PLAYPAUSE + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - UI: 3 + - _BumpScale: 1 + - _ColorMask: 15 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DrawOutline: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _Morph: 0 + - _Mute: 0 + - _OcclusionStrength: 1 + - _OutlineOpacity: 1 + - _OutlineSize: 0.02 + - _OutlineSoftness: 0.069 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _Stencil: 0 + - _StencilComp: 8 + - _StencilOp: 0 + - _StencilReadMask: 255 + - _StencilWriteMask: 255 + - _UVSec: 0 + - _Volume: 1 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-PlayPause.mat.meta b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-PlayPause.mat.meta new file mode 100644 index 0000000..8e0945f --- /dev/null +++ b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-PlayPause.mat.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 82d37723c9304fa4e9f2cd4daf2351ad +timeCreated: 1546682531 +licenseType: Store +NativeFormatImporter: + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Volume.mat b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Volume.mat new file mode 100644 index 0000000..2c68b09 --- /dev/null +++ b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Volume.mat @@ -0,0 +1,90 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: MediaPlayerUI-Volume + m_Shader: {fileID: 4800000, guid: 8b83f1522b53ad44a9a271e7db8aa527, type: 3} + m_ShaderKeywords: DRAW_OUTLINE UI_VOLUME + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - UI: 5 + - _BumpScale: 1 + - _ColorMask: 15 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DrawOutline: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _Morph: 0 + - _Mute: 0 + - _OcclusionStrength: 1 + - _OutlineOpacity: 1 + - _OutlineSize: 0.02 + - _OutlineSoftness: 0.069 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _Stencil: 0 + - _StencilComp: 8 + - _StencilOp: 0 + - _StencilReadMask: 255 + - _StencilWriteMask: 255 + - _UVSec: 0 + - _Volume: 1 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Volume.mat.meta b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Volume.mat.meta new file mode 100644 index 0000000..8def2b1 --- /dev/null +++ b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Volume.mat.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: b246d2a0da7bbb3459e271e203c4abe1 +timeCreated: 1546682531 +licenseType: Store +NativeFormatImporter: + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI.cs b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI.cs new file mode 100644 index 0000000..35b0574 --- /dev/null +++ b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI.cs @@ -0,0 +1,1223 @@ +//----------------------------------------------------------------------------- +// Copyright 2018-2025 RenderHeads Ltd. All rights reserved. +//----------------------------------------------------------------------------- + +#define SHOW_TRACK_INFO_IN_DEBUG_VIEW + +using UnityEngine; +using UnityEngine.UI; +using UnityEngine.EventSystems; +using RenderHeads.Media.AVProVideo.Demos.UI; + +#if ENABLE_INPUT_SYSTEM +using UnityEngine.InputSystem.UI; +#endif + +namespace RenderHeads.Media.AVProVideo.Demos +{ + public class MediaPlayerUI : MonoBehaviour + { + + [SerializeField] MediaPlayer _mediaPlayer = null; + + [Header("Options")] + + [SerializeField] float _keyVolumeDelta = 0.05f; + [SerializeField] float _jumpDeltaTime = 5f; + [SerializeField] bool _showOptions = true; + [SerializeField] bool _showDebug = false; + [SerializeField] bool _autoHide = true; + [SerializeField] float _userInactiveDuration = 1.5f; + [SerializeField] bool _useAudioFading = true; + + [Header("Keyboard Controls")] + [SerializeField] bool _enableKeyboardControls = true; + [SerializeField] KeyCode KeyVolumeUp = KeyCode.UpArrow; + [SerializeField] KeyCode KeyVolumeDown = KeyCode.DownArrow; + [SerializeField] KeyCode KeyTogglePlayPause = KeyCode.Space; + [SerializeField] KeyCode KeyToggleMute = KeyCode.M; + [SerializeField] KeyCode KeyJumpForward = KeyCode.RightArrow; + [SerializeField] KeyCode KeyJumpBack = KeyCode.LeftArrow; + + [Header("Optional Components")] + [SerializeField] OverlayManager _overlayManager = null; + [SerializeField] MediaPlayer _thumbnailMediaPlayer = null; + [SerializeField] RectTransform _timelineTip = null; + + [Header("UI Components")] + [SerializeField] RectTransform _canvasTransform = null; + //[SerializeField] Image image = null; + [SerializeField] Slider _sliderTime = null; + [SerializeField] EventTrigger _videoTouch = null; + [SerializeField] CanvasGroup _controlsGroup = null; + [SerializeField] OptionsMenu _optionsMenu = null; + + [Header("UI Components (Optional)")] + [SerializeField] GameObject _liveItem = null; + [SerializeField] Text _textMediaName = null; + [SerializeField] Text _textTimeDuration = null; + [SerializeField] Slider _sliderVolume = null; + [SerializeField] Button _buttonPlayPause = null; + [SerializeField] Button _buttonVolume = null; + [SerializeField] Button _buttonSubtitles = null; + [SerializeField] Button _buttonOptions = null; + [SerializeField] Button _buttonDebug = null; + [SerializeField] Button _buttonTimeBack = null; + [SerializeField] Button _buttonTimeForward = null; + [SerializeField] RawImage _imageAudioSpectrum = null; + [SerializeField] HorizontalSegmentsPrimitive _segmentsSeek = null; + [SerializeField] HorizontalSegmentsPrimitive _segmentsBuffered = null; + [SerializeField] HorizontalSegmentsPrimitive _segmentsProgress = null; + + private bool _wasPlayingBeforeTimelineDrag; + private float _controlsFade = 1f; + private Material _playPauseMaterial; + private Material _volumeMaterial; + private Material _subtitlesMaterial; + private Material _optionsMaterial; + private Material _audioSpectrumMaterial; + private float[] _spectrumSamples = new float[128]; + private float[] _spectrumSamplesSmooth = new float[128]; + private float _maxValue = 1f; + private float _audioVolume = 1f; + + private float _audioFade = 0f; + private bool _isAudioFadingUpToPlay = true; + private const float AudioFadeDuration = 0.25f; + private float _audioFadeTime = 0f; + + private readonly LazyShaderProperty _propMorph = new LazyShaderProperty("_Morph"); + private readonly LazyShaderProperty _propMute = new LazyShaderProperty("_Mute"); + private readonly LazyShaderProperty _propVolume = new LazyShaderProperty("_Volume"); + private readonly LazyShaderProperty _propSpectrum = new LazyShaderProperty("_Spectrum"); + private readonly LazyShaderProperty _propSpectrumRange = new LazyShaderProperty("_SpectrumRange"); + + [Header("Events")] + public GameObject _eventSystem; + + void Awake() + { +#if UNITY_IOS || UNITY_ANDROID || UNITY_OPENHARMONY +#if UNITY_2022_3_OR_NEWER + var refreshRate = (int)System.Math.Round(Screen.currentResolution.refreshRateRatio.value); +#else + var refreshRate = Screen.currentResolution.refreshRate; +#endif + Debug.Log("Setting Application.targetFrameRate to: " + refreshRate); + Application.targetFrameRate = refreshRate; +#endif + +#if !ENABLE_INPUT_SYSTEM || ENABLE_LEGACY_INPUT_MANAGER + _eventSystem.GetComponent().enabled = true; +#else + _eventSystem.GetComponent().enabled = true; +#endif + } + + + void Start() + { + if (_mediaPlayer) + { + _audioVolume = _mediaPlayer.AudioVolume; +#if UNITY_ANDROID || UNITY_OPENHARMONY + // Disable screen sleep timeout if the video is set to auto-start + if (_mediaPlayer.AutoStart) + { + Screen.sleepTimeout = SleepTimeout.NeverSleep; + } +#endif + } + SetupPlayPauseButton(); + SetupTimeBackForwardButtons(); + SetupVolumeButton(); + SetupSubtitlesButton(); + SetupOptionsButton(); + SetupDebugButton(); + SetupAudioSpectrum(); + CreateTimelineDragEvents(); + CreateVideoTouchEvents(); + CreateVolumeSliderEvents(); + UpdateVolumeSlider(); + BuildOptionsMenu(); + } + + private struct UserInteraction + { + public static float InactiveTime; + private static Vector3 _previousMousePos; + private static int _lastInputFrame; + + public static bool IsUserInputThisFrame() + { + if (Time.frameCount == _lastInputFrame) + { + return true; + } + +#if !ENABLE_INPUT_SYSTEM || ENABLE_LEGACY_INPUT_MANAGER + bool touchInput = (Input.touchSupported && Input.touchCount > 0); + bool mouseInput = (Input.mousePresent && (Input.mousePosition != _previousMousePos || Input.mouseScrollDelta != Vector2.zero || Input.GetMouseButton(0))); + if (touchInput || mouseInput) + { + _previousMousePos = Input.mousePosition; + _lastInputFrame = Time.frameCount; + return true; + } + return false; +#else + return true; +#endif + } + } + + private Material DuplicateMaterialOnImage(Graphic image) + { + // Assign a copy of the material so we aren't modifying the material asset file + image.material = new Material(image.material); + return image.material; + } + + private void SetupPlayPauseButton() + { + if (_buttonPlayPause) + { + _buttonPlayPause.onClick.AddListener(OnPlayPauseButtonPressed); + _playPauseMaterial = DuplicateMaterialOnImage(_buttonPlayPause.GetComponent()); + } + } + + private void SetupTimeBackForwardButtons() + { + if (_buttonTimeBack) + { + _buttonTimeBack.onClick.AddListener(OnPlayTimeBackButtonPressed); + } + if (_buttonTimeForward) + { + _buttonTimeForward.onClick.AddListener(OnPlayTimeForwardButtonPressed); + } + } + + private void SetupVolumeButton() + { + if (_buttonVolume) + { + _buttonVolume.onClick.AddListener(OnVolumeButtonPressed); + _volumeMaterial = DuplicateMaterialOnImage(_buttonVolume.GetComponent()); + } + } + + private void SetupSubtitlesButton() + { + if (_buttonSubtitles) + { + _buttonSubtitles.onClick.AddListener(OnSubtitlesButtonPressed); + _subtitlesMaterial = DuplicateMaterialOnImage(_buttonSubtitles.GetComponent()); + } + } + + private void SetupOptionsButton() + { + if (_buttonOptions) + { + _buttonOptions.onClick.AddListener(OnOptionsButtonPressed); + _optionsMaterial = DuplicateMaterialOnImage(_buttonOptions.GetComponent()); + } + } + + private void SetupDebugButton() + { + if (_buttonDebug) + { + _buttonDebug.onClick.AddListener(OnDebugButtonPressed); + } + } + + private void SetupAudioSpectrum() + { + if (_imageAudioSpectrum) + { + _audioSpectrumMaterial = DuplicateMaterialOnImage(_imageAudioSpectrum); + } + } + + private void OnPlayPauseButtonPressed() + { + TogglePlayPause(); + } + + private void OnPlayTimeBackButtonPressed() + { + SeekRelative(-_jumpDeltaTime); + } + + private void OnPlayTimeForwardButtonPressed() + { + SeekRelative(_jumpDeltaTime); + } + + private void OnVolumeButtonPressed() + { + ToggleMute(); + } + + private void OnSubtitlesButtonPressed() + { + ToggleSubtitles(); + } + + private void OnOptionsButtonPressed() + { + ToggleOptionsMenu(); + } + + private void OnDebugButtonPressed() + { + ToggleDebugMenu(); + } + + private bool _isHoveringOverTimeline; + + private void OnTimelineBeginHover(PointerEventData eventData) + { + if (eventData.pointerCurrentRaycast.gameObject != null) + { + _isHoveringOverTimeline = true; + _sliderTime.transform.localScale = new Vector3(1f, 2.5f, 1f); + } + } + + private void OnTimelineEndHover(PointerEventData eventData) + { + _isHoveringOverTimeline = false; + _sliderTime.transform.localScale = new Vector3(1f, 1f, 1f); + } + + private void CreateVideoTouchEvents() + { + EventTrigger.Entry entry = new EventTrigger.Entry(); + entry.eventID = EventTriggerType.PointerUp; + entry.callback.AddListener((data) => { OnVideoPointerUp(); }); + _videoTouch.triggers.Add(entry); + } + + private void OnVideoPointerUp() + { + // Toggle options off + if (_showOptions) + { + ToggleOptionsMenu(); + return; + } + + // Else, maybe, play/pause + bool controlsMostlyVisible = (_controlsGroup.alpha >= 0.5f && _controlsGroup.gameObject.activeSelf); + if (controlsMostlyVisible) + { + TogglePlayPause(); + } + } + + void UpdateAudioFading() + { + // Increment fade timer + if (_audioFadeTime < AudioFadeDuration) + { + _audioFadeTime = Mathf.Clamp(_audioFadeTime + Time.deltaTime, 0f, AudioFadeDuration); + } + + // Trigger pause when audio faded down + if (_audioFadeTime >= AudioFadeDuration) + { + if (!_isAudioFadingUpToPlay) + { + Pause(skipFeedback: true); + } + } + + // Apply audio fade value + if (_mediaPlayer.Control != null && _mediaPlayer.Control.IsPlaying()) + { + _audioFade = Mathf.Clamp01(_audioFadeTime / AudioFadeDuration); + if (!_isAudioFadingUpToPlay) + { + _audioFade = (1f - _audioFade); + } + ApplyAudioVolume(); + } + } + + public void TogglePlayPause() + { + if (_mediaPlayer && _mediaPlayer.Control != null) + { + if (_useAudioFading && _mediaPlayer.Info.HasAudio()) + { + if (_mediaPlayer.Control.IsPlaying()) + { + if (_overlayManager) + { + _overlayManager.TriggerFeedback(OverlayManager.Feedback.Pause); + } + _isAudioFadingUpToPlay = false; + } + else + { + _isAudioFadingUpToPlay = true; + Play(); + } + _audioFadeTime = 0f; + } + else + { + if (_mediaPlayer.Control.IsPlaying()) + { + Pause(); + } + else + { + Play(); + } + } + } + } + + private void Play() + { + if (_mediaPlayer && _mediaPlayer.Control != null) + { + if (_overlayManager) + { + _overlayManager.TriggerFeedback(OverlayManager.Feedback.Play); + } + _mediaPlayer.Play(); + +#if UNITY_ANDROID || UNITY_OPENHARMONY + Screen.sleepTimeout = SleepTimeout.NeverSleep; +#endif + } + } + + private void Pause(bool skipFeedback = false) + { + if (_mediaPlayer && _mediaPlayer.Control != null) + { + if (!skipFeedback) + { + if (_overlayManager) + { + _overlayManager.TriggerFeedback(OverlayManager.Feedback.Pause); + } + } + _mediaPlayer.Pause(); +#if UNITY_ANDROID || UNITY_OPENHARMONY + Screen.sleepTimeout = SleepTimeout.SystemSetting; +#endif + } + } + + public void SeekRelative(float deltaTime) + { + if (_mediaPlayer && _mediaPlayer.Control != null) + { + TimeRange timelineRange = GetTimelineRange(); + double time = _mediaPlayer.Control.GetCurrentTime() + deltaTime; + time = System.Math.Max(time, timelineRange.startTime); + time = System.Math.Min(time, timelineRange.startTime + timelineRange.duration); + _mediaPlayer.Control.Seek(time); + + if (_overlayManager) + { + _overlayManager.TriggerFeedback(deltaTime > 0f ? OverlayManager.Feedback.SeekForward : OverlayManager.Feedback.SeekBack); + } + } + } + + public void ChangeAudioVolume(float delta) + { + if (_mediaPlayer && _mediaPlayer.Control != null) + { + // Change volume + _audioVolume = Mathf.Clamp01(_audioVolume + delta); + + // Update the UI + UpdateVolumeSlider(); + + // Trigger the overlays + if (_overlayManager) + { + _overlayManager.TriggerFeedback(delta > 0f ? OverlayManager.Feedback.VolumeUp : OverlayManager.Feedback.VolumeDown); + } + } + } + + public void ToggleMute() + { + if (_mediaPlayer && _mediaPlayer.Control != null) + { + if (_mediaPlayer.AudioMuted) + { + MuteAudio(false); + } + else + { + MuteAudio(true); + } + } + } + + private void MuteAudio(bool mute) + { + if (_mediaPlayer && _mediaPlayer.Control != null) + { + // Change mute + _mediaPlayer.AudioMuted = mute; + + // Update the UI + // The UI element is constantly updated by the Update() method + + // Trigger the overlays + if (_overlayManager) + { + _overlayManager.TriggerFeedback(mute ? OverlayManager.Feedback.VolumeMute : OverlayManager.Feedback.VolumeUp); + } + } + } + + public void ToggleSubtitles() + { + if (_mediaPlayer && _mediaPlayer.TextTracks != null) + { + if (_mediaPlayer.TextTracks.GetTextTracks().Count > 0) + { + int iNewTrackIndex = -1; + if (_mediaPlayer.TextTracks.GetActiveTextTrack() != null) + { + _mediaPlayer.TextTracks.SetActiveTextTrack(null); + } + else + { + // TODO: instead of activating the first one, base it on the language/track + // selection stored in the MediaPlayerUI + TextTrack textTrack = _mediaPlayer.TextTracks.GetTextTracks()[0]; + _mediaPlayer.TextTracks.SetActiveTextTrack(textTrack); + iNewTrackIndex = textTrack.Uid; + } + + if (_optionsMenu) + { + _optionsMenu.ChangeSubtitleTrack(iNewTrackIndex); + } + } + } + } + + private void ToggleOptionsMenu() + { + _showOptions = !_showOptions; + BuildOptionsMenu(); + } + + private void ToggleDebugMenu() + { + _showDebug = !_showDebug; + +#if true + // Temporary code for now disables to touch controls while the debug menu + // is shown, to stop it consuming mouse input for IMGUI + _videoTouch.enabled = !_showDebug; +#endif + } + + private void BuildOptionsMenu() + { + if (_optionsMenu) + { + _optionsMenu.SetActive(_showOptions); + } + } + + private void CreateTimelineDragEvents() + { + EventTrigger trigger = _sliderTime.gameObject.GetComponent(); + if (trigger != null) + { + EventTrigger.Entry entry = new EventTrigger.Entry(); + entry.eventID = EventTriggerType.PointerDown; + entry.callback.AddListener((data) => { OnTimeSliderBeginDrag(); }); + trigger.triggers.Add(entry); + + entry = new EventTrigger.Entry(); + entry.eventID = EventTriggerType.Drag; + entry.callback.AddListener((data) => { OnTimeSliderDrag(); }); + trigger.triggers.Add(entry); + + entry = new EventTrigger.Entry(); + entry.eventID = EventTriggerType.PointerUp; + entry.callback.AddListener((data) => { OnTimeSliderEndDrag(); }); + trigger.triggers.Add(entry); + + entry = new EventTrigger.Entry(); + entry.eventID = EventTriggerType.PointerEnter; + entry.callback.AddListener((data) => { OnTimelineBeginHover((PointerEventData)data); }); + trigger.triggers.Add(entry); + + entry = new EventTrigger.Entry(); + entry.eventID = EventTriggerType.PointerExit; + entry.callback.AddListener((data) => { OnTimelineEndHover((PointerEventData)data); }); + trigger.triggers.Add(entry); + } + } + + private void CreateVolumeSliderEvents() + { + if (_sliderVolume != null) + { + EventTrigger trigger = _sliderVolume.gameObject.GetComponent(); + if (trigger != null) + { + EventTrigger.Entry entry = new EventTrigger.Entry(); + entry.eventID = EventTriggerType.PointerDown; + entry.callback.AddListener((data) => { OnVolumeSliderDrag(); }); + trigger.triggers.Add(entry); + + entry = new EventTrigger.Entry(); + entry.eventID = EventTriggerType.Drag; + entry.callback.AddListener((data) => { OnVolumeSliderDrag(); }); + trigger.triggers.Add(entry); + } + } + } + + private void OnVolumeSliderDrag() + { + if (_mediaPlayer && _mediaPlayer.Control != null) + { + _audioVolume = _sliderVolume.value; + ApplyAudioVolume(); + } + } + + private void ApplyAudioVolume() + { + if (_mediaPlayer) + { + _mediaPlayer.AudioVolume = (_audioVolume * _audioFade); + } + } + + private void UpdateVolumeSlider() + { + if (_sliderVolume) + { + if (_mediaPlayer) + { + // TODO: remove this + /*if (mp.Control != null) + { + _sliderVolume.value = mp.Control.GetVolume(); + } + else*/ + { + _sliderVolume.value = _audioVolume; + } + } + } + } + + private void UpdateAudioSpectrum() + { + bool showAudioSpectrum = false; + + if (_mediaPlayer == null) + { + return; + } + + MediaPlayer.PlatformOptions platformOptions = _mediaPlayer.GetCurrentPlatformOptions(); + if (platformOptions == null || !platformOptions.IsUsingAudioCapture) + { + return; + } + + if (_mediaPlayer.Control == null) + { + return; + } + + AudioSource audioSource = _mediaPlayer.AudioSource; + if (audioSource && _audioSpectrumMaterial) + { +// [MOZ] 251204 Disabled on iOS as causes GPU fault on iPhone 12 +#if !UNITY_IOS || UNITY_EDITOR + showAudioSpectrum = true; + + float maxFreq = Helper.GetUnityAudioSampleRate() / 2; + + // Frequencies over 18Khz generally aren't very interesting to visualise, so clamp the range + const float clampFreq = 18000f; + int sampleRange = Mathf.FloorToInt(Mathf.Clamp01(clampFreq / maxFreq) * _spectrumSamples.Length); + + // Add new samples and smooth the samples over time + audioSource.GetSpectrumData(_spectrumSamples, 0, FFTWindow.BlackmanHarris); + + // Find the maxValue sample for normalising with + float maxValue = -1.0f; + for (int i = 0; i < sampleRange; i++) + { + if (_spectrumSamples[i] > maxValue) + { + maxValue = _spectrumSamples[i]; + } + } + + // Chase maxValue to zero + _maxValue = Mathf.Lerp(_maxValue, 0.0f, Mathf.Clamp01(2.0f * Time.deltaTime)); + + // Update maxValue + _maxValue = Mathf.Max(_maxValue, maxValue); + if (_maxValue <= 0.01f) + { + _maxValue = 1f; + } + + // Copy and smooth the spectrum values + for (int i = 0; i < sampleRange; i++) + { + float newSample = _spectrumSamples[i] / _maxValue; + _spectrumSamplesSmooth[i] = Mathf.Lerp(_spectrumSamplesSmooth[i], newSample, Mathf.Clamp01(15.0f * Time.deltaTime)); + } + + // Update shader + _audioSpectrumMaterial.SetFloatArray(_propSpectrum.Id, _spectrumSamplesSmooth); + _audioSpectrumMaterial.SetFloat(_propSpectrumRange.Id, (float)sampleRange); +#endif + } + + if (_imageAudioSpectrum && _imageAudioSpectrum.gameObject.activeSelf == false) + { + _imageAudioSpectrum.gameObject.SetActive(showAudioSpectrum); + } + } + + private void OnTimeSliderBeginDrag() + { + if (_mediaPlayer && _mediaPlayer.Control != null) + { + _wasPlayingBeforeTimelineDrag = _mediaPlayer.Control.IsPlaying(); + if (_wasPlayingBeforeTimelineDrag) + { + _mediaPlayer.Pause(); + } + OnTimeSliderDrag(); + } + } + + private void OnTimeSliderDrag() + { + if (_mediaPlayer && _mediaPlayer.Control != null) + { + TimeRange timelineRange = GetTimelineRange(); + double time = timelineRange.startTime + (_sliderTime.value * timelineRange.duration); + _mediaPlayer.Control.Seek(time); + _isHoveringOverTimeline = true; + } + } + + private void OnTimeSliderEndDrag() + { + if (_mediaPlayer && _mediaPlayer.Control != null) + { + if (_wasPlayingBeforeTimelineDrag) + { + _mediaPlayer.Play(); + _wasPlayingBeforeTimelineDrag = false; + } + } + } + + private TimeRange GetTimelineRange() + { + if (_mediaPlayer.Info != null) + { + return Helper.GetTimelineRange(_mediaPlayer.Info.GetDuration(), _mediaPlayer.Control.GetSeekableTimes()); + } + return new TimeRange(); + } + + private bool CanHideControls() + { + bool result = true; + if (!_autoHide) + { + result = false; + } +#if !ENABLE_INPUT_SYSTEM || ENABLE_LEGACY_INPUT_MANAGER + else if (Input.mousePresent) + { + // Check whether the mouse cursor is over the controls, in which case we can't hide the UI + RectTransform rect = _controlsGroup.GetComponent(); + Vector2 canvasPos; + RectTransformUtility.ScreenPointToLocalPointInRectangle(rect, Input.mousePosition, null, out canvasPos); + + Rect rr = RectTransformUtility.PixelAdjustRect(rect, null); + result = !rr.Contains(canvasPos); + } +#endif + return result; + } + + private void UpdateControlsVisibility() + { + if (UserInteraction.IsUserInputThisFrame() || !CanHideControls()) + { + UserInteraction.InactiveTime = 0f; + FadeUpControls(); + } + else + { + + UserInteraction.InactiveTime += Time.unscaledDeltaTime; + if (UserInteraction.InactiveTime >= _userInactiveDuration) + { + FadeDownControls(); + } + else + { + FadeUpControls(); + } + } + } + + private void FadeUpControls() + { + if (!_controlsGroup.gameObject.activeSelf) + { + _controlsGroup.gameObject.SetActive(true); + } + _controlsFade = Mathf.Min(1f, _controlsFade + Time.deltaTime * 8f); + _controlsGroup.alpha = Mathf.Pow(_controlsFade, 5f); + } + + private void FadeDownControls() + { + if (_controlsGroup.gameObject.activeSelf) + { + _controlsFade = Mathf.Max(0f, _controlsFade - Time.deltaTime * 3f); + _controlsGroup.alpha = Mathf.Pow(_controlsFade, 5f); + if (_controlsGroup.alpha <= 0f) + { + _controlsGroup.gameObject.SetActive(false); + } + } + } + + void Update() + { + if (!_mediaPlayer) return; + + //UserInputThisFrame(Mouse.current.position.ReadValue()); // for mouse movement + UpdateControlsVisibility(); + UpdateAudioFading(); + UpdateAudioSpectrum(); + + if (_mediaPlayer.Info != null) + { + TimeRange timelineRange = GetTimelineRange(); + + // Update timeline hover popup +#if !ENABLE_INPUT_SYSTEM || ENABLE_LEGACY_INPUT_MANAGER + if (_timelineTip != null) + { + if (_isHoveringOverTimeline) + { + Vector2 canvasPos; + RectTransformUtility.ScreenPointToLocalPointInRectangle(_canvasTransform, Input.mousePosition, null, out canvasPos); + + _segmentsSeek.gameObject.SetActive(true); + _timelineTip.gameObject.SetActive(true); + Vector3 mousePos = _canvasTransform.TransformPoint(canvasPos); + + _timelineTip.position = new Vector2(mousePos.x, _timelineTip.position.y); + + if (UserInteraction.IsUserInputThisFrame()) + { + // Work out position on the timeline + Bounds bounds = RectTransformUtility.CalculateRelativeRectTransformBounds(this._sliderTime.GetComponent()); + float x = Mathf.Clamp01((canvasPos.x - bounds.min.x) / bounds.size.x); + + double time = (double)x * timelineRange.Duration; + + // Seek to the new position + if (_thumbnailMediaPlayer != null && _thumbnailMediaPlayer.Control != null) + { + _thumbnailMediaPlayer.Control.SeekFast(time); + } + + // Update time text + Text hoverText = _timelineTip.GetComponentInChildren(); + if (hoverText != null) + { + time -= timelineRange.startTime; + time = System.Math.Max(time, 0.0); + time = System.Math.Min(time, timelineRange.Duration); + hoverText.text = Helper.GetTimeString(time, false); + } + + { + // Update seek segment when hovering over timeline + if (_segmentsSeek != null) + { + float[] ranges = new float[2]; + if (timelineRange.Duration > 0.0) + { + double t = ((_mediaPlayer.Control.GetCurrentTime() - timelineRange.startTime) / timelineRange.duration); + ranges[1] = x; + ranges[0] = (float)t; + } + _segmentsSeek.Segments = ranges; + } + } + } + } + else + { + _timelineTip.gameObject.SetActive(false); + _segmentsSeek.gameObject.SetActive(false); + } + } +#endif + // Updated stalled display + if (_overlayManager) + { + _overlayManager.Reset(); + if (_mediaPlayer.Info.IsPlaybackStalled()) + { + _overlayManager.TriggerStalled(); + } + } + + // Update keyboard input + if (_enableKeyboardControls) + { +#if !ENABLE_INPUT_SYSTEM || ENABLE_LEGACY_INPUT_MANAGER + // Keyboard toggle play/pause + if (Input.GetKeyDown(KeyTogglePlayPause)) + { + TogglePlayPause(); + } + + // Keyboard seek 5 seconds + if (Input.GetKeyDown(KeyJumpBack)) + { + SeekRelative(-_jumpDeltaTime); + } + else if (Input.GetKeyDown(KeyJumpForward)) + { + SeekRelative(_jumpDeltaTime); + } + + // Keyboard control volume + if (Input.GetKeyDown(KeyVolumeUp)) + { + ChangeAudioVolume(_keyVolumeDelta); + } + else if (Input.GetKeyDown(KeyVolumeDown)) + { + ChangeAudioVolume(-_keyVolumeDelta); + } + + // Keyboard toggle mute + if (Input.GetKeyDown(KeyToggleMute)) + { + ToggleMute(); + } +#endif + } + + // Animation play/pause button + if (_playPauseMaterial != null) + { + float t = _playPauseMaterial.GetFloat(_propMorph.Id); + float d = 1f; + if (_mediaPlayer.Control.IsPlaying()) + { + d = -1f; + } + t += d * Time.deltaTime * 6f; + t = Mathf.Clamp01(t); + _playPauseMaterial.SetFloat(_propMorph.Id, t); + } + + // Animation volume/mute button + if (_volumeMaterial != null) + { + float t = _volumeMaterial.GetFloat(_propMute.Id); + float d = 1f; + if (!_mediaPlayer.AudioMuted) + { + d = -1f; + } + t += d * Time.deltaTime * 6f; + t = Mathf.Clamp01(t); + _volumeMaterial.SetFloat(_propMute.Id, t); + _volumeMaterial.SetFloat(_propVolume.Id, _audioVolume); + } + + // Animation subtitles button + if (_subtitlesMaterial) + { + float t = _subtitlesMaterial.GetFloat(_propMorph.Id); + float d = 1f; + if (_mediaPlayer.TextTracks.GetActiveTextTrack() == null) + { + d = -1f; + } + t += d * Time.deltaTime * 6f; + t = Mathf.Clamp01(t); + _subtitlesMaterial.SetFloat(_propMorph.Id, t); + } + + // Animation options button + if (_optionsMaterial) + { + float t = _optionsMaterial.GetFloat(_propMorph.Id); + float d = 1f; + if (!_showOptions) + { + d = -1f; + } + t += d * Time.deltaTime * 6f; + t = Mathf.Clamp01(t); + _optionsMaterial.SetFloat(_propMorph.Id, t); + } + + // Update time/duration text display + if (_textTimeDuration) + { + string t1 = Helper.GetTimeString((_mediaPlayer.Control.GetCurrentTime() - timelineRange.startTime), false); + string d1 = Helper.GetTimeString(timelineRange.duration, false); + _textTimeDuration.text = string.Format("{0} / {1}", t1, d1); + } + + // Update volume slider + if (!_useAudioFading) + { + UpdateVolumeSlider(); + } + + // Update time slider position + if (_sliderTime && !_isHoveringOverTimeline) + { + double t = 0.0; + if (timelineRange.duration > 0.0) + { + t = ((_mediaPlayer.Control.GetCurrentTime() - timelineRange.startTime) / timelineRange.duration); + } + _sliderTime.value = Mathf.Clamp01((float)t); + } + + // Update LIVE text visible + if (_liveItem) + { + _liveItem.SetActive(double.IsInfinity(_mediaPlayer.Info.GetDuration())); + } + + // Update subtitle button visible + if (_buttonSubtitles) + { + _buttonSubtitles.gameObject.SetActive(_mediaPlayer.TextTracks.GetTextTracks().Count > 0); + } + + // Update media name + if (_textMediaName) + { +#if MEDIA_NAME + string mediaName = string.Empty; + if (!string.IsNullOrEmpty(_mediaPlayer.VideoPath)) + { + mediaName = System.IO.Path.GetFileName(_mediaPlayer.VideoPath); + if (mediaName.Length > 26) + { + mediaName = mediaName.Substring(0, 26); + } + } +#endif + + string resolutionName = string.Empty; + if (_mediaPlayer.Info.GetVideoWidth() > 0) + { + // resolutionName = Helper.GetFriendlyResolutionName(_mediaPlayer.Info.GetVideoWidth(), _mediaPlayer.Info.GetVideoHeight(), _mediaPlayer.Info.GetVideoFrameRate()); + float fps = _mediaPlayer.Info.GetVideoFrameRate(); + if (fps > 0.0f && !float.IsNaN(fps)) + { + resolutionName = string.Format("{0} x {1} @ {2}", _mediaPlayer.Info.GetVideoWidth(), _mediaPlayer.Info.GetVideoHeight(), fps.ToString("0.00")); + } + else + { + resolutionName = string.Format("{0} x {1}", _mediaPlayer.Info.GetVideoWidth(), _mediaPlayer.Info.GetVideoHeight()); + } + } + +#if MEDIA_NAME + _textMediaName.text = string.Format("{0} {1}", mediaName, resolutionName); +#else + _textMediaName.text = resolutionName; +#endif + } + + // Update buffered segments + if (_segmentsBuffered) + { + TimeRanges times = _mediaPlayer.Control.GetBufferedTimes(); + float[] ranges = null; + if (times.Count > 0 && timelineRange.duration > 0.0) + { + ranges = new float[times.Count * 2]; + for (int i = 0; i < times.Count; i++) + { + ranges[i * 2 + 0] = Mathf.Max(0f, (float)((times[i].StartTime - timelineRange.startTime) / timelineRange.duration)); + ranges[i * 2 + 1] = Mathf.Min(1f, (float)((times[i].EndTime - timelineRange.startTime) / timelineRange.duration)); + } + } + _segmentsBuffered.Segments = ranges; + } + + // Update progress segment + if (_segmentsProgress) + { + TimeRanges times = _mediaPlayer.Control.GetBufferedTimes(); + float[] ranges = null; + if (times.Count > 0 && timelineRange.Duration > 0.0) + { + ranges = new float[2]; + double x1 = (times.MinTime - timelineRange.startTime) / timelineRange.duration; + double x2 = ((_mediaPlayer.Control.GetCurrentTime() - timelineRange.startTime) / timelineRange.duration); + ranges[0] = Mathf.Max(0f, (float)x1); + ranges[1] = Mathf.Min(1f, (float)x2); + } + _segmentsProgress.Segments = ranges; + } + } + } + + void OnGUI() + { + if (!_showDebug) + { + return; + } + if (!_mediaPlayer || _mediaPlayer.Control == null) + { + return; + } + + GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3(2f, 2f, 1f)); + + GUI.backgroundColor = Color.red; + GUILayout.BeginVertical(GUI.skin.box); + GUI.backgroundColor = Color.white; + + GUILayout.Label(string.Format("Duration: {0}s\tFPS: {1}", _mediaPlayer.Info.GetDuration(), _mediaPlayer.Info.GetVideoDisplayRate().ToString("F2"))); + + GUILayout.BeginHorizontal(); + GUILayout.Label("States: "); + GUILayout.Toggle(_mediaPlayer.Control.HasMetaData(), "HasMetaData", GUI.skin.button); + GUILayout.Toggle(_mediaPlayer.Control.IsPaused(), "Paused", GUI.skin.button); + GUILayout.Toggle(_mediaPlayer.Control.IsPlaying(), "Playing", GUI.skin.button); + GUILayout.Toggle(_mediaPlayer.Control.IsBuffering(), "Buffering", GUI.skin.button); + GUILayout.Toggle(_mediaPlayer.Control.IsSeeking(), "Seeking", GUI.skin.button); + GUILayout.Toggle(_mediaPlayer.Control.IsFinished(), "Finished", GUI.skin.button); + GUILayout.EndHorizontal(); + + { + TimeRanges times = _mediaPlayer.Control.GetBufferedTimes(); + if (times != null) + { + GUILayout.Label("Buffered Range " + times.MinTime + " - " + times.MaxTime); + } + } + { + TimeRanges times = _mediaPlayer.Control.GetSeekableTimes(); + if (times != null) + { + GUILayout.Label("Seek Range " + times.MinTime + " - " + times.MaxTime); + } + } + + +#if SHOW_TRACK_INFO_IN_DEBUG_VIEW + { + GUILayout.Label("Video Tracks: " + _mediaPlayer.VideoTracks.GetVideoTracks().Count); + + GUILayout.BeginVertical(); + + VideoTrack selectedTrack = null; + foreach (VideoTrack track in _mediaPlayer.VideoTracks.GetVideoTracks()) + { + bool isSelected = (track == _mediaPlayer.VideoTracks.GetActiveVideoTrack()); + if (isSelected) GUI.color = Color.green; + if (GUILayout.Button(track.DisplayName, GUILayout.ExpandWidth(false))) + { + selectedTrack = track; + } + if (isSelected) GUI.color = Color.white; + } + GUILayout.EndHorizontal(); + if (selectedTrack != null) + { + _mediaPlayer.VideoTracks.SetActiveVideoTrack(selectedTrack); + } + } + { + GUILayout.Label("Audio Tracks: " + _mediaPlayer.AudioTracks.GetAudioTracks().Count); + + GUILayout.BeginVertical(); + + AudioTrack selectedTrack = null; + foreach (AudioTrack track in _mediaPlayer.AudioTracks.GetAudioTracks()) + { + bool isSelected = (track == _mediaPlayer.AudioTracks.GetActiveAudioTrack()); + if (isSelected) GUI.color = Color.green; + if (GUILayout.Button(track.DisplayName, GUILayout.ExpandWidth(false))) + { + selectedTrack = track; + } + if (isSelected) GUI.color = Color.white; + } + GUILayout.EndHorizontal(); + if (selectedTrack != null) + { + _mediaPlayer.AudioTracks.SetActiveAudioTrack(selectedTrack); + } + } + { + GUILayout.Label("Text Tracks: " + _mediaPlayer.TextTracks.GetTextTracks().Count); + + GUILayout.BeginVertical(); + + TextTrack selectedTrack = null; + foreach (TextTrack track in _mediaPlayer.TextTracks.GetTextTracks()) + { + bool isSelected = (track == _mediaPlayer.TextTracks.GetActiveTextTrack()); + if (isSelected) GUI.color = Color.green; + if (GUILayout.Button(track.DisplayName, GUILayout.ExpandWidth(false))) + { + selectedTrack = track; + } + if (isSelected) GUI.color = Color.white; + } + GUILayout.EndHorizontal(); + if (selectedTrack != null) + { + _mediaPlayer.TextTracks.SetActiveTextTrack(selectedTrack); + } + } +#else + GUILayout.Label( string.Format("Video Tracks: {0}\tAudio Tracks: {1}\tText Tracks: {2}", _mediaPlayer.VideoTracks.GetVideoTracks().Count, _mediaPlayer.AudioTracks.GetAudioTracks().Count, _mediaPlayer.TextTracks.GetTextTracks().Count) ); +#endif + GUILayout.EndVertical(); + } + } +} diff --git a/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI.cs.meta b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI.cs.meta new file mode 100644 index 0000000..06c4dd1 --- /dev/null +++ b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 35bb2f3708dd0394cb564ca3557a37fc +timeCreated: 1546712398 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI.mat b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI.mat new file mode 100644 index 0000000..aaf28e3 --- /dev/null +++ b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI.mat @@ -0,0 +1,82 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: MediaPlayerUI + m_Shader: {fileID: 4800000, guid: 8b83f1522b53ad44a9a271e7db8aa527, type: 3} + m_ShaderKeywords: + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _BumpScale: 1 + - _ColorMask: 15 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _Stencil: 0 + - _StencilComp: 8 + - _StencilOp: 0 + - _StencilReadMask: 255 + - _StencilWriteMask: 255 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI.mat.meta b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI.mat.meta new file mode 100644 index 0000000..9f6dc8f --- /dev/null +++ b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI.mat.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 4dc8d5e4c33efff42a23dc52502a4a4d +timeCreated: 1546682531 +licenseType: Store +NativeFormatImporter: + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI.shader b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI.shader new file mode 100644 index 0000000..0379dd9 --- /dev/null +++ b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI.shader @@ -0,0 +1,486 @@ +// Credit to Inigo Quilez (https://www.iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm) for many of the 2D functions used +Shader "Unlit/MediaPlayerUI" +{ + Properties + { + [PerRendererData] _MainTex("Sprite Texture", 2D) = "white" {} + _Color("Tint", Color) = (1,1,1,1) + + _StencilComp("Stencil Comparison", Float) = 8 + _Stencil("Stencil ID", Float) = 0 + _StencilOp("Stencil Operation", Float) = 0 + _StencilWriteMask("Stencil Write Mask", Float) = 255 + _StencilReadMask("Stencil Read Mask", Float) = 255 + + _ColorMask("Color Mask", Float) = 15 + [KeywordEnum(Circle, Play, Pause, PlayPause, Buffering, Volume, Forward, Back, CC, Options, Spectrum)] UI("UI Element", Float) = 0 + _Morph("Morph", Range(0, 1)) = 0 + _Mute("Mute", Range(0, 1)) = 0 + _Volume("Volume", Range(0, 1)) = 1 + + [Toggle(DRAW_OUTLINE)] _DrawOutline("Draw Outline", Float) = 0 + _OutlineSize("Outline Size", Range(0, 0.1)) = 0.05 + _OutlineOpacity("Outline Opacity", Range(0, 1)) = 0.25 + _OutlineSoftness("Outline Softness", Range(0, 1)) = 0 + } + SubShader + { + Tags + { + "Queue"="Transparent" + "IgnoreProjector"="True" + "RenderType"="Transparent" + "PreviewType"="Plane" + "CanUseSpriteAtlas"="True" + } + + Stencil + { + Ref[_Stencil] + Comp[_StencilComp] + Pass[_StencilOp] + ReadMask[_StencilReadMask] + WriteMask[_StencilWriteMask] + } + + Cull Off + Lighting Off + ZWrite Off + ZTest[unity_GUIZTestMode] + Fog{ Mode Off } + Blend SrcAlpha OneMinusSrcAlpha + ColorMask[_ColorMask] + + Pass + { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma multi_compile UI_CIRCLE UI_PLAY UI_PAUSE UI_PLAYPAUSE UI_BUFFERING UI_VOLUME UI_FORWARD UI_BACK UI_CC UI_OPTIONS UI_SPECTRUM + #pragma shader_feature DRAW_OUTLINE + #include "UnityCG.cginc" + + struct appdata_t + { + float4 vertex : POSITION; + float4 color : COLOR; + float2 texcoord : TEXCOORD0; + }; + + struct v2f + { + float4 vertex : SV_POSITION; + fixed4 color : COLOR; + half2 uv : TEXCOORD0; + float4 worldPosition : TEXCOORD1; + }; + + uniform fixed4 _Color; + uniform float _Morph; + uniform float _Volume; + uniform float _Mute; + uniform float _OutlineSize; + uniform float _OutlineOpacity; + uniform float _OutlineSoftness; +#if UI_SPECTRUM + #if SHADER_API_GLES + uniform float _Spectrum[4]; + #else + uniform float _Spectrum[128]; + #endif + uniform float _SpectrumRange; + uniform float _SpectrumMax; +#endif + sampler2D _MainTex; + float4 _MainTex_ST; + + v2f vert(appdata_t IN) + { + v2f OUT; + OUT.worldPosition = IN.vertex; + OUT.vertex = UnityObjectToClipPos(IN.vertex); +#ifdef UNITY_HALF_TEXEL_OFFSET + OUT.vertex.xy += (_ScreenParams.zw - 1.0)*float2(-1, 1); +#endif + OUT.uv.xy = IN.texcoord.xy; + OUT.color = IN.color * _Color; + + return OUT; + } + + float ndot(float2 a, float2 b) { return a.x*b.x - a.y*b.y; } + + float opU(float d1, float d2) { return min(d1, d2); } + + float opS(float d1, float d2) { return max(-d1, d2); } + + float opI(float d1, float d2) { return max(d1, d2); } + + float sdCircle(in float2 p, float r) + { + return length(p) - r; + } + + float sdRhombus(in float2 p, in float2 b) + { + float2 q = abs(p); + float h = clamp((-2.0*ndot(q, b) + ndot(b, b)) / dot(b, b), -1.0, 1.0); + float d = length(q - 0.5*b*float2(1.0 - h, 1.0 + h)); + return d * sign(q.x*b.y + q.y*b.x - b.x*b.y); + } + + float sdEquilateralTriangle(in float2 p) + { + const float k = sqrt(3.0); + + p.x = abs(p.x) - 1.0; + p.y = p.y + 1.0 / k; + if (p.x + k*p.y > 0.0) p = float2(p.x - k*p.y, -k*p.x - p.y) / 2.0; + p.x -= clamp(p.x, -2.0, 0.0); + return -length(p)*sign(p.y); + } + + float sdTriangle(in float2 p, in float2 p0, in float2 p1, in float2 p2) + { + float2 e0 = p1 - p0, e1 = p2 - p1, e2 = p0 - p2; + float2 v0 = p - p0, v1 = p - p1, v2 = p - p2; + + float2 pq0 = v0 - e0*clamp(dot(v0, e0) / dot(e0, e0), 0.0, 1.0); + float2 pq1 = v1 - e1*clamp(dot(v1, e1) / dot(e1, e1), 0.0, 1.0); + float2 pq2 = v2 - e2*clamp(dot(v2, e2) / dot(e2, e2), 0.0, 1.0); + + float s = sign(e0.x*e2.y - e0.y*e2.x); + float2 d = min(min(float2(dot(pq0, pq0), s*(v0.x*e0.y - v0.y*e0.x)), + float2(dot(pq1, pq1), s*(v1.x*e1.y - v1.y*e1.x))), + float2(dot(pq2, pq2), s*(v2.x*e2.y - v2.y*e2.x))); + + return -sqrt(d.x)*sign(d.y); + } + + + float sdTriangleIsosceles(in float2 p, in float2 q) + { + p.x = abs(p.x); + + float2 a = p - q*clamp(dot(p, q) / dot(q, q), 0.0, 1.0); + float2 b = p - q*float2(clamp(p.x / q.x, 0.0, 1.0), 1.0); + float s = -sign(q.y); + float2 d = min(float2(dot(a, a), s*(p.x*q.y - p.y*q.x)), + float2(dot(b, b), s*(p.y - q.y))); + + return -sqrt(d.x)*sign(d.y); + } + + float sdBox(in float2 p, in float2 b) + { + float2 d = abs(p) - b; + return length(max(d, float2(0.0, 0.0))) + min(max(d.x, d.y), 0.0); + } + + float sdRoundedBox(in float2 p, in float2 b, in float4 r) + { + r.xy = (p.x>0.0)?r.xy : r.zw; + r.x = (p.y>0.0)?r.x : r.y; + float2 q = abs(p)-b+r.x; + return min(max(q.x,q.y),0.0) + length(max(q,0.0)) - r.x; + } + + float sdArc(in float2 p, in float2 sca, in float2 scb, in float ra, float rb) + { + p = mul(float2x2(sca.x,sca.y,-sca.y,sca.x), p); + p.x = abs(p.x); + float k = (scb.y*p.x>scb.x*p.y) ? dot(p.xy,scb) : length(p.xy); + return sqrt( dot(p,p) + ra*ra - 2.0*ra*k ) - rb; + } + + float2 rotate2d(float2 v, float a) + { + float s = sin(a); + float c = cos(a); + float2x2 m = float2x2(c, -s, s, c); + return mul(m,v); + } + +#if UI_FORWARD || UI_BACK + float forward(float2 uv) + { + float r1 = 100000.0; + r1 = sdTriangleIsosceles(float2(uv.y, -uv.x) + float2(0.0, 0.333), float2(0.666, 0.666)); + r1 = opS(r1, sdTriangleIsosceles(float2(uv.y, -uv.x) + float2(0.0, 0.333 * 1.5), float2(0.666, 0.666))); + + uv.x += 0.2; + + float r2 = 100000.0; + r2 = sdTriangleIsosceles(float2(uv.y, -uv.x) + float2(0.0, 0.333), float2(0.666, 0.666)); + //r2 = opS(r2, sdTriangleIsosceles(float2(uv.y, -uv.x) + float2(0.0, 0.333 * 1.5), float2(0.666, 0.666))); + + float r = opU(r1, r2); + + return r; + } +#endif + +#if UI_VOLUME + float volume(float2 uv) + { + float r = 100000.0; + + uv.x += 0.25; + + // Cone + r = opU(r, sdBox(uv + float2(0.1, 0.0), float2(0.25, 0.25))); + r = opU(r, sdTriangleIsosceles(float2(uv.y, uv.x) + float2(0.0, 0.3), float2(0.6, 0.6))); + + // Ripple occluder + float s = sdBox(uv + float2(0, 0.0), float2(0.4, 0.7)); + + // Ripple thickness + float rt = 0.15; + + // Ripple 1 + float offset = -0.25; + if (_Volume > 0.0) + { + float t = saturate(_Volume / 0.5); + r = opU(r, opS(s, sdCircle(uv + float2(offset, 0.0), rt*lerp(1, 2, t)))); + } + + // Ripple 2 + float a; + //a = sdCircle(uv + float2(offset, 0.0), 0.6 - rt * 3); + //a = opS(a, opS(s, sdCircle(uv + float2(offset, 0.0), 0.6 - rt * 2))); + //r = opU(a, r); + + // Ripple 3 + if (_Volume > 0.5) + { + float t = saturate((_Volume - 0.5) / 0.5); + a = sdCircle(uv + float2(offset, 0.0), (0.6 - rt)); + a = opS(a, opS(s, sdCircle(uv + float2(offset, 0.0), lerp(0.6-rt, 0.6, t)))); + r = opU(a, r); + } + + // Crossout + if (_Mute > 0.0) + { + float maxLength = 0.8; + float length = _Mute * maxLength; + { + // Cutout + r = opS(-r, -sdBox(rotate2d(uv - float2(0.25, 0), -3.14/4) + float2(-0.1, length/1 - maxLength/1), float2(0.1, length*1))); + + // Line + r = opU(r, sdBox(rotate2d(uv - float2(0.25, 0), -3.14/4) + float2(0.0, length/1 - maxLength/1), float2(0.1, length*1))); + } + } + + return r; + } +#endif + + +#if UI_CC + float ccbutton(float2 uv) + { + float r = 100000.0; + + float barHeight = 0.1; + + float boxSize = 0.65; + float r3 = sdRoundedBox(uv, float2(boxSize, boxSize * 0.9), float4(0.25, 0.25, 0.25, 0.25)); + + float angle1 = 0.0; + float angle2 = 2.3; + float thickeness = 0.08; + float size = 0.25; + float rLeftC = sdArc(float2(0.35 + uv.x*1.5, uv.y), float2(sin(angle1), cos(angle1)), float2(sin(angle2), cos(angle2)), size, thickeness); + float rRightC = sdArc(float2(-0.40 + uv.x*1.5, uv.y), float2(sin(angle1), cos(angle1)), float2(sin(angle2), cos(angle2)), size, thickeness); + + r = opU(rLeftC, rRightC); + r = opS(r, r3); + + if (_Morph > 0.0) + { + float barWidth = lerp(0.0, boxSize, _Morph); + float r4 = sdBox(uv + float2(0.0, boxSize + barHeight * 2.0), float2(barWidth, barHeight)); + r = opU(r, r4); + } + + return r; + } +#endif + +#if UI_OPTIONS + float optionsgear(float2 uv, float radius, float discRatio, float holeRatio, float spokeRatio) + { + float r = 100000.0; + + float r1 = sdCircle(uv, radius * holeRatio); + float r2 = sdCircle(uv, radius * discRatio); + + float rotationOffset = lerp(0.0, 3.141592654/6.0, _Morph); + + float b1 = sdBox(rotate2d(uv, (3.141592654 / 2.0) + rotationOffset), float2(radius, radius * spokeRatio)); + float b2 = sdBox(rotate2d(uv, (3.141592654 / 6.0) + rotationOffset), float2(radius, radius * spokeRatio)); + float b3 = sdBox(rotate2d(uv,-(3.141592654 / 6.0) + rotationOffset), float2(radius, radius * spokeRatio)); + + r = r2; // Base circle + r = opU(r, b1); // Spoke 1 + r = opU(r, b2); // Spoke 2 + r = opU(r, b3); // Spoke 3 + r = opS(r1, r); // Hole + + return r; + } +#endif + +#if UI_BUFFERING + float CircularDistance(float a, float b, float range) + { + float d1 = abs(a-b); + //float d2 = range - d1; + //return lerp((a-b), d2, d1 / (range/2)); + if (d1 > range/2) + { + d1 = (range - d1); + } + else + { + d1 = a-b; + } + return d1; + } +#endif + + fixed4 getColorWithOutline(float d, float3 shapeColor, float3 outlineColor) + { + float dw = fwidth(d) * 0.5; + float shapeAlpha = smoothstep(dw, -dw, d); + +#if !DRAW_OUTLINE + return float4(shapeColor, shapeAlpha); +#else + + float od = (d - _OutlineSize); + float dw2 = fwidth(od) * 0.5; + float outlineAlpha = smoothstep(dw2 + _OutlineSoftness, -dw2 - _OutlineSoftness, od); + + return lerp(float4(outlineColor, outlineAlpha * _OutlineOpacity), float4(shapeColor, shapeAlpha), shapeAlpha); +#endif + } + + fixed4 frag(v2f i) : SV_Target + { +#if UI_SPECTRUM + // In GLES2.0 indexing from the _Spectrum[] array is not supported + #if SHADER_API_GLES + float v = 0.0; + float d = 0.0; + #else + float x = (pow(i.uv.x, 1.0) * _SpectrumRange)-1.0; + //_Spectrum[0] = 0.0; + // Bilinear sample the values + float scale = (1.0+i.uv.x * 8.0); // Scale higher freqs to give them more movement + float v1 = 0.0; + float v2 = 0.0; + int t1 = floor(x); + int t2 = ceil(x); + if (t1 >= 0) + { + v1 = (_Spectrum[t1] * scale); + } + if (t2 >= 0) + { + v2 = (_Spectrum[t2] * scale); + } + v1 = max(v1, 0.01); + v2 = max(v2, 0.01); + float2 uvn = float2(0.0, i.uv.y); + // Get vertical distance + float d1 = (abs(i.uv.y - 0.5) - (v1/1.0)); + float d2 = (abs(i.uv.y - 0.5) - (v2/1.0)); + // Interpolate + float xf = frac(x); + float v = saturate(lerp(v1, v2, xf)); + float d = lerp(d1, d2, xf); + #endif + // Get colour from texture + float yy2 = abs(i.uv.y - 0.5) * 2.0; + float yy = v; + float level = i.uv.y;// + pow(yy2+v, 8); + float3 col = level;//tex2D(_MainTex, float2(level, 0.0f)); + //col.g += abs(i.uv.x); + return getColorWithOutline(d, col, float3(0.0, 0.0, 0.0)) * i.color; +#else +#if UI_CIRCLE + float2 uvn = (i.uv.xy - 0.5) / 0.5; + float d = sdCircle(uvn, 1.0); +#elif UI_PLAY + float2 uvn = (i.uv.xy - float2(0.5, 0.5)) / 0.5; + float d = sdTriangle(uvn, float2(-0.6, 0.6), float2(0.6, 0), float2(-0.6, -0.6)); + +#elif UI_PAUSE + float d1 = sdBox(i.uv - 0.5 + float2(0.2, 0.0), float2(0.1, 0.3)); + float d2 = sdBox(i.uv - 0.5 - float2(0.2, 0.0), float2(0.1, 0.3)); + float d = min(d1, d2); + //c = 1.0 - saturate(smoothstep(dw-0.022, -dw, d))*0.2; +#elif UI_PLAYPAUSE + float2 uvn = (i.uv.xy - float2(0.5, 0.5)) / 0.5; + float d3 = sdTriangle(uvn, float2(-0.6, 0.6), float2(0.6, 0), float2(-0.6, -0.6)); + + float d1 = sdBox(i.uv - 0.5 + float2(0.2, 0.0), float2(0.1, 0.3)); + float d2 = sdBox(i.uv - 0.5 - float2(0.2, 0.0), float2(0.1, 0.3)); + float d = min(d1, d2); + + float dw1 = fwidth(d) * 0.5; + float dw3 = fwidth(d3) * 0.5; + float dw = lerp(dw1, dw3, _Morph); + //a = smoothstep(dw, -dw, lerp(d, d3, _Morph)); + d = lerp(d, d3, _Morph); + //c = 1.0 - saturate(smoothstep(-0.025, 0, lerp(d, d3, _Morph)))*0.2; +#elif UI_BUFFERING + float rsize = 0.05; + float r = 0.5; + float2 uvn = (i.uv.xy - 0.5) / 0.5; + + // Inner radius + float d = sdCircle(uvn, r - rsize); + + // Outer radius + d = opS(d, sdCircle(uvn, r + rsize)); + + // Animation angle + float za = -(_Time.x * 160) + cos(_Time.y*2.0); + float zz = sin(_Time.y); + + // Create point at the animated angle, at the same radius as this UV + float2 dp = float2(sin(za), cos(za)) * length(uvn); + + // Calculate angle between the UV and the new point and subtract offset + float dy = abs(atan((dp.x - uvn.x)/(dp.y - uvn.y))) - abs(zz); + d = opI(d, dy); + +#elif UI_VOLUME + float2 uvn = (i.uv.xy - 0.5) / 0.5; + float d = volume(uvn); +#elif UI_FORWARD + float2 uvn = (i.uv.xy - 0.5) / 0.5; + float d = forward(uvn); +#elif UI_BACK + float2 uvn = (i.uv.xy - 0.5) / 0.5; + float d = forward(float2(-uvn.x, uvn.y)); +#elif UI_CC + float2 uvn = (i.uv.xy - 0.5) / 0.5; + float d = ccbutton(uvn); +#elif UI_OPTIONS + float2 uvn = (i.uv.xy - 0.5) / 0.5; + float d = optionsgear(uvn, 0.75, 0.75, 0.35, 0.25); +#endif + + return getColorWithOutline(d, float3(1.0, 1.0, 1.0), float3(0.0, 0.0, 0.0)) * i.color; +#endif + } + ENDCG + } + } +} diff --git a/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI.shader.meta b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI.shader.meta new file mode 100644 index 0000000..0e73a49 --- /dev/null +++ b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 8b83f1522b53ad44a9a271e7db8aa527 +timeCreated: 1546682502 +licenseType: Store +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AVProVideo/Demos/Common/MediaPlayerUI/OptionsAudioTrackPage.cs b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/OptionsAudioTrackPage.cs new file mode 100644 index 0000000..9b0cb15 --- /dev/null +++ b/Assets/AVProVideo/Demos/Common/MediaPlayerUI/OptionsAudioTrackPage.cs @@ -0,0 +1,179 @@ +using RenderHeads.Media.AVProVideo; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; + +public class OptionsAudioTrackPage : MonoBehaviour +{ + [Header("Media Player")] + [SerializeField] private MediaPlayer _MediaPlayer; + + [Header("Options Menu")] + [SerializeField] private OptionsMenu _OptionsMenu; + + [Header("Content")] + [SerializeField] private Transform _Content; + [SerializeField] private RectTransform _ScrollViewRectTransform; + [SerializeField] private RectTransform _ViewportRectTransform; + [SerializeField] private GameObject _AudioTrackLinePrefab; + + + private string m_SetupForAudioPath; + + + private class CAudioTrackSet + { + public GameObject m_LineGO = null; + } + private List m_lAudioTrackSets = new List(); + + + void Start() + { + UpdateSets(); + } + + void Update() + { + UpdateSets(); + } + + private void AddAudioTrackSet( string title, bool bEnabled ) + { + GameObject newLineGO = GameObject.Instantiate( _AudioTrackLinePrefab, _Content ); + if( newLineGO != null ) + { + // Setup text + Transform titleTransform = newLineGO.transform.Find( "TitleText" ); + Text titleText = ( titleTransform != null ) ? titleTransform.GetComponent() : null; + if( titleText != null ) + { + titleText.text = title; + } + + // Tick icon + if( bEnabled ) + { + Transform tickIconTransform = newLineGO.transform.Find( "TickIcon" ); + Image tickIconImage = ( tickIconTransform != null ) ? tickIconTransform.GetComponent() : null; + if( tickIconImage != null ) + { + tickIconImage.enabled = true; + } + } + + // On click + if( _OptionsMenu ) + { + Button button = newLineGO.GetComponent