protected async override void OnNavigatedTo(NavigationEventArgs e) { App.Current.Suspending += Current_Suspending; App.Current.Resuming += Current_Resuming; Window.Current.Activated += Current_Activated; //get the HLS plugin from the PF player _hlsplugin = mePlayer.Plugins.FirstOrDefault(p => p is HLSPlugin) as HLSPlugin; _hlsplugin.ClosedCaptionType = ClosedCaptionType.CC608Instream; //get the controller factory _controllerFactory = _hlsplugin.ControllerFactory; //subscribe to HLSControllerReady _controllerFactory.HLSControllerReady += _controllerFactory_HLSControllerReady; _timerPlaybackControlDisplay.Tick += _timerPlaybackControlDisplay_Tick; _settingsData.PropertyChanged += _settingsData_PropertyChanged; ucHLSSettings.DataContext = _settingsData; btnFavorites_Click(null, null); _windowRect = ApplicationView.GetForCurrentView().VisibleBounds; _settingsData.MaximumBitrate = CalcMaxBitrate(); ////await the background task await StartBackgroundTask(); }
void _controllerFactory_HLSControllerReady(IHLSControllerFactory sender, IHLSController args) { _controller = args; ApplySettings(); if (_controller.Playlist != null) { _controller.Playlist.StreamSelectionChanged += Playlist_StreamSelectionChanged; } Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { try { if (_controller != null && _controller.IsValid) { ucPlaybackInfoOverlay.Initialize(mePlayer, _controller); } } catch (Exception Ex) { } }); }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); //get the HLS plugin from the PF player var hlsplugin = mediaplayer.Plugins.Where(p => p is HLSPlugin).FirstOrDefault(); //get the controller factory _controllerfactory = (hlsplugin as HLSPlugin).ControllerFactory; //subscribe to HLSControllerReady _controllerfactory.HLSControllerReady += _controllerfactory_HLSControllerReady; //do this only if you need to modify URL or headers or cookies //_controllerfactory.PrepareResourceRequest += _controllerfactory_PrepareResourceRequest; ucHLSSettings.Player = mediaplayer; ucMetadataUI.Player = mediaplayer; ucUnprocessedTagsUI.Player = mediaplayer; this.TopAppBar.IsOpen = true; }
void _controllerfactory_HLSControllerReady(IHLSControllerFactory sender, IHLSController args) { //save the controller _controller = args; //playing a batch ? if (_batch != null) { _controller.BatchPlaylists(_batch.Select(u => { return(u.AbsoluteUri); }).ToList()); } if (_controller.Playlist != null) { _controller.Playlist.StreamSelectionChanged += Playlist_StreamSelectionChanged; _controller.Playlist.SegmentSwitched += Playlist_SegmentSwitched; } _controller.PrepareResourceRequest += _controller_PrepareResourceRequest; _controller.InitialBitrateSelected += _controller_InitialBitrateSelected; Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { gridAudioOnly.Visibility = Visibility.Collapsed; try { if (_controller.IsValid) { ucPlaybackStatus.Initialize(_controller, mediaplayer); ucHLSSettings.Controller = _controller; ucMetadataUI.Controller = _controller; ucUnprocessedTagsUI.Controller = _controller; } } catch (Exception Ex) { } }).AsTask().Wait(); }
void _controllerfactory_HLSControllerReady(IHLSControllerFactory sender, IHLSController args) { //save the controller _controller = args; //playing a batch ? if (_batch != null) { _controller.BatchPlaylists(_batch.Select(u => { return u.AbsoluteUri; }).ToList()); } if (_controller.Playlist != null) { _controller.Playlist.StreamSelectionChanged += Playlist_StreamSelectionChanged; _controller.Playlist.SegmentSwitched += Playlist_SegmentSwitched; } _controller.PrepareResourceRequest += _controller_PrepareResourceRequest; _controller.InitialBitrateSelected += _controller_InitialBitrateSelected; Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { gridAudioOnly.Visibility = Visibility.Collapsed; try { if (_controller.IsValid) { ucPlaybackStatus.Initialize(_controller, mediaplayer); ucHLSSettings.Controller = _controller; ucMetadataUI.Controller = _controller; ucUnprocessedTagsUI.Controller = _controller; } } catch (Exception Ex) { } }).AsTask().Wait(); }
void _controllerfactory_PrepareResourceRequest(IHLSControllerFactory sender, IHLSResourceRequestEventArgs args) { //add code to modify initial root playlist HTTP request if needed args.Submit(); }
void _controllerFactory_HLSControllerReady(IHLSControllerFactory sender, IHLSController args) { _controller = args; ApplySettings(); if (_controller.Playlist != null) { _controller.Playlist.StreamSelectionChanged += Playlist_StreamSelectionChanged; } Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { try { if (_controller != null && _controller.IsValid) ucPlaybackInfoOverlay.Initialize(mePlayer, _controller); } catch (Exception Ex) { } }); }