public Task Initialize(object o = null) { return(DispatchHelper.InvokeAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { var param = new List <string> { "-I", "dummy", "--no-osd", "--verbose=3", "--no-stats", "--avcodec-fast", string.Format("--freetype-font={0}\\NotoSans-Regular.ttf", Windows.ApplicationModel.Package.Current.InstalledLocation.Path), "--subsdec-encoding", Locator.SettingsVM.SubtitleEncodingValue == "System" ? "" : Locator.SettingsVM.SubtitleEncodingValue }; // So far, this NEEDS to be called from the main thread try { Instance = new Instance(param, App.RootPage.SwapChainPanel); Instance?.setDialogHandlers( async(title, text) => { await DispatchHelper.InvokeAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() => await DialogHelper.DisplayDialog(title, text)); }, async(dialog, title, text, defaultUserName, askToStore) => { await DispatchHelper.InvokeAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() => await DialogHelper.DisplayDialog(title, text, dialog, defaultUserName, askToStore)); }, async(dialog, title, text, qType, cancel, action1, action2) => { await DispatchHelper.InvokeAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() => await DialogHelper.DisplayDialog(title, text, dialog, qType, cancel, action1, action2)); }, (dialog, title, text, intermidiate, position, cancel) => { }, (dialog) => dialog.dismiss(), (dialog, position, text) => { }); PlayerInstanceReady.TrySetResult(Instance != null); } catch (Exception e) { LogHelper.Log("VLC Service : Couldn't create VLC Instance\n" + StringsHelper.ExceptionToString(e)); ToastHelper.Basic(Strings.FailStartVLCEngine); } })); }
public Task Initialize() { return(DispatchHelper.InvokeInUIThread(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { var param = new List <string> { "-I", "dummy", "--no-osd", "--verbose=3", "--no-stats", "--avcodec-fast", "--subsdec-encoding", Locator.SettingsVM.SubtitleEncodingValue == "System" ? "" : Locator.SettingsVM.SubtitleEncodingValue, DeviceHelper.GetDeviceType() == DeviceTypeEnum.Phone ? "--deinterlace-mode=bob" : string.Empty, "--aout=winstore", string.Format("--keystore-file={0}\\keystore", ApplicationData.Current.LocalFolder.Path), }; // So far, this NEEDS to be called from the main thread try { App.RootPage.SwapChainPanel.CompositionScaleChanged += SwapChainPanel_CompositionScaleChanged; App.RootPage.SwapChainPanel.SizeChanged += SwapChainPanel_SizeChanged; Instance = new Instance(param, App.RootPage.SwapChainPanel); Instance?.setDialogHandlers( async(title, text) => await _dialogService.ShowErrorDialog(title, text), async(dialog, title, text, defaultUserName, askToStore) => await _dialogService.ShowLoginDialog(dialog, title, text, defaultUserName, askToStore), async(dialog, title, text, qType, cancel, action1, action2) => await _dialogService.ShowQuestionDialog(dialog, title, text, qType, cancel, action1, action2), (dialog, title, text, intermidiate, position, cancel) => { }, async(dialog) => await _dialogService.CancelCurrentDialog(), (dialog, position, text) => { } ); // Audio device management also needs to be called from the main thread MediaDevice.DefaultAudioRenderDeviceChanged += onDefaultAudioRenderDeviceChanged; PlayerInstanceReady.TrySetResult(Instance != null); } catch (Exception e) { LogHelper.Log("VLC Service : Couldn't create VLC Instance\n" + StringsHelper.ExceptionToString(e)); ToastHelper.Basic(Strings.FailStartVLCEngine); } })); }
public void Initialize(object panel) { var swapchain = panel as SwapChainPanel; if (swapchain == null) { throw new ArgumentNullException("panel", "VLCService needs a SwapChainpanel"); } var param = new List <String>() { "-I", "dummy", "--no-osd", "--verbose=3", "--no-stats", "--avcodec-fast", String.Format("--freetype-font={0}\\segoeui.ttf", Windows.ApplicationModel.Package.Current.InstalledLocation.Path) }; // So far, this NEEDS to be called from the main thread Instance = new Instance(param, swapchain); PlayerInstanceReady.SetResult(true); }
public Task Initialize(object o = null) { return(DispatchHelper.InvokeAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { var param = new List <string> { "-I", "dummy", "--no-osd", "--verbose=3", "--no-stats", "--avcodec-fast", string.Format("--freetype-font={0}\\NotoSans-Regular.ttf", Windows.ApplicationModel.Package.Current.InstalledLocation.Path), "--subsdec-encoding", Locator.SettingsVM.SubtitleEncodingValue == "System" ? "" : Locator.SettingsVM.SubtitleEncodingValue, "--aout=winstore", string.Format("--keystore-file={0}\\keystore", ApplicationData.Current.LocalFolder.Path), }; // So far, this NEEDS to be called from the main thread try { Instance = new Instance(param, App.RootPage.SwapChainPanel); Instance?.setDialogHandlers( async(title, text) => { await DispatchHelper.InvokeAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() => { await VLCDialog.WaitForDialogLock(); CurrentDialog = new VLCDialog(title, text); await CurrentDialog.ShowAsync(); }); }, async(dialog, title, text, defaultUserName, askToStore) => { await DispatchHelper.InvokeAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() => { await VLCDialog.WaitForDialogLock(); CurrentDialog = new VLCDialog(title, text, dialog, defaultUserName, askToStore); await CurrentDialog.ShowAsync(); }); }, async(dialog, title, text, qType, cancel, action1, action2) => { await DispatchHelper.InvokeAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() => { if (qType == Question.warning) { dialog.postAction(1); return; } await VLCDialog.WaitForDialogLock(); CurrentDialog = new VLCDialog(title, text, dialog, qType, cancel, action1, action2); await CurrentDialog.ShowAsync(); }); }, (dialog, title, text, intermidiate, position, cancel) => { }, async(dialog) => { await DispatchHelper.InvokeAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => CurrentDialog.Cancel()); }, (dialog, position, text) => { }); // Audio device management also needs to be called from the main thread AudioClient = new AudioDeviceHandler(AudioDeviceID); MediaDevice.DefaultAudioRenderDeviceChanged += onDefaultAudioRenderDeviceChanged; PlayerInstanceReady.TrySetResult(Instance != null); } catch (Exception e) { LogHelper.Log("VLC Service : Couldn't create VLC Instance\n" + StringsHelper.ExceptionToString(e)); ToastHelper.Basic(Strings.FailStartVLCEngine); } })); }