Android uses Vitamio to build its own universal player (5)--Play online (play cool video) _android

Source: Internet
Author: User

Objective

In order to ensure a weekly progress, and because the new version of Vitamio has not been released, decided to postpone the local playback of some features (screenshots, video time, size, etc.), skip directly write the section of the online play part. As you can see from Vitamio's introduction, it supports a variety of network protocols such as HTTP, m3u8, and this chapter will write examples of playing Youku videos.

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 control brightness, volume, zoom

3, Android use Vitamio to build their own Android Universal player (3)--local playback (main interface, video list)

4, Android use Vitamio to build their own Android Universal player (4)--Local playback (fast search, data storage)

Body

I. Objectives

1, officially named "Premiere Video", the original intention: "Open source video player", there are "start playing video" simple meaning, I hope you like:)

2, the use of embedded Youku (3g.youku.com) way, directly play video files.

Second, realize

Fragmentonline

public class Fragmentonline extends Fragmentbase {private WebView Mwebview; @Override public View Oncreateview (layoutinflater inflater, ViewGroup container, Bundle savedinstancestate) {View V =
  Inflater.inflate (R.layout.fragment_online, container, false);
  Mwebview = (webview) V.findviewbyid (R.id.webview);
  Mwebview.setscrollbarstyle (View.scrollbars_outside_overlay);
  Mwebview.getsettings (). Setjavascriptenabled (True);
  Mwebview.getsettings (). Setpluginsenabled (True);
  Mwebview.loadurl ("http://3g.youku.com");
   Mwebview.setwebviewclient (New Webviewclient () {@Override public void onpagefinished (webview view, String URL) {

   }; /** Page Jump * * @Override public boolean shouldoverrideurlloading (webview view, String URL) {if (fileutils.isvideoo
     Raudio (URL)) {Intent Intent = new Intent (getactivity (), videoplayeractivity.class);
     Intent.putextra ("path", url);
     StartActivity (Intent);
    return true;
   return false;
  };

  }); Mwebview.Setonkeylistener (New Onkeylistener () {@Override public boolean onkey (View v, int keycode, keyevent event) {if ((keycode = = keyevent.keycode_back) && mwebview!= null && mwebview.cangoback ())
     {Mwebview.goback ();
    return true;
   return false;
  }
  });
 return v; }

Code Description:

Because the embedded 3g.youku.com, the page layout is very good, and the inside get the playback address is very easy, just listen to the page jump.

a). OnKey handling back events, returning to previous page

b). Note The Shouldoverrideurlloading method of Webviewclinet, if the return True page will not perform a jump, here will be improved, playback failure directly using the browser's flash playback.

c). Fragment_online layout here is not pasted, is a WebView control.

third, warning

Video, books, music is a very strict area of copyright, how to avoid copyright issues is a serious problem to consider. Consulted friends, this article adopts the way is possible, generally to determine whether there is copyright is to see whether the removal of advertising, happened to 3g.youku.com video is not with advertising, direct MP4 file playback.

Iv. related articles

Get cool video real address by decompile

The principle of Youku Network video address acquisition

Cool video Real Address resolution

  Vi. Vitamio and related

Vitamio: Http://vov.io

vplayer: http://vplayer.net (using Vitamio's most successful product, more than 5 million users)

End

Here is to take m3u8 address, has also been taken, but the current version of the Vitamio can not play the resolution of the address, but also directly using the MP4 address, the simple aspect, the next version of this issue has been repaired, from the new edition of the Vplayer you can look at the effect. Although so far is only a demo, still strive toward a formal product forward, I hope to the end of the series can be officially published to the application store for users to use, but also welcome suggestions ~ ~

The above is the Android Vitamio playback network video data collation, follow-up continue to add.

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.