Streaming media with HLS protocol for Android playback

Source: Internet
Author: User

Recently, we need to test whether Android supports streaming media playing through the HLS protocol. Some examples on the Internet are used to play local files, and some online files are not streaming media using the HLS protocol. According to the updated description of Android3.0, Android3.0 has started to support most of the HLS streaming media types, so we did a test.
The key code is as follows: www.2cto.com
[Java]
Private void playVideo (){
String strPath = "http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8 ";
// MvdView. setVideoPath (strPath );
<Span style = "white-space: pre"> </span> Uri uri = Uri. parse (strPath );
MvdView. setVideoURI (uri); // mvdView is a videoView control.
MvdView. setMediaController (new MediaController (this ));

// MvdView. requestFocus ();
MvdView. start ();
}

Private void stopPlay (){
MvdView. stopPlayback ();
}
The error "unable to play the video" is always reported after the video is added. It turns out that the app has no permission to access the network. Add the following statement to the AndroidManifest. xml file:
[Html]
<Uses-permission android: name = "android. permission. INTERNET"/>

The video will soon be played out. However, when performing a bit rate adaptive test, it is not found that the video will automatically switch to a low bit rate when the network environment is poor.
The tested Android versions include Android 2.3, 4.0, and 4.1.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.