Mobile phone video 9-video player advanced features (2), 9-advanced features

Source: Internet
Author: User

Mobile phone video 9-video player advanced features (2), 9-advanced features
1. An error occurred while playing the listener.

Class MyOnErrorListener implements MediaPlayer. onErrorListener {@ Overridepublic boolean onError (MediaPlayer mp, int what, int extra) {// Toast. makeText (SystemVideoPlayer. this, "playing error", Toast. LENGTH_SHORT ). show (); // 1. the format of the video to be played is not supported-jump to the universal player to continue playing startVitamioPlayer (); // 2. network interruption during online video playback --- 1. if the network is indeed disconnected, You can prompt that the network is disconnected. 2. network intermittent, replay // 3. there is a blank space in the local file during playback --- return true after the download is complete ;}}
2. Introduction to the universal decoding framework

1. ffmpeg

2. VLC

3. The Vitamio universal decoding framework is directly used on Android and IOS platforms.
Vitamio can smoothly play videos in common formats such as 720P or even 1080P hd mkv, FLV, MP4, MOV, TS, and RMVB, and supports MMS, RTSP, RTMP, and, HLS (m3u8) and other common video streaming protocols, including on-demand and live streaming.

It encapsulates ffmpeg

 

3. Integration of Vitamio

1. Associate the Vitamio Library

compile project(':vitamio')

2. Copy the configuration corresponding to the function list file to the previous permission.

<uses-permission android:name="android.permission.WAKE_LOCK" /><uses-permission android:name="android.permission.INTERNET" /><uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /><uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /><uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /><uses-permission android:name="android.permission.READ_PHONE_STATE" />

Configuration

<!-- Don't forgot InitActivity --><activity        android:name="io.vov.vitamio.activity.InitActivity"        android:configChanges="orientation|screenSize|smallestScreenSize|keyboard|keyboardHidden|navigation"        android:launchMode="singleTop"        android:theme="@android:style/Theme.NoTitleBar"        android:windowSoftInputMode="stateAlwaysHidden" />

3. Copy the SystemVideoPlayer system and change the imported VitamioVideoPlayer package to the Vitamio package, MediaPlayer and VideoView.

Custom VitamioVideoView inherits the VideoView of Vitamio

4. Copy the layout file activitysystemvideoplayer. xml and rename it activityvitamiovideoplayer. xml, and replace VideoView with Vitamio's VitamioVideoView.

5. initialize the Vitamio library before loading the layout file.

Vitamio.isInitialized(this);  

6. Jump to VitamioVideoPlayer when a playback error occurs in the system player. Q: Can I directly use the Vitamio player for playback?

Note: a. pass data to VtaimoVideoPlayer Player B and disable the system player.

Show the Activity icon on the desktop and click the icon to enter the software.

<category android:name="android.intent.category.LAUNCHER" />

  

  

  

  

 

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.