Note that there are some explanatory texts on larger screens.

plurals
  1. POPlaying video from the pause state in VideoView
    primarykey
    data
    text
    <p>For custom videoview I had to override the MediaController (to change the design of the buttons and connect to the buttons pause / play a selector). The situation is this: put the video on pause and turning the application, and then again restored, the video starts playing again, and not from the point at which it was suspended, and therefore the question arose: how to make the video starts playing from the place , where it was stopped? What do I need to change in the VideoActivity?</p> <pre><code>public class VideoActivity extends Activity { VideoView videoView; VkMediaController mc; private static final String CURRENT = "duration"; private static final String URL = "url"; private Uri mURI; private int mCurrentPosition = -1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setContentView(R.layout.video_view_player); videoView = (VideoView) findViewById(R.id.videoViewplayer); mc = new VkMediaController(this); mURI = getIntent().getData(); if (savedInstanceState != null) { mURI = Uri.parse(savedInstanceState.getString(URL)); mCurrentPosition = savedInstanceState.getInt(CURRENT); } videoView.setMediaController(mc); videoView.setVideoURI(mURI); videoView.requestFocus(); } @Override protected void onStart() { super.onStart(); videoView.start(); if (mCurrentPosition != -1) { videoView.seekTo(mCurrentPosition); } } @Override public void onSaveInstanceState(Bundle outState) { outState.putInt(CURRENT, videoView.getCurrentPosition()); outState.putString(URL, mURI.toString()); super.onSaveInstanceState(outState); } </code></pre> <p>}</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload