Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] release 模式下,video 白屏,audio 正常,已关闭混淆 #622

Open
catherinezhxj opened this issue Jan 22, 2024 · 1 comment

Comments

@catherinezhxj
Copy link

catherinezhxj commented Jan 22, 2024

debug 模式一下一切正常
但是 release 模式下手,video 播放就白屏,但是声音正常播放
已关闭混淆
请帮忙看看是什么问题导致的呢
Adroid 系统版本:Android 10
Flutter 相关版本:

Flutter: 2.10.5
Dart: 2.16.2
fijkplayer: 0.11.0

android\app\build.gradle :

 buildTypes {
    release {
        signingConfig signingConfigs.debug
        minifyEnabled false
        shrinkResources false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

android\app\proguard-rules.pro:

-keep class tv.danmaku.ijk.media.player.**{*;}

player 使用逻辑:

  initPlayer() async { //初始化player
     player = FijkPlayer();
     player.setDataSource('https://media.w3.org/2010/05/sintel/trailer_hd.mp4', autoPlay: true);  
    player.addListener(_videoListener); 
  }

  _videoListener() async {
    if(player != null) {
      if(player.state != playerState) { //状态发生改变
        update();
        playerState = player.state; 
      }
      if(playerState == FijkState.completed) {
        //  bubbleController.isShowWelcome.value = false; //  项目相关逻辑
      }
    }
  }

image
image

@catherinezhxj
Copy link
Author

catherinezhxj commented Jan 22, 2024

【问题解决了】
抱歉,不是 FijkView 插件本身的问题
Stack 和 Expanded 嵌套导致的异常 (debug 模式正常,release 异常)
取消了对 FijkView 父级 Expanded 的使用

  @override
  Widget build(BuildContext context) { 
    return GetBuilder(builder: (VideoLogic controller)  {
    if(controller.player == null) return Container();
    //  return  Expanded(
       return Container(
          alignment: Alignment.center,
          color: const Color(0xff111826),
          child: FijkView(
            player: controller.player,
            color: const Color(0xff111826),
            fit: FijkFit.cover,
            ),
        // ),
     );
    }); 
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant