public void PlayVlc(List <string> url, List <string> name, string subtitleLoc) { try { MainDroid.OpenPathsAsVideo(url, name, subtitleLoc); } catch (Exception) { CloudStreamForms.App.OpenBrowser(url.First()); } }
public void PlayVlc(string url, string name, string subtitleLoc) { try { MainDroid.OpenPathAsVideo(url, name, subtitleLoc); } catch (Exception) { CloudStreamForms.App.OpenBrowser(url); } }
#pragma warning restore CS0162, IDE0060 // Unreachable code detected /* * private static void TaskSchedulerOnUnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs unobservedTaskExceptionEventArgs) * { * var newExc = new Exception("TaskSchedulerOnUnobservedTaskException", unobservedTaskExceptionEventArgs.Exception); * App.ShowNotification("Error", newExc.Message); * }*/ public void Killed() { // App.ShowToast("KILLED"); //ShowNotification("finish", "Yeet"); #if DEBUG EndDebugging(); #endif MainDroid.CancelChromecast(); // TO REMOVE IT, CANT INTERACT WITHOUT THE CORE DownloadHandle.OnKilled(); App.OnAppKilled?.Invoke(null, EventArgs.Empty); }
protected override void OnCreate(Bundle savedInstanceState) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; Window window = this.Window; window.AddFlags(WindowManagerFlags.Fullscreen); // REMOVES STATUS BAR base.OnCreate(savedInstanceState); string data = Intent?.Data?.EncodedAuthority; try { MainPage.intentData = data; } catch (Exception) { } // int intHeight = (int)(Resources.DisplayMetrics.HeightPixels / Resources.DisplayMetrics.Density); //int intWidth = (int)(Resources.DisplayMetrics.WidthPixels / Resources.DisplayMetrics.Density); Xamarin.Essentials.Platform.Init(this, savedInstanceState); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); FFImageLoading.Forms.Platform.CachedImageRenderer.Init(enableFastRenderer: true); Rg.Plugins.Popup.Popup.Init(this, savedInstanceState); UserDialogs.Init(this); LocalNotificationsImplementation.NotificationIconId = Resource.Drawable.bicon; LoadApplication(new App()); activity = this; mainDroid = new MainDroid(); mainDroid.Awake(); if (Intent.DataString != null) { if (Intent.DataString != "") { MainPage.PushPageFromUrlAndName(Intent.DataString); } } RequestPermission(this); }
protected override void OnCreate(Bundle savedInstanceState) { LogFile($"============================== ON CREATE AT {UnixTime} =============================="); print("ON CREATED:::::!!!!!!!!!"); CreateMediaSession(); try { SetTheme(Resource.Style.MainTheme_NonSplash); LogFile("SetTheme Done"); PublicNot = Resource.Drawable.bicon512; TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; LogFile("Setup Done 1/2"); base.OnCreate(savedInstanceState); LogFile("Setup Done 2/2"); #if DEBUG System.AppDomain.CurrentDomain.UnhandledException += MainPage.UnhandledExceptionTrapper; #endif string data = Intent?.Data?.EncodedAuthority; try { MainPage.intentData = data; } catch (Exception) { } // ======================================= INIT ======================================= LogFile("Starting Init"); FFImageLoading.Forms.Platform.CachedImageRenderer.Init(enableFastRenderer: true); Rg.Plugins.Popup.Popup.Init(this); LibVLCSharpFormsRenderer.Init(); XamEffects.Droid.Effects.Init(); Xamarin.Essentials.Platform.Init(this, savedInstanceState); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); LogFile("Completed Init"); //LocalNotificationsImplementation.NotificationIconId = PublicNot; MainDroid.NotificationIconId = PublicNot; LogFile("Start Application"); LoadApplication(new App()); LogFile("Completed Startup"); App.OnVideoStatusChanged += (o, e) => { UpdatePipVideostatus(); }; LogFile("Completed PIP"); } catch (Exception _ex) { LogFile("ERROR LOADING APP: " + _ex); error(_ex); } if (Settings.IS_TEST_BUILD) { return; } try { LogFile("Creating activity"); activity = this; mainDroid = new MainDroid(); LogFile("Creating Maindroid"); mainDroid.Awake(); LogFile("Completed Awake"); //Typeface.CreateFromAsset(Application.Context.Assets, "Times-New-Roman.ttf"); var datastring = Intent.DataString; var clip = Intent.ClipData; if (datastring != null) { print("GOT NON NULL DATA"); if (datastring != "") { print("INTENTDATA::::" + datastring); if (datastring.Contains("www.imdb.com")) { string id = FindHTML(datastring + "/", "title/", "/"); // var _thread = mainCore.CreateThread(2); mainCore.StartThread("IMDb Thread", () => { string json = mainCore.DownloadString($"https://v2.sg.media-imdb.com/suggestion/t/{id}.json"); // await Task.Delay(1000); Device.BeginInvokeOnMainThread(() => { if (json != "") { MainPage.PushPageFromUrlAndName(id, FindHTML(json, "\"l\":\"", "\""));; } else { App.ShowToast("Error loading imdb"); } }); }); } else if (IsFromYoutube(datastring)) { HandleYoutubeUrl(datastring); } else { MainPage.PushPageFromUrlAndName(datastring); } } } LogFile("Calling RequestPermission"); RequestPermission(this); LogFile("Permissions Loaded"); //GetLatency(); // https://developer.amazon.com/docs/fire-tv/audio-video-synchronization.html#section1-2 MainChrome.OnDisconnected += (o, e) => { MainDroid.CancelChromecast(); }; MainChrome.OnNotificationChanged += (o, e) => { try { print("CHROMECAST CHANGED::: "); print("ID=====================" + e.isCasting + "|" + e.isPlaying + "|" + e.isPaused); if (!e.isCasting) // || !e.isPlaying) { { MainDroid.CancelChromecast(); } else { MainDroid.UpdateChromecastNotification(e.title, e.body, e.isPaused, e.posterUrl, e.time, e.duration); } } catch (Exception _ex) { print("EX NOT CHANGED::: " + _ex); } }; LogFile("OnLoad Completed"); //ResumeIntentData(); LogFile("Resume intents completed"); StartService(new Intent(BaseContext, typeof(OnKilledService))); LogFile("OnKilled completed"); Window.SetSoftInputMode(Android.Views.SoftInput.AdjustNothing); LogFile("OnSetsoft completed"); } catch (Exception _ex) { LogFile("FATAL ERROR : " + _ex); error(_ex); } LogFile($"============================== STARTUP DONE AT {UnixTime} =============================="); // TaskScheduler.UnobservedTaskException += TaskSchedulerOnUnobservedTaskException; // Android.Renderscripts.ta // var bar = new Xamarin.Forms.Platform.Android.TabbedRenderer();//.Platform.Android. //ShowBlackToast("Yeet", 3); // DownloadHandle.ResumeIntents(); // ShowLocalNot(new LocalNot() { mediaStyle = false, title = "yeet", data = "", progress = -1, showWhen = false, autoCancel = true, onGoing = false, id = 1234, smallIcon = Resource.Drawable.bicon, body = "Download ddddd" }, Application.Context); // ShowLocalNot(new LocalNot() { mediaStyle = false, title = "yeet", autoCancel = true, onGoing = false, id = 123545, smallIcon = Resource.Drawable.bicon, body = "Download Failed!",showWhen=false }); // ((e.Cancelled || e.Error != null) ? "Download Failed!" }