[VLC-Android] LibVLC API introduction (equivalent to the MediaPlayer of VLC), vlc-androidlibvlc

Source: Internet
Author: User

[VLC-Android] LibVLC API introduction (equivalent to the MediaPlayer of VLC), vlc-androidlibvlc


Preface

It is very important to learn new things. I have made some suggestions here. Thank you for your feedback!

 

Statement

 

Welcome to repost, but please keep the original source of the article :) blog Park: http://www.cnblogs.com farmer UNCLE: http://over140.cnblogs.com

 

Body

The LibVLC of vlc-android is equivalent to the MediaPlayer object. The corresponding relationship is listed here.

1. public voidPlayMRL(String mrl)

Corresponding to the setDataSource of MediaPlayer. Do not convert it to Uri and then toString. Otherwise, the video cannot be played. The usage is as follows:

PlayMRL ("http://live.3gv.ifeng.com/zixun.m3u8 ")

 

2. public native voidPlay()

Start () corresponding to MediaPlayer to start playing.

 

3. public native voidPause()

Corresponding to pause () of MediaPlayer, pause playing.

 

4. public native void Stop()

The corresponding MediaPlayer stop () to stop playing.

 

5. public native booleanIsPlaying()

The isPlaying corresponding to MediaPlayer and whether the video is being played.

 

6. public native intGetPlayerState();

Obtain the player status.

 

7. public native int GetVolume()

Obtain the volume.

 

8. public native intSetVolume(Int volume)

Set the volume. (The value range is different from that of MediaPlayer)

 

9. public native longGetLength()

Corresponds to the getDuration of MediaPlayer. Obtains the video length in milliseconds.

 

10. public native longGetTime()

Returns the current video time in milliseconds.

 

11. public native longSetTime(Long time)

Sets the current video time in milliseconds.

 

12. public native floatGetPosition()

Corresponds to the getCurrentPosition of MediaPlayer. Set the current video location.

 

 

13. public native voidSetPosition(Float pos)

Corresponds to the seekTo of the MediaPlayer. Set the current video location.


14. public native voidSetRate(Float rate)

Set the playback speed (fast forward and fast return can be achieved) 1 is normal speed, 2 is double speed (I guess the value may be 0.5 ~ THE SAME AS Vitamio ~ 2.0), corresponding to the getRate method.

 

15. public native booleanIsSeekable()

Whether to support seek (drag and drop ). For example, live streaming does not support seek operations.

 

16. public voidDestroy()

Destroy the LibVLC instance corresponding to the release of the MediaPlayer.

 

17. public byte []GetThumbnail(String mrl, int I _width, int I _height)

Obtains the rgba byte array of the video.

 

18. public voidSetHardwareAcceleration(Int hardwareAcceleration)

Set hard decoding. For details, refer to parameters such as LibVLC. HW_ACCELERATION_FULL.

 

19. public voidSetNetworkCaching(Int networkcaching)

Set network buffering. (I still don't know how to use it. We can see that the set values are 3000 and 6000)

 

20. public voidSetFrameSkip(Boolean frameskip)

(I do not know how to use it for the time being. It seems that it can improve performance. Can I skip the frame decoding error directly ?)

 

[VLC-Android] vlc-android example

 

 

End

Although I have been using the player for a long time, I still don't understand many basic and basic things, and I need to learn more. For example, I don't know what the frame skip above is.


API function libvlc_media_plater_get_lenth provided by VLC player

Bug

Write a Linux Shell script and replace "org_videolan_libvlc" in all the c/cpp files in the folder with "com_mediaplayer

I will simply separate the processing, that is, first processing the c file and then the cpp file, hoping to help you.
Find. -name "*. c "| xargs sed-e" s/org_videolan_libvlc/com_mediaplayer/"-ifind. -name "*. cpp "| xargs sed-e" s/org_videolan_libvlc/com_mediaplayer/"-I

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.