Exemplo n.º 1
0
        /// <summary>
        /// Select the first CEA708 track we find.
        /// </summary>
        private void SubtitleTracksFound(Dictionary <long, MLMediaPlayer.TrackData> tracks)
        {
            _subtitleTracksCache = tracks;
            if (_selectedTrackID < 0)
            {
                foreach (MLMediaPlayer.TrackData track in tracks.Values)
                {
                    if (track.MimeType == MLMediaPlayer.MimeTypeTextCEA708)
                    {
                        if (_forceTrackSelection && track.ID != _forceSelectTrackID)
                        {
                            // If track selecting is enforced, skip all but the desired track
                            continue;
                        }

                        MLResult result = _mediaPlayer.SelectSubtitleTrack(track.ID);
                        if (result.IsOk)
                        {
                            _selectedTrackID = (int)track.ID;
                            Debug.LogFormat("CEA708 track {0} selected.", _selectedTrackID);
                            break;
                        }
                        else
                        {
                            Debug.LogErrorFormat("Error: MLMediaPlayerCEA708Parser.SubtitleTracksFound Failed to select CEA708 track {0}. Result: {1}", _selectedTrackID, result);
                        }
                    }
                }
            }
        }
 /// <summary>
 /// Select the first CEA708 track we find.
 /// </summary>
 private void SubtitleTracksFound(Dictionary <long, MLMediaPlayer.TrackData> tracks)
 {
     _subtitleTracksCache = tracks;
     if (_selectedTrackID < 0)
     {
         foreach (MLMediaPlayer.TrackData track in tracks.Values)
         {
             if (track.MimeType == MLMediaPlayer.MimeTypeTextCEA708 && track.ID == 3)
             {
                 MLResult result = _mediaPlayer.SelectSubtitleTrack(track.ID);
                 if (result.IsOk)
                 {
                     _selectedTrackID = (int)track.ID;
                     Debug.LogFormat("CEA708 track {0} selected.", _selectedTrackID);
                     break;
                 }
                 else
                 {
                     Debug.LogErrorFormat("Error: MLMediaPlayerCEA708Parser.SubtitleTracksFound Failed to select CEA708 track {0}. Result: {1}", _selectedTrackID, result);
                 }
             }
         }
     }
 }