提交 845f2444 authored 作者: kongdywang's avatar kongdywang

fix player component resolution change untimely in the case of adding video Repeatedly

上级 c3e34940
...@@ -211,6 +211,7 @@ class _DemoSuperPlayerState extends State<DemoSuperPlayer> with TXPipPlayerResto ...@@ -211,6 +211,7 @@ class _DemoSuperPlayerState extends State<DemoSuperPlayer> with TXPipPlayerResto
model.appId = appId; model.appId = appId;
if (url.isNotEmpty) { if (url.isNotEmpty) {
model.videoURL = url; model.videoURL = url;
model.coverUrl = DEFAULT_PLACE_HOLDER;
playCurrentModel(model, 0); playCurrentModel(model, 0);
_addVideoToCurrentList(model); _addVideoToCurrentList(model);
} else if (appId != 0 && fileId.isNotEmpty) { } else if (appId != 0 && fileId.isNotEmpty) {
......
...@@ -82,8 +82,8 @@ class _DemoTXLivelayerState extends State<DemoTXLivePlayer> with WidgetsBindingO ...@@ -82,8 +82,8 @@ class _DemoTXLivelayerState extends State<DemoTXLivePlayer> with WidgetsBindingO
} }
void _resizeVideo(Map<dynamic, dynamic> event) { void _resizeVideo(Map<dynamic, dynamic> event) {
int? videoWidth = event[TXVodPlayEvent.EVT_VIDEO_WIDTH]; int? videoWidth = event[TXVodPlayEvent.EVT_PARAM1];
int? videoHeight = event[TXVodPlayEvent.EVT_VIDEO_HEIGHT]; int? videoHeight = event[TXVodPlayEvent.EVT_PARAM2];
if ((videoWidth != null && videoWidth != 0) && (videoHeight != null && videoHeight != 0)) { if ((videoWidth != null && videoWidth != 0) && (videoHeight != null && videoHeight != 0)) {
setState(() { setState(() {
_aspectRatio = 1.0 * videoWidth / videoHeight; _aspectRatio = 1.0 * videoWidth / videoHeight;
......
...@@ -89,8 +89,8 @@ class _DemoTXVodPlayerState extends State<DemoTXVodPlayer> ...@@ -89,8 +89,8 @@ class _DemoTXVodPlayerState extends State<DemoTXVodPlayer>
} }
void _resizeVideo(Map<dynamic, dynamic> event) { void _resizeVideo(Map<dynamic, dynamic> event) {
int? videoWidth = event[TXVodPlayEvent.EVT_VIDEO_WIDTH]; int? videoWidth = event[TXVodPlayEvent.EVT_PARAM1];
int? videoHeight = event[TXVodPlayEvent.EVT_VIDEO_HEIGHT]; int? videoHeight = event[TXVodPlayEvent.EVT_PARAM2];
if ((videoWidth != null && videoWidth != 0) && (videoHeight != null && videoHeight != 0)) { if ((videoWidth != null && videoWidth != 0) && (videoHeight != null && videoHeight != 0)) {
setState(() { setState(() {
_aspectRatio = 1.0 * videoWidth / videoHeight; _aspectRatio = 1.0 * videoWidth / videoHeight;
......
...@@ -524,7 +524,7 @@ static const int CODE_ON_RECEIVE_FIRST_FRAME = 2003; ...@@ -524,7 +524,7 @@ static const int CODE_ON_RECEIVE_FIRST_FRAME = 2003;
} }
dispatch_async(playerMainqueue, ^{ dispatch_async(playerMainqueue, ^{
if(!self->isVideoFirstFrameReceived && nil != pixelBuffer) { if(!self->isVideoFirstFrameReceived && nil != pixelBuffer) {
[self->_eventSink success:[FTXVodPlayer getParamsWithEvent:CODE_ON_RECEIVE_FIRST_FRAME withParams:@{@"EVT_WIDTH":@(self->videoWidth.intValue), @"EVT_HEIGHT":@(self->videoHeight.intValue)}]]; [self->_eventSink success:[FTXVodPlayer getParamsWithEvent:CODE_ON_RECEIVE_FIRST_FRAME withParams:@{@"EVT_WIDTH":@(self->videoWidth.intValue), @"EVT_HEIGHT":@(self->videoHeight.intValue),@"EVT_PARAM1":@(self->videoWidth.intValue), @"EVT_PARAM2":@(self->videoHeight.intValue)}]];
self->isVideoFirstFrameReceived = true; self->isVideoFirstFrameReceived = true;
} }
}); });
......
...@@ -244,6 +244,8 @@ class SuperPlayerController { ...@@ -244,6 +244,8 @@ class SuperPlayerController {
void _configVideoSize(Map<dynamic, dynamic> event) { void _configVideoSize(Map<dynamic, dynamic> event) {
int? eventVideoWidth = event[TXVodPlayEvent.EVT_VIDEO_WIDTH]; int? eventVideoWidth = event[TXVodPlayEvent.EVT_VIDEO_WIDTH];
int? eventVideoHeight = event[TXVodPlayEvent.EVT_VIDEO_HEIGHT]; int? eventVideoHeight = event[TXVodPlayEvent.EVT_VIDEO_HEIGHT];
eventVideoWidth ??= event[TXVodPlayEvent.EVT_PARAM1];
eventVideoHeight ??= event[TXVodPlayEvent.EVT_PARAM2];
if (eventVideoWidth != null && eventVideoWidth != 0) { if (eventVideoWidth != null && eventVideoWidth != 0) {
videoWidth = eventVideoWidth.toDouble(); videoWidth = eventVideoWidth.toDouble();
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论