Skip to content

Commit

Permalink
Fixed bug when player throws error
Browse files Browse the repository at this point in the history
  • Loading branch information
jerry08 committed Nov 6, 2022
1 parent 0a25d9d commit 72b9b0a
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions AniStream/VideoActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public class VideoActivity : AppCompatActivity, IPlayer.IListener,
//private LinearLayout controls = default!;
private TextView animeTitle = default!;
private TextView episodeTitle = default!;
private TextView errorText = default!;
//private TextView errorText = default!;
private TextView VideoInfo = default!;
private TextView VideoName = default!;
private TextView ServerInfo = default!;
Expand Down Expand Up @@ -125,20 +125,20 @@ protected async override void OnCreate(Bundle? savedInstanceState)
this.HideSystemBars();

//Enable unhandled exceptions for testing
//AndroidEnvironment.UnhandledExceptionRaiser += (s, e) =>
//{
//
//};
//
//AppDomain.CurrentDomain.UnhandledException += (s, e) =>
//{
//
//};
//
//TaskScheduler.UnobservedTaskException += (s, e) =>
//{
//
//};
AndroidEnvironment.UnhandledExceptionRaiser += (s, e) =>
{

};

AppDomain.CurrentDomain.UnhandledException += (s, e) =>
{

};

TaskScheduler.UnobservedTaskException += (s, e) =>
{

};

await _playerSettings.LoadAsync();

Expand Down Expand Up @@ -176,7 +176,7 @@ protected async override void OnCreate(Bundle? savedInstanceState)
videoChangerButton = FindViewById<ImageButton>(Resource.Id.qualitychanger)!;
nextEpisodeButton = FindViewById<ImageButton>(Resource.Id.exo_nextvideo)!;
previousEpisodeButton = FindViewById<ImageButton>(Resource.Id.exo_prevvideo)!;
errorText = FindViewById<TextView>(Resource.Id.errorText)!;
//errorText = FindViewById<TextView>(Resource.Id.errorText)!;
VideoInfo = FindViewById<TextView>(Resource.Id.exo_video_info)!;
VideoName = FindViewById<TextView>(Resource.Id.exo_video_name)!;
ServerInfo = FindViewById<TextView>(Resource.Id.exo_server_info)!;
Expand Down Expand Up @@ -754,8 +754,8 @@ public void OnPlayerError(PlaybackException? error)
{
CanSaveProgress = false;

errorText.Text = "Video not found.";
errorText.Visibility = ViewStates.Visible;
//errorText.Text = "Video not found.";
//errorText.Visibility = ViewStates.Visible;
}

public void OnIsPlayingChanged(bool isPlaying)
Expand Down Expand Up @@ -861,8 +861,8 @@ public void OnPlayerErrorChanged(PlaybackException? error)
{
CanSaveProgress = false;

errorText.Text = "Video not found.";
errorText.Visibility = ViewStates.Visible;
//errorText.Text = "Video not found.";
//errorText.Visibility = ViewStates.Visible;

if (error is not null && error.Message is not null)
this.ShowToast("Failed to play video");
Expand Down

0 comments on commit 72b9b0a

Please sign in to comment.