Skip to content

Commit

Permalink
feat: 添加老版本兼容模式开启开关,默认情况下必须有vapc节点才能播放
Browse files Browse the repository at this point in the history
  • Loading branch information
hexleo committed Dec 11, 2020
1 parent 5bdb8d1 commit 07ed885
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,21 @@ class AnimConfigManager(val player: AnimPlayer) {
* 解析配置
* @return true 解析成功 false 解析失败
*/
fun parseConfig(fileContainer: FileContainer, defaultVideoMode: Int, defaultFps: Int): Int {
fun parseConfig(fileContainer: FileContainer, enableVersion1: Boolean, defaultVideoMode: Int, defaultFps: Int): Int {
try {
isParsingConfig = true
// 解析vapc
val time = SystemClock.elapsedRealtime()
val result = parse(fileContainer, defaultVideoMode, defaultFps)
ALog.i(TAG, "parseConfig cost=${SystemClock.elapsedRealtime() - time}ms")
ALog.i(TAG, "parseConfig cost=${SystemClock.elapsedRealtime() - time}ms enableVersion1=$enableVersion1 result=$result")
if (!result) {
isParsingConfig = false
return Constant.REPORT_ERROR_TYPE_PARSE_CONFIG
}
if (config?.isDefaultConfig == true && !enableVersion1) {
isParsingConfig = false
return Constant.REPORT_ERROR_TYPE_PARSE_CONFIG
}
// 插件解析配置
val resultCode = config?.let {
player.pluginManager.onConfigCreate(it)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ class AnimPlayer(val animView: AnimView) {
}
var supportMaskBoolean : Boolean = false
var maskEdgeBlurBoolean : Boolean = false
// 是否兼容老版本 默认不兼容
var enableVersion1 : Boolean = false
// 视频模式
var videoMode: Int = Constant.VIDEO_MODE_SPLIT_HORIZONTAL
var isDetachedFromWindow = false
Expand Down Expand Up @@ -79,7 +81,7 @@ class AnimPlayer(val animView: AnimView) {
}
// 在线程中解析配置
decoder?.renderThread?.handler?.post {
val result = configManager.parseConfig(fileContainer, videoMode, fps)
val result = configManager.parseConfig(fileContainer, enableVersion1, videoMode, fps)
if (result != Constant.OK) {
decoder?.onFailed(result, Constant.getErrorMsg(result))
isStartRunning = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,12 @@ open class AnimView @JvmOverloads constructor(context: Context, attrs: Attribute
player?.updateMaskConfig(maskConfig)
}


@Deprecated("Compatible older version mp4, default false")
fun enableVersion1(enable: Boolean) {
player?.enableVersion1 = enable
}

// 兼容老版本视频模式
@Deprecated("Compatible older version mp4")
fun setVideoMode(mode: Int) {
Expand Down

0 comments on commit 07ed885

Please sign in to comment.