void AdaptiveSrcManager_ManifestReadyEvent(AdaptiveSource sender, ManifestReadyEventArgs args) { lock (adaptiveSourceLock) { if (IsOpen && ActiveAdaptiveSource == args.AdaptiveSource) { IsLive = ActiveAdaptiveSource.Manifest.IsLive; UpdateSelectedTracks(StartupBitrate); AvailableAudioStreams = ActiveAdaptiveSource.Manifest.AvailableStreams.Where(IsAudioStream).Select(s => new AdaptiveAudioStream(s)).ToList(); AvailableCaptionStreams = ActiveAdaptiveSource.Manifest.AvailableStreams.Where(IsCaptionStream).Select(s => new AdaptiveCaptionStream(s)).ToList(); RunOnProtectedUIThread(() => { if (ManifestReady != null) { ManifestReady(this, EventArgs.Empty); } }); StartTime = (long)args.AdaptiveSource.Manifest.StartTime; EndTime = StartTime + args.AdaptiveSource.Manifest.Duration; LivePosition = EndTime; RunOnProtectedUIThread(() => { if (TimesChanged != null) { TimesChanged(this, EventArgs.Empty); } }); } } }
void source_ManifestReadyEvent(AdaptiveSource sender, ManifestReadyEventArgs args) { var videoStream = VideoStream; var bitrates = videoStream.AvailableTracks.Select(t => t.Bitrate).ToList(); MinBitrate = bitrates.Min(); MaxBitrate = bitrates.Max(); }
private async void SmoothStreamingManager_ManifestReadyEvent(AdaptiveSource sender, ManifestReadyEventArgs args) { // Retrieve the ManifestCache from the MediaCache if (this.IsAssetInCache(sender.Uri)) { // Select the Audio Stream List<Microsoft.Media.AdaptiveStreaming.IManifestStream> listStream = args.AdaptiveSource.Manifest.AvailableStreams.Where(t => (t.Type == MediaStreamType.Video)).ToList(); ; if (listStream!=null) { int audioIndex = 0; int selectedAudioIndex = this.GetSelectedAudioTrackIndex(sender.Uri); foreach (var stream in args.AdaptiveSource.Manifest.AvailableStreams) { if (stream.Type == Microsoft.Media.AdaptiveStreaming.MediaStreamType.Audio) { if ((selectedAudioIndex == -1)||(selectedAudioIndex == audioIndex)) { listStream.Add(stream); await args.AdaptiveSource.Manifest.SelectStreamsAsync(listStream); break; } } } } // Select the video track with the expected bitrate foreach (var stream in args.AdaptiveSource.Manifest.SelectedStreams) { if (stream.Type == Microsoft.Media.AdaptiveStreaming.MediaStreamType.Video) { // Restrict the bitrate to the cached bitrate // Select the bitrate of the track which has been downloaded IReadOnlyList<Microsoft.Media.AdaptiveStreaming.IManifestTrack> list = stream.AvailableTracks.Where(t => (t.Bitrate == this.GetVideoBitrate(sender.Uri))).ToList(); if ((list != null) && (list.Count > 0)) stream.RestrictTracks(list); } } } }
private void mediaElement_ManifestReady(AdaptiveSource sender, ManifestReadyEventArgs args) { adaptiveSource = args.AdaptiveSource; manifestObject = args.AdaptiveSource.Manifest; }