setVideoSurfaceTexture失败:-22在mediaplayer

我尝试使用MediaPlayer(Android ICS)循环播放多个video,并在每次调用oncompletion()时更改video。

它工作的很好,但随机时间后应用程序冻结,我得到的错误:

[SurfaceView]连接:已连接(cur = 3,req = 3)setVideoSurfaceTexture失败:-22

发生这种错误时,在内部调用重置播放器

ref:mediaplayer.cpp

if (err != OK) { LOGE("setVideoSurfaceTexture failed: %d", err); // Note that we must do the reset before disconnecting from the ANW. // Otherwise queue/dequeue calls could be made on the disconnected // ANW, which may result in errors. reset(); disconnectNativeWindow(); return err; } 

根据我的代码,我得到onprepared()的通知并开始播放。

实际上由于这个错误没有播放。

所以我尝试重置mediaplayer和调用prepare()当这个问题发生,mediaplayer没有播放,但我无法捕捉到这个bug(mp.isPlaying() – > true(be'z称为start()onprepared ())。

我尝试像这样的逻辑

 onprepared() { mp.start(); if (pbm : [SurfaceView] connect : already connected (cur=3, req=3) setVideoSurfaceTexture failed : -22 ) { reset the mediaplayer source and call prepare } } 

我怎么能find这个错误再次重新启动mediaplayer?

Solutions Collecting From Web of "setVideoSurfaceTexture失败:-22在mediaplayer"