diff --git a/Viagg-io/Assets/AVProVideo.meta b/Viagg-io/Assets/AVProVideo.meta new file mode 100644 index 0000000..3c0f183 --- /dev/null +++ b/Viagg-io/Assets/AVProVideo.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ab0523a11fe344a11985891d8445c46f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Viagg-io/Assets/AVProVideo/Demos.meta b/Viagg-io/Assets/AVProVideo/Demos.meta new file mode 100644 index 0000000..04f6029 --- /dev/null +++ b/Viagg-io/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/Viagg-io/Assets/AVProVideo/Demos/Common.meta b/Viagg-io/Assets/AVProVideo/Demos/Common.meta new file mode 100644 index 0000000..3e8c61f --- /dev/null +++ b/Viagg-io/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/Viagg-io/Assets/Packages/AVProVideo/Demos/Common/Demo-360.mat b/Viagg-io/Assets/AVProVideo/Demos/Common/Demo-360.mat old mode 100755 new mode 100644 similarity index 100% rename from Viagg-io/Assets/Packages/AVProVideo/Demos/Common/Demo-360.mat rename to Viagg-io/Assets/AVProVideo/Demos/Common/Demo-360.mat diff --git a/Viagg-io/Assets/AVProVideo/Demos/Common/Demo-360.mat.meta b/Viagg-io/Assets/AVProVideo/Demos/Common/Demo-360.mat.meta new file mode 100644 index 0000000..6fcee8e --- /dev/null +++ b/Viagg-io/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/Viagg-io/Assets/Packages/AVProVideo/Demos/Common/Demo-Cube.mat b/Viagg-io/Assets/AVProVideo/Demos/Common/Demo-Cube.mat old mode 100755 new mode 100644 similarity index 100% rename from Viagg-io/Assets/Packages/AVProVideo/Demos/Common/Demo-Cube.mat rename to Viagg-io/Assets/AVProVideo/Demos/Common/Demo-Cube.mat diff --git a/Viagg-io/Assets/AVProVideo/Demos/Common/Demo-Cube.mat.meta b/Viagg-io/Assets/AVProVideo/Demos/Common/Demo-Cube.mat.meta new file mode 100644 index 0000000..5ba3d70 --- /dev/null +++ b/Viagg-io/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/Viagg-io/Assets/Packages/AVProVideo/Demos/Common/Demo-Skybox.mat b/Viagg-io/Assets/AVProVideo/Demos/Common/Demo-Skybox.mat old mode 100755 new mode 100644 similarity index 100% rename from Viagg-io/Assets/Packages/AVProVideo/Demos/Common/Demo-Skybox.mat rename to Viagg-io/Assets/AVProVideo/Demos/Common/Demo-Skybox.mat diff --git a/Viagg-io/Assets/AVProVideo/Demos/Common/Demo-Skybox.mat.meta b/Viagg-io/Assets/AVProVideo/Demos/Common/Demo-Skybox.mat.meta new file mode 100644 index 0000000..06186ba --- /dev/null +++ b/Viagg-io/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/Viagg-io/Assets/Packages/AVProVideo/Demos/Common/LookAround360.cs b/Viagg-io/Assets/AVProVideo/Demos/Common/LookAround360.cs old mode 100755 new mode 100644 similarity index 100% rename from Viagg-io/Assets/Packages/AVProVideo/Demos/Common/LookAround360.cs rename to Viagg-io/Assets/AVProVideo/Demos/Common/LookAround360.cs diff --git a/Viagg-io/Assets/AVProVideo/Demos/Common/LookAround360.cs.meta b/Viagg-io/Assets/AVProVideo/Demos/Common/LookAround360.cs.meta new file mode 100644 index 0000000..4b20340 --- /dev/null +++ b/Viagg-io/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/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI.meta b/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI.meta new file mode 100644 index 0000000..fceb7ff --- /dev/null +++ b/Viagg-io/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/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/AudioTrackLine.prefab b/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/AudioTrackLine.prefab new file mode 100644 index 0000000..44be2bd --- /dev/null +++ b/Viagg-io/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/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/AudioTrackLine.prefab.meta b/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/AudioTrackLine.prefab.meta new file mode 100644 index 0000000..c0a521c --- /dev/null +++ b/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/AudioTrackLine.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: a4d6a235b924028458c2acce3d42cdc4 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Viagg-io/Assets/Packages/AVProVideo/Demos/Common/MediaPlayerUI/BackingGradient.png b/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/BackingGradient.png old mode 100755 new mode 100644 similarity index 100% rename from Viagg-io/Assets/Packages/AVProVideo/Demos/Common/MediaPlayerUI/BackingGradient.png rename to Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/BackingGradient.png diff --git a/Viagg-io/Assets/Packages/AVProVideo/Demos/Common/MediaPlayerUI/BackingGradient.png.meta b/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/BackingGradient.png.meta old mode 100755 new mode 100644 similarity index 100% rename from Viagg-io/Assets/Packages/AVProVideo/Demos/Common/MediaPlayerUI/BackingGradient.png.meta rename to Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/BackingGradient.png.meta diff --git a/Viagg-io/Assets/Packages/AVProVideo/Demos/Common/MediaPlayerUI/HorizontalSegmentsPrimitive.cs b/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/HorizontalSegmentsPrimitive.cs old mode 100755 new mode 100644 similarity index 100% rename from Viagg-io/Assets/Packages/AVProVideo/Demos/Common/MediaPlayerUI/HorizontalSegmentsPrimitive.cs rename to Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/HorizontalSegmentsPrimitive.cs diff --git a/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/HorizontalSegmentsPrimitive.cs.meta b/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/HorizontalSegmentsPrimitive.cs.meta new file mode 100644 index 0000000..5dfbc01 --- /dev/null +++ b/Viagg-io/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/Viagg-io/Assets/Packages/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-AudioSpectrum.mat b/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-AudioSpectrum.mat old mode 100755 new mode 100644 similarity index 100% rename from Viagg-io/Assets/Packages/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-AudioSpectrum.mat rename to Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-AudioSpectrum.mat diff --git a/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-AudioSpectrum.mat.meta b/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-AudioSpectrum.mat.meta new file mode 100644 index 0000000..9f35d39 --- /dev/null +++ b/Viagg-io/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/Viagg-io/Assets/Packages/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Buffering.mat b/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Buffering.mat old mode 100755 new mode 100644 similarity index 100% rename from Viagg-io/Assets/Packages/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Buffering.mat rename to Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Buffering.mat diff --git a/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Buffering.mat.meta b/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Buffering.mat.meta new file mode 100644 index 0000000..00fc67d --- /dev/null +++ b/Viagg-io/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/Viagg-io/Assets/Packages/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-CC.mat b/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-CC.mat old mode 100755 new mode 100644 similarity index 100% rename from Viagg-io/Assets/Packages/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-CC.mat rename to Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-CC.mat diff --git a/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-CC.mat.meta b/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-CC.mat.meta new file mode 100644 index 0000000..2625177 --- /dev/null +++ b/Viagg-io/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/Viagg-io/Assets/Packages/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Circle.mat b/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Circle.mat old mode 100755 new mode 100644 similarity index 100% rename from Viagg-io/Assets/Packages/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Circle.mat rename to Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Circle.mat diff --git a/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Circle.mat.meta b/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Circle.mat.meta new file mode 100644 index 0000000..5a0975d --- /dev/null +++ b/Viagg-io/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/Viagg-io/Assets/Packages/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Feedback.mat b/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Feedback.mat old mode 100755 new mode 100644 similarity index 100% rename from Viagg-io/Assets/Packages/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Feedback.mat rename to Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Feedback.mat diff --git a/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Feedback.mat.meta b/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Feedback.mat.meta new file mode 100644 index 0000000..2138d7a --- /dev/null +++ b/Viagg-io/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/Viagg-io/Assets/Packages/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-NavBack.mat b/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-NavBack.mat old mode 100755 new mode 100644 similarity index 100% rename from Viagg-io/Assets/Packages/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-NavBack.mat rename to Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-NavBack.mat diff --git a/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-NavBack.mat.meta b/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-NavBack.mat.meta new file mode 100644 index 0000000..694d89a --- /dev/null +++ b/Viagg-io/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/Viagg-io/Assets/Packages/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-NavForward.mat b/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-NavForward.mat old mode 100755 new mode 100644 similarity index 100% rename from Viagg-io/Assets/Packages/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-NavForward.mat rename to Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-NavForward.mat diff --git a/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-NavForward.mat.meta b/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-NavForward.mat.meta new file mode 100644 index 0000000..ff5ed1e --- /dev/null +++ b/Viagg-io/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/Viagg-io/Assets/Packages/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Options.mat b/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Options.mat old mode 100755 new mode 100644 similarity index 100% rename from Viagg-io/Assets/Packages/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Options.mat rename to Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Options.mat diff --git a/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Options.mat.meta b/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Options.mat.meta new file mode 100644 index 0000000..40025ed --- /dev/null +++ b/Viagg-io/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/Viagg-io/Assets/Packages/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-PlayPause.mat b/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-PlayPause.mat old mode 100755 new mode 100644 similarity index 100% rename from Viagg-io/Assets/Packages/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-PlayPause.mat rename to Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-PlayPause.mat diff --git a/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-PlayPause.mat.meta b/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-PlayPause.mat.meta new file mode 100644 index 0000000..8e0945f --- /dev/null +++ b/Viagg-io/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/Viagg-io/Assets/Packages/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Volume.mat b/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Volume.mat old mode 100755 new mode 100644 similarity index 100% rename from Viagg-io/Assets/Packages/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Volume.mat rename to Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Volume.mat diff --git a/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Volume.mat.meta b/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI-Volume.mat.meta new file mode 100644 index 0000000..8def2b1 --- /dev/null +++ b/Viagg-io/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/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI.cs b/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI.cs new file mode 100644 index 0000000..121c432 --- /dev/null +++ b/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI.cs @@ -0,0 +1,1200 @@ +// 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) + +#define SHOW_TRACK_INFO_IN_DEBUG_VIEW + +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; +using UnityEngine.EventSystems; +using RenderHeads.Media.AVProVideo; +using RenderHeads.Media.AVProVideo.Demos.UI; + +//----------------------------------------------------------------------------- +// Copyright 2018-2021 RenderHeads Ltd. All rights reserved. +//----------------------------------------------------------------------------- + +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"); + + void Awake() + { +#if UNITY_IOS || UNITY_ANDROID + Debug.Log("Setting Application.targetFrameRate to: " + Screen.currentResolution.refreshRate); + Application.targetFrameRate = Screen.currentResolution.refreshRate; +#endif + } + + void Start() + { + if (_mediaPlayer) + { + _audioVolume = _mediaPlayer.AudioVolume; + #if UNITY_ANDROID + // 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 + 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 + 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 !UNITY_IOS || UNITY_EDITOR + if (_mediaPlayer && _mediaPlayer.Control != null) + { + AudioSource audioSource = _mediaPlayer.AudioSource; + if (audioSource && _audioSpectrumMaterial) + { + 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.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; + + 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(); + } + } +} +#endif \ No newline at end of file diff --git a/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI.cs.meta b/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI.cs.meta new file mode 100644 index 0000000..06c4dd1 --- /dev/null +++ b/Viagg-io/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/Viagg-io/Assets/Packages/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI.mat b/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI.mat old mode 100755 new mode 100644 similarity index 100% rename from Viagg-io/Assets/Packages/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI.mat rename to Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI.mat diff --git a/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI.mat.meta b/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI.mat.meta new file mode 100644 index 0000000..9f6dc8f --- /dev/null +++ b/Viagg-io/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/Viagg-io/Assets/Packages/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI.shader b/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI.shader old mode 100755 new mode 100644 similarity index 100% rename from Viagg-io/Assets/Packages/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI.shader rename to Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI.shader diff --git a/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI.shader.meta b/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/MediaPlayerUI.shader.meta new file mode 100644 index 0000000..0e73a49 --- /dev/null +++ b/Viagg-io/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/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/OptionsAudioTrackPage.cs b/Viagg-io/Assets/AVProVideo/Demos/Common/MediaPlayerUI/OptionsAudioTrackPage.cs new file mode 100644 index 0000000..bc9bd6f --- /dev/null +++ b/Viagg-io/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