private void SetActiveTrack(TrackCollection collection, TrackBase track) { // Check if this is already the active track if (collection.IsActiveTrack(track)) { return; } // Convert from TextTrack to uid int trackUid = -1; if (track != null) { trackUid = track.Uid; } // Set track based on uid (-1 is no active track) // NOTE: TrackType is pulled from collection as track may be null if (InternalSetActiveTrack(collection.TrackType, trackUid)) { collection.SetActiveTrack(track); switch (collection.TrackType) { case TrackType.Text: UpdateTextCue(force: true); break; } } }
private void PopulateTrackCollection(TrackCollection collection) { collection.Clear(); int trackCount = InternalGetTrackCount(collection.TrackType); for (int i = 0; i < trackCount; i++) { bool isActiveTrack = false; TrackBase track = InternalGetTrackInfo(collection.TrackType, i, ref isActiveTrack); if (track != null) { collection.Add(track); if (isActiveTrack) { collection.SetActiveTrack(track); } } else { UnityEngine.Debug.LogWarning(string.Format("[AVProVideo] Failed to enumerate {0} track {1} ", collection.TrackType, i)); } } }