Android uses vitamio to build its own universal player (5) — online play (play Youku Video)

preface

In order to ensure the progress of weekly articles, and because the new version of vitamio has not been released, it is decided to postpone some functions of local playback (screenshots, video time, size, etc.) and skip the chapter of directly writing the online playback part. It can be seen from the introduction of vitamio that it supports a variety of network protocols such as HTTP and m3u8. This chapter will write an example of playing Youku video.

Series

1. Android uses vitamio to build its own universal player (1) -- ready

2. Android uses vitamio to build its own Android universal player (2) - gesture to control brightness, volume and zoom

3. Android uses vitamio to build its own Android universal player (3) - local playback (main interface, video list)

4. Android uses vitamio to build its own Android universal player (4) - local playback (fast search, data storage)

Text

1、 Target

1. Officially named "start broadcasting video", the original meaning is "open source video player", which also has the simple meaning of "start broadcasting video". I hope you like it:)

2. The embedded Youku (3G. Youku. Com) is used to directly play video files.

II. Implementation

FragmentOnline

Code Description:

Because 3g.youku.com is embedded, the page layout is very good, and it is very easy to obtain the playback address. Just listen to the page Jump.

a) . onkey handles the fallback event and returns to the previous page

b) Note that the shouldoverrideurlloading method of webviewclinet will not jump if it returns true. It will be improved here in the future. If the playback fails, the browser's flash will be used directly.

c). fragment_ The online layout is not posted here. It is a WebView control.

3、 Warning

Video, books and music are all very strict areas of copyright. How to avoid copyright issues needs to be seriously considered. After consulting a friend, the method adopted in this article is OK. Generally, it is mainly to determine whether there is copyright, that is, to see whether to remove advertisements. It happens that the videos of 3g.youku.com are played directly from MP4 files without advertisements.

IV. relevant articles

Get the real address of Youku video through decompilation

Video address acquisition principle of Youku network

Real address resolution of Youku Video

Vi. vitamio and related

Vitamio: http://vov.io

VPlayer: http://vplayer.net (using vitamio's most successful products, with more than 5 million users)

End

The m3u8 address was originally taken here, but the current version of vitamio cannot play the resolved address, so it directly uses the MP4 address. In simple terms, this problem has been fixed in subsequent versions. You can see the effect from the new version of vplayer. Although it is only a demo so far, we still strive to move towards a formal product. We hope to officially release it to the app store for users to use by the end of the series of articles. We also welcome more suggestions~~

The above is the data sorting of Android vitamio playing network video, which will be supplemented in the future.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>