Browse Source

Merge pull request #90 from Tencent/bugfix/android_oncomplete

bug: 修复某些错误没有回调onVideoComplete问题
hexleo 5 years ago
parent
commit
ae7b0eacbc

+ 2 - 0
Android/PlayerProj/animplayer/build.gradle

@@ -34,4 +34,6 @@ dependencies {
 
 
 // maven central
 // maven central
 // 上传指令./gradlew uploadArchives
 // 上传指令./gradlew uploadArchives
+// https://s01.oss.sonatype.org/
+// Staging Repositories -> close -> release
 // apply from: "../publish-mavencentral.gradle"
 // apply from: "../publish-mavencentral.gradle"

+ 4 - 2
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/AnimPlayer.kt

@@ -76,16 +76,18 @@ class AnimPlayer(val animView: IAnimView) {
         isStartRunning = true
         isStartRunning = true
         prepareDecoder()
         prepareDecoder()
         if (decoder?.prepareThread() == false) {
         if (decoder?.prepareThread() == false) {
-            decoder?.onFailed(Constant.REPORT_ERROR_TYPE_CREATE_THREAD, Constant.ERROR_MSG_CREATE_THREAD)
             isStartRunning = false
             isStartRunning = false
+            decoder?.onFailed(Constant.REPORT_ERROR_TYPE_CREATE_THREAD, Constant.ERROR_MSG_CREATE_THREAD)
+            decoder?.onVideoComplete()
             return
             return
         }
         }
         // 在线程中解析配置
         // 在线程中解析配置
         decoder?.renderThread?.handler?.post {
         decoder?.renderThread?.handler?.post {
             val result = configManager.parseConfig(fileContainer, enableVersion1, videoMode, fps)
             val result = configManager.parseConfig(fileContainer, enableVersion1, videoMode, fps)
             if (result != Constant.OK) {
             if (result != Constant.OK) {
-                decoder?.onFailed(result, Constant.getErrorMsg(result))
                 isStartRunning = false
                 isStartRunning = false
+                decoder?.onFailed(result, Constant.getErrorMsg(result))
+                decoder?.onVideoComplete()
                 return@post
                 return@post
             }
             }
             ALog.i(TAG, "parse ${configManager.config}")
             ALog.i(TAG, "parse ${configManager.config}")

+ 2 - 0
Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/AnimView.kt

@@ -232,6 +232,7 @@ open class AnimView @JvmOverloads constructor(context: Context, attrs: Attribute
             startPlay(fileContainer)
             startPlay(fileContainer)
         } catch (e: Throwable) {
         } catch (e: Throwable) {
             animProxyListener.onFailed(Constant.REPORT_ERROR_TYPE_FILE_ERROR, Constant.ERROR_MSG_FILE_ERROR)
             animProxyListener.onFailed(Constant.REPORT_ERROR_TYPE_FILE_ERROR, Constant.ERROR_MSG_FILE_ERROR)
+            animProxyListener.onVideoComplete()
         }
         }
     }
     }
 
 
@@ -241,6 +242,7 @@ open class AnimView @JvmOverloads constructor(context: Context, attrs: Attribute
             startPlay(fileContainer)
             startPlay(fileContainer)
         } catch (e: Throwable) {
         } catch (e: Throwable) {
             animProxyListener.onFailed(Constant.REPORT_ERROR_TYPE_FILE_ERROR, Constant.ERROR_MSG_FILE_ERROR)
             animProxyListener.onFailed(Constant.REPORT_ERROR_TYPE_FILE_ERROR, Constant.ERROR_MSG_FILE_ERROR)
+            animProxyListener.onVideoComplete()
         }
         }
     }
     }