简体   繁体   中英

Android VideoView is not working for online video streaming

        setContentView(R.layout.activity_s);
    VideoView vidView = (VideoView)findViewById(R.id.videoView);
    MediaController vidControl = new MediaController(this);
    String vidAddress = "VideoURL";
    Uri vidUri = Uri.parse(vidAddress);
    vidView.setVideoURI(vidUri);
    vidControl.setAnchorView(vidView);
    vidView.setMediaController(vidControl);

Activity was launched successfully but unable to play the video.

Add this:

vidView.start();

You have to include this permissions on AndroidManifest

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

You could try 3rd party library like: easy-video-player

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM