player error handling

This commit is contained in:
Page Asgardius 2022-09-02 16:03:08 -07:00
parent 2b65be2374
commit 303994dc58
2 changed files with 10 additions and 4 deletions

View file

@ -57,10 +57,15 @@ public class VideoPlayer extends AppCompatActivity {
if (cause instanceof HttpDataSource.HttpDataSourceException) {
// An HTTP error occurred.
//System.out.println("Playback error F");
Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_load_fail), Toast.LENGTH_SHORT).show();
player.release();
finish();
Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_conn_fail), Toast.LENGTH_SHORT).show();
}
else {
// An HTTP error occurred.
//System.out.println("Playback error F");
Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_wrong_type), Toast.LENGTH_SHORT).show();
}
player.release();
finish();
}

View file

@ -9,7 +9,8 @@
<string name="objectname">peces felices.mp4</string>
<string name="explorer_test_button">File Explorer Test</string>
<string name="video_test_button">Video Test</string>
<string name="media_load_fail">Cannot load media file</string>
<string name="media_conn_fail">Cannot retrieve media file</string>
<string name="media_wrong_type">Invalid media file</string>
<string name="media_list_fail">Cannot connect to server</string>
<string name="dummy_button">Dummy Button</string>
<string name="dummy_content">DUMMY\nCONTENT</string>