提交 885960ff authored 作者: kongdywang's avatar kongdywang

avoid player reset error & fix android get sys brightness error

上级 8542e0b5
...@@ -47,7 +47,7 @@ public class CommonUtil { ...@@ -47,7 +47,7 @@ public class CommonUtil {
public static boolean isMIUI() { public static boolean isMIUI() {
String pro = getProp(KEY_MIUI_VERSION_NAME); String pro = getProp(KEY_MIUI_VERSION_NAME);
return !TextUtils.equals(pro,"MIUI"); return TextUtils.equals(pro,"MIUI");
} }
public static String getProp(String name) { public static String getProp(String name) {
......
...@@ -41,10 +41,7 @@ class TXPlayerVideoState extends State<TXPlayerVideo> { ...@@ -41,10 +41,7 @@ class TXPlayerVideoState extends State<TXPlayerVideo> {
int remainTextureId = await controller.textureId; int remainTextureId = await controller.textureId;
if (remainTextureId >= 0) { if (remainTextureId >= 0) {
if (remainTextureId != _textureId) { if (remainTextureId != _textureId) {
setState(() { _refreshTextureId(remainTextureId);
LogUtils.d(TAG, "_textureId = $remainTextureId");
_textureId = remainTextureId;
});
} }
} else { } else {
setState(() { setState(() {
...@@ -52,15 +49,20 @@ class TXPlayerVideoState extends State<TXPlayerVideo> { ...@@ -52,15 +49,20 @@ class TXPlayerVideoState extends State<TXPlayerVideo> {
}); });
controller.textureId.then((newTextureId) { controller.textureId.then((newTextureId) {
if (_textureId != newTextureId) { if (_textureId != newTextureId) {
setState(() { _refreshTextureId(newTextureId);
LogUtils.d(TAG, "_textureId = $newTextureId");
_textureId = newTextureId;
});
} }
}); });
} }
} }
void _refreshTextureId(int textureId) {
LogUtils.d(TAG, "_textureId = $textureId");
_textureId = textureId;
if (mounted) {
setState(() {});
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if ((defaultTargetPlatform == TargetPlatform.android) && if ((defaultTargetPlatform == TargetPlatform.android) &&
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论