Skip to content

Commit

Permalink
Add reload source menu item
Browse files Browse the repository at this point in the history
This helps debugging issues (e.g. memory leaks) when loading multiple sources into the same VideoView.
  • Loading branch information
protyposis committed Oct 3, 2016
1 parent c6f0234 commit 23bff8f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,8 @@ public boolean onOptionsItemSelected(MenuItem item) {
} else if(id == R.id.action_getcurrentposition) {
Toast.makeText(this, "current position: " + mVideoView.getCurrentPosition(), Toast.LENGTH_SHORT).show();
return true;
} else if(id == R.id.action_reload_source) {
initPlayer();
}
return super.onOptionsItemSelected(item);
}
Expand Down
3 changes: 3 additions & 0 deletions MediaPlayerDemo/src/main/res/menu/videoview.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@
<item android:id="@+id/action_getcurrentposition"
android:title="@string/action_getcurrentposition" />

<item android:id="@+id/action_reload_source"
android:title="@string/action_reload_source" />

<item android:id="@+id/action_settings"
android:title="@string/action_settings"
android:orderInCategory="100"
Expand Down
1 change: 1 addition & 0 deletions MediaPlayerDemo/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,6 @@
<string name="openvideo_pick">Pick a file</string>
<string name="openvideo_type">Paste or type URL</string>
<string name="openvideo_dash_hint">Hint: If the URL to a DASH MPD does not end in the .mpd extension, you can hint a DASH stream by prepending \'dash://\' in front of the actual URL.</string>
<string name="action_reload_source">Reload source</string>

</resources>

0 comments on commit 23bff8f

Please sign in to comment.