/// <summary> /// Generate Parent /// </summary> public void GenerateParent() { this.transform.gameObject.name = "BattlePhaze Video Player"; VideoPlayer = this.gameObject.GetOrAddComponent <VRC_SyncVideoStream>(); VRC_ObjectSync VideoSync = this.gameObject.GetOrAddComponent <VRC_ObjectSync>(); VideoPlayer.AutoStart = AutoStart; VideoPlayer.AllowNonOwnerControl = AllowNonOwnerControl; VideoPlayer.videoTextureFormat = VideoTextureFormat; VideoPlayer.Videos = null; VideoPlayer.Videos = BattlePhazeVideoEntry.ToArray(); VideoPlayer.MaxStreamQuality = MaxStreamQuality; }
private void applyPlaylist() { savePlaylist(); try { if (videoPlayers[videoPlayerSelected].GetComponent <VRC_SyncVideoPlayer>()) { VRC_SyncVideoPlayer videoPlayer = videoPlayers[videoPlayerSelected].GetComponent <VRC_SyncVideoPlayer>(); videoPlayer.Videos = null; List <VRC_SyncVideoPlayer.VideoEntry> videos = new List <VRC_SyncVideoPlayer.VideoEntry>(); string[] links = selectedPlaylist.Contents.Split(new[] { '\r', '\n' }); foreach (string link in links) { VRC_SyncVideoPlayer.VideoEntry tmp = new VRC_SyncVideoPlayer.VideoEntry { Source = UnityEngine.Video.VideoSource.Url, PlaybackSpeed = 1.0f, AspectRatio = UnityEngine.Video.VideoAspectRatio.FitInside, URL = link }; videos.Add(tmp); } videoPlayer.Videos = videos.ToArray(); } if (videoPlayers[videoPlayerSelected].GetComponent <VRC_SyncVideoStream>()) { VRC_SyncVideoStream videoPlayer = videoPlayers[videoPlayerSelected].GetComponent <VRC_SyncVideoStream>(); videoPlayer.Videos = null; List <VRC_SyncVideoStream.VideoEntry> videos = new List <VRC_SyncVideoStream.VideoEntry>(); string[] links = selectedPlaylist.Contents.Split(new[] { '\r', '\n' }); foreach (string link in links) { VRC_SyncVideoStream.VideoEntry tmp = new VRC_SyncVideoStream.VideoEntry { Source = UnityEngine.Video.VideoSource.Url, PlaybackSpeed = 1.0f, URL = link }; videos.Add(tmp); } videoPlayer.Videos = videos.ToArray(); } ShowNotification(new GUIContent(notification)); } catch (Exception ex) { Debug.LogError(ex); ShowNotification(new GUIContent("Could not create playlist")); } }