public override StartCommandResult OnStartCommand(Intent intent, StartCommandFlags flags, int startId) { switch (intent?.Action) { case ActionPlay: Play(); break; case ActionStop: Stop(); break; case ActionPause: Pause(); break; case ActionNext: SkipToNext(null); break; case ActionPrevious: SkipToPrev(); break; case ActionLoadUrl: LoadVideoFromUrl(intent); break; case ActionBkgrdNote: ToggleNotificationShouldPlayInBkgrd(true); break; case ActionResumeNote: ToggleNotificationShouldPlayInBkgrd(false); break; } try{ WifiManager = (WifiManager)GetSystemService(Context.WifiService); } catch { } ExtStickyServ = this; try { Pm = (PowerManager)GetSystemService(Context.PowerService); PowerManager.WakeLock _wl = Pm.NewWakeLock(WakeLockFlags.Partial, "BitChute Wakelock"); _wl.Acquire(); } catch (Exception ex) { Console.WriteLine(ex.Message); } return(StartCommandResult.Sticky); }
public async void AwaitMinimizedInBackground() { while (TotalWebViewsMovingIntoBackground > 0) { await Task.Delay(50); this.LoadUrl(JavascriptCommands._jsPlayVideo); } await Task.Delay(50); PlaystateManagement.WebViewPlayerNumberIsStreaming = this.Id; PlaystateManagement.WebViewPlayerIsStreaming = true; if (AppState.ForeNote == null) { MainPlaybackSticky.StartForeground(BitChute.ExtNotifications.BuildPlayControlNotification()); } ViewHelpers.DoActionOnUiThread(() => { this.LoadUrl(JavascriptCommands._jsPlayVideo); }); await Task.Delay(100); ViewHelpers.DoActionOnUiThread(() => { this.LoadUrl(JavascriptCommands._jsPlayVideo); }); }
public override void OnCreate() { PlaystateChanged += OnPlaystateChanged; ExtStickyServ = this; base.OnCreate(); //Find our audio and notificaton managers AudioMan = (AudioManager)GetSystemService(AudioService); WifiManager = (WifiManager)GetSystemService(WifiService); }