Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I had the same problem. I thought I did everything right but it didnt work. Then I just changed the order so I first call <code>VideoView.seekTo()</code> and then <code>VideoView.start()</code> . That worked. I also have <code>VideoView.requestFocus()</code> in there but I dont know if that matters.</p> <pre><code>videoPlayer.requestFocus(); videoPlayer.seekTo(position); videoPlayer.start(); </code></pre> <p>So if youre sure you position variable has the right value, this might be your answer. You may not be able to seek when the Video is not loaded. Implement onPreparedListener like this:</p> <pre><code>public class VideoActivity extends Activity implements OnPreparedListener { VideoView videoPlayer; int position; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if(savedInstanceState!=null){ position=savedInstanceState.getInt("pos") } // setting up the videoview setContentView(R.layout.activity_video); getIntent().getExtras().getString("url"); Uri videouri = Uri.parse(getIntent().getExtras().getString("url")); videoPlayer = (VideoView) findViewById(R.id.videoView); videoPlayer.setOnPreparedListener(this); videoPlayer.setKeepScreenOn(true); videoPlayer.setVideoURI(videouri); } /** * Start the plaback when the video is loaded * * @param mp * @see android.media.MediaPlayer.OnPreparedListener#onPrepared(android.media.MediaPlayer) */ public void onPrepared(MediaPlayer mp) { //this is a TextView infront of the VideoView which tells the User the Video is loading- hide that findViewById(R.id.tv_video_load).setVisibility(View.GONE); videoPlayer.requestFocus(); videoPlayer.seekTo(position) videoPlayer.start(); } } </code></pre>
    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.
    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