How to embed VLC media player to my Android App

别说谁变了你拦得住时间么 提交于 2019-12-17 15:26:21

问题


Is there a way to embed VLC media player to Android Application? I have several issues:

1) I have a video streaming Camera (from RTSP) and I cannot play its stream on my regular videoview panel (Sorry this video cannot be played error). However, I installed the VLC application for Android (beta version) and I was able to play it. 2) My main objective is to port a desktop java application which uses VLC plugin to Android. I want to accomplish this task with minimum effort (I have some time issues).

Another alternative, is there a way to embed codecs used by VLC to my application? Because with my videoview, the result varies according to the format of the video. I can play some other videos streamed through RTSP on my videoview.

I search through internet and found a "libvlc" but also some notes about that libvlc for android is not complete (but those notes belong to a past time, even in stackoverflow).


回答1:


Yes, if you already have the vlc-sdk.7z (libVLC for android), here is the sample project to embedded VLC into your android apps.

If you do not have libVLC, here are the steps to build one. (After "sh compile.sh" finished, "make vlc-sdk.7z" to create the vlc-sdk.7z and unzip to the demo project.

I put the vlc-sdk.7z(only armeabi-v7a is included) here for testing.




回答2:


Maruku has given a great answer.

In addition, if you don't want to compile libVLC on your own machine, mrmaffen has kindly thrown it up onto maven central. So in your .gradle file include

compile "de.mrmaffen:vlc-android-sdk:1.9.8"

Keep in mind that LibVLC may not be 100% updated because you aren't compiling the source yourself.

More info can be found here on GitHub




回答3:


2019 sees introduction of a VLCVideoLayout component that greatly simplifies the code required to embed VLC into android.

https://code.videolan.org/videolan/libvlc-android-samples

The libVLC is provided by the official VideoLAN project hosted on BinTray. See the build.gradle files for the link to the Maven repo and the package name/version.

https://code.videolan.org/videolan/libvlc-android-samples/blob/master/build.gradle#L18 https://code.videolan.org/videolan/libvlc-android-samples/blob/master/java_sample/build.gradle#L34




回答4:


Some other answers link to outdated versions, however actual for 2019.03 is LibVlc for all platforms 3.1.8. This is .aar version, you may add it to your project with these instructions and use.

However if all-version is too large(over 70MB), here is armv7 version, and here if x86.




回答5:


Step 1 : install Linux

Step 2 : install ndk and sdk

Step 3 : change your directory path upto compile.sh

then compile.sh run through your Linux terminal and generate apk

Compile - Run - Enjoy



来源:https://stackoverflow.com/questions/22073970/how-to-embed-vlc-media-player-to-my-android-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!