I want to add auto play media in android
<p>I am working on integrating some video into one of my Activities. It plays fine, but I have to click play for it to actually play. I searched the forums and the developer site and cannot find anything relating to autoplay or autostart. Any suggestions?</p>

<p>MainActivity.java</p>

<pre class="lang-java prettyprint-override"><code>...

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                    .setAction("Action", null).show();
        }
    });


    VideoView mVideoView = (VideoView) findViewById(R.id.videoView);
    mVideoView.setVideoPath("file:///android_asset/video1.MP4");
    mVideoView.setMediaController(new MediaController(this));
    mVideoView.seekTo(1);


    //mVideoView.requestFocus();
}
</code></pre>

<p>My contain_main.xml</p>

<pre class="lang-xml prettyprint-override"><code>&lt;fragment xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/fragment"
    android:name="imaker.MediaAutoPlay.MainActivityFragment"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:layout="@layout/fragment_main"&gt;

&lt;VideoView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/videoView"
    android:layout_height="fill_parent"
    android:layout_width="fill_parent" /&gt;

&lt;/fragment&gt;
</code></pre>