VLC-based Android multimedia solution, vlcandroid

Source: Internet
Author: User

VLC-based Android multimedia solution, vlcandroid

Some time ago, the project needed to play videos, streaming media, and view and monitor in Android, and then studied the Android multimedia solution.

After searching, there are roughly the following types:

 

Android MediaPlayer is a built-in player for Android. It supports a limited number of formats: 3gp mp4 and does not support streaming media.

FFmpeg is a powerful cross-platform multimedia solution that requires NDK compilation and supports massive formats and streaming media.

Google ExoPlayer is a pre-built player launched by Google in 2014 between the existing MediaPlayer and the custom media player. It requires Android 4.1 +, supports multiple formats, DASH (Dynamic Adaptive Streaming over HTTP), and is easy to scale.

Vitamio is a popular third-party multi-media library developed by Chinese people. It supports Android and iOS. authorization is required for commercial use of the latest version.

VLC is another powerful cross-platform multimedia solution that supports massive formats and streaming media. It integrates some FFmpeg functions and officially supports the Android platform.

This article uses VLC to play a video on Android. The final effect is as follows:

 

1. Compile VLC Android

VLC official git Repository: http://git.videolan.org/

VLC Android official git Repository: https://code.videolan.org/videolan/vlc-android

VLC Android official compilation instructions: https://wiki.videolan.org/AndroidCompile

VLC Android provides Android native aar packages, which can be directly referenced in projects. According to the preceding instructions, you can compile the aar packages of the corresponding architecture (such as ARM, x86, and MIPS.

I have compiled a ARMv7 aar package, which can be downloaded here.

Project source code is hosted on Github: https://github.com/mymbrooks/VLCAndroidDemo

 

2. Create an Android project and copy the aar package to the app/libs directory:

 

3. Modify app/build. gradle and add:

 

4. Create the first interface to support local and remote video playback:

 

5. To be compatible with Android 6.0 +, you must first request the permission to read the SD card when playing a local video:

 

6. A third-party method is used to conveniently obtain the real video paths of Android 4.4 and later versions:

 

7. Create a VLC player interface and use SurfaceView to display the video. progress bar and volume control are supported. Pause and continue. Full Screen Display is supported:

 

8. Playback progress control:

 

9. Get video length and other information:

 

10. Update time progress during playback:

 

11. format the playback time progress to hh: mm: ss.

 

12. The method used for playing local and remote videos is different:

 

VLC Android provides many functions. For more advanced functions, see the official App source code.

In addition, VLC Android also provides a native control, which can be used on your own:

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.