Mediaplayer setvideosurfacetexture failed:-22 troubleshooting.

Source: Internet
Author: User

In a recent project, there is a playback list interface, similar to Youku's playback interface, which is a player and a playlist, A headache occurs: if the current video is playing, you cannot load the video of this item when you click the playlist. You need to click this item again to switch the video playback. That is to say, the biggest difference between my app and Youku is that I have to double-click to play the video in the video list. This problem has been bothering me for two weeks. Today, I suddenly found the error E/mediaplayerservice (180): setvideosurfacetexture failed:-22 in the log, so I searched the internet and finally solved the problem. The solution is as follows:

 
We can avoid this problem by the following way... mediaplayer. setdisplay (null); mediaplayer. reset (); after this set the surfaceholder again before start the mediaplayer. setdisplay (surfaceholder1); mediaplayer. start (); In onprepared notification.

This is the old saying of foreigners. In fact, it is true that Youku app does this when switching to play a network video: Pause the current video first, and lift the mediaplayer from the "binding" with the previous surfaceholder ", when the mediaplayer is ready for start again, the mediaplayer is "Bound" with surfaceholder again to display the next video to be played.

Note: mediaplayer. setdisplay:Set surfaceholder to display partial media of the video.

Reference website: Click to open the link. This issue is recorded only to help other people who encounter similar problems. After all, the player lifecycle is complicated to avoid such problems, if there is a problem with the method of calling the player's life cycle, you should avoid detours.

Mediaplayer setvideosurfacetexture failed:-22 troubleshooting.

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.