Android uses videoview to play video files in the current project

Source: Internet
Author: User

Recently, I am working on a demo for Android to use videoview to play the video file in the current project. I want to play the video and record it. The videoview control is used. If you play a network video, the video should be a progressive stream. The format should be well known, generally H.263 or H. video files with the extension 3GP or MP4 in 264 format, or 3GP files in MPEG4 sp.

Play the network videoCodeAs follows:

Videoview = (videoview) findviewbyid (R. Id. videoview );
Videoview. setvideouri (URI. parse ("http://f3.3g.56.com/15/15/JGfMspPbHtzoqpzseFTPGUsKCEqMXFTW_smooth.3gp "));
Mediacontroller = new mediacontroller (this );
Videoview. setmediacontroller (mediacontroller );
Videoview. Start ();

Playing the video files in the current project requires a little effort. Why not? Play back the SD card or mobile phone memory. Code for playing the video on the SD card:

Note: COM. telecom. activities is the class package name, R. raw. tianyi is the video file name. If the video is placed in the raw folder under Res, it is automatically stored in R. generated in Java. In Android, the file name must be a valid file name, including lower-case letters and numbers. The rest cannot be used. Note that! Fashion Java-JavaScript mogujie.com women's clothing

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.