When mediaplayer + surfaceview is switched out and then returned, the problem cannot be solved.

Source: Internet
Author: User

Write a video todayProgramWhen a problem occurs, use mediaplayer + surfaceview to play a network video (this problem also exists after testing the local video). After normal playback, press home to switch out the activity. Then long press home and select this program to switch back. However, after switching back, I only heard a very short voice, and the sound and image were lost.

Log hit an error (260. No specific descriptions can be found on the Internet, and no solution can be found.

The final cause is found. When switching out, call the pause method of MP (mediaplayer) to pause playing. When switching back, call the start method of MP to continue playing. This error occurs. You need to add MP. setdisplay () before MP. Start and reset the playback interface. (This requirement is not mentioned in the document. It is a bit difficult ).

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.