提交 a92e1e8b authored 作者: kongdywang's avatar kongdywang

1、android adapt flutter new gradle environment

2、fix ios receive first frame event before play when prePlay 3、fix player will show loading when enter fullScreen that in prePlay status
上级 56225e26
...@@ -5,7 +5,7 @@ buildscript { ...@@ -5,7 +5,7 @@ buildscript {
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:4.1.0' classpath 'com.android.tools.build:gradle:7.2.0'
} }
} }
......
...@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME ...@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
...@@ -21,6 +21,6 @@ ...@@ -21,6 +21,6 @@
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>1.0</string> <string>1.0</string>
<key>MinimumOSVersion</key> <key>MinimumOSVersion</key>
<string>9.0</string> <string>11.0</string>
</dict> </dict>
</plist> </plist>
# Uncomment this line to define a global platform for your project # Uncomment this line to define a global platform for your project
# platform :ios, '9.0' # platform :ios, '11.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency. # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true' ENV['COCOAPODS_DISABLE_STATS'] = 'true'
......
...@@ -371,7 +371,7 @@ ...@@ -371,7 +371,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0; IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO; MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos; SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos; SUPPORTED_PLATFORMS = iphoneos;
...@@ -450,7 +450,7 @@ ...@@ -450,7 +450,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0; IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = YES; MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos; SDKROOT = iphoneos;
...@@ -500,7 +500,7 @@ ...@@ -500,7 +500,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0; IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO; MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos; SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos; SUPPORTED_PLATFORMS = iphoneos;
......
...@@ -54,5 +54,7 @@ ...@@ -54,5 +54,7 @@
<false/> <false/>
<key>io.flutter.embedded_views_preview</key> <key>io.flutter.embedded_views_preview</key>
<true/> <true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
</dict> </dict>
</plist> </plist>
...@@ -396,12 +396,6 @@ static const int CODE_ON_RECEIVE_FIRST_FRAME = 2003; ...@@ -396,12 +396,6 @@ static const int CODE_ON_RECEIVE_FIRST_FRAME = 2003;
(void **)&_latestPixelBuffer)) { (void **)&_latestPixelBuffer)) {
pixelBuffer = _latestPixelBuffer; pixelBuffer = _latestPixelBuffer;
} }
dispatch_async(playerMainqueue, ^{
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),@"EVT_PARAM1":@(self->videoWidth.intValue), @"EVT_PARAM2":@(self->videoHeight.intValue)}]];
self->isVideoFirstFrameReceived = true;
}
});
return pixelBuffer; return pixelBuffer;
} }
...@@ -412,11 +406,12 @@ static const int CODE_ON_RECEIVE_FIRST_FRAME = 2003; ...@@ -412,11 +406,12 @@ static const int CODE_ON_RECEIVE_FIRST_FRAME = 2003;
// Hand over the first frame event timing to Flutter for shared texture processing. // Hand over the first frame event timing to Flutter for shared texture processing.
if (EvtID == CODE_ON_RECEIVE_FIRST_FRAME) { if (EvtID == CODE_ON_RECEIVE_FIRST_FRAME) {
currentPlayTime = 0; currentPlayTime = 0;
dispatch_async(playerMainqueue, ^{ NSMutableDictionary *mutableDic = param.mutableCopy;
self->videoWidth = param[@"EVT_WIDTH"]; self->videoWidth = param[@"EVT_WIDTH"];
self->videoHeight = param[@"EVT_HEIGHT"]; self->videoHeight = param[@"EVT_HEIGHT"];
}); mutableDic[@"EVT_PARAM1"] = self->videoWidth;
return; mutableDic[@"EVT_PARAM2"] = self->videoHeight;
param = mutableDic;
} else if(EvtID == PLAY_EVT_CHANGE_RESOLUTION) { } else if(EvtID == PLAY_EVT_CHANGE_RESOLUTION) {
dispatch_async(playerMainqueue, ^{ dispatch_async(playerMainqueue, ^{
self->videoWidth = param[@"EVT_WIDTH"]; self->videoWidth = param[@"EVT_WIDTH"];
......
...@@ -3,6 +3,7 @@ part of demo_super_player_lib; ...@@ -3,6 +3,7 @@ part of demo_super_player_lib;
enum SuperPlayerState { enum SuperPlayerState {
INIT, // Initial state INIT, // Initial state
PREPARED, // prepared
PLAYING, // Playing PLAYING, // Playing
PAUSE, // Paused PAUSE, // Paused
LOADING, // Buffering LOADING, // Buffering
......
...@@ -133,6 +133,8 @@ class SuperPlayerController { ...@@ -133,6 +133,8 @@ class SuperPlayerController {
_vodPlayerController.resume(); _vodPlayerController.resume();
} }
videoDuration = await _vodPlayerController.getDuration(); videoDuration = await _vodPlayerController.getDuration();
currentDuration = await _vodPlayerController.getCurrentPlaybackTime();
_updatePlayerState(SuperPlayerState.PREPARED);
break; break;
case TXVodPlayEvent.PLAY_EVT_PLAY_LOADING: // PLAY_EVT_PLAY_LOADING case TXVodPlayEvent.PLAY_EVT_PLAY_LOADING: // PLAY_EVT_PLAY_LOADING
if (playerState == SuperPlayerState.PAUSE) { if (playerState == SuperPlayerState.PAUSE) {
...@@ -569,6 +571,8 @@ class SuperPlayerController { ...@@ -569,6 +571,8 @@ class SuperPlayerController {
playerState = state; playerState = state;
switch (state) { switch (state) {
case SuperPlayerState.INIT: case SuperPlayerState.INIT:
break;
case SuperPlayerState.PREPARED:
_observer?.onPlayPrepare(); _observer?.onPlayPrepare();
break; break;
case SuperPlayerState.PLAYING: case SuperPlayerState.PLAYING:
......
...@@ -158,7 +158,7 @@ class SuperPlayerViewState extends State<SuperPlayerView> with WidgetsBindingObs ...@@ -158,7 +158,7 @@ class SuperPlayerViewState extends State<SuperPlayerView> with WidgetsBindingObs
}, () { }, () {
// onPlayPrepare // onPlayPrepare
_isShowCover = true; _isShowCover = true;
_isLoading = true; _isLoading = false;
_togglePlayUIState(false); _togglePlayUIState(false);
}, (name) { }, (name) {
_togglePlayUIState(true); _togglePlayUIState(true);
...@@ -269,6 +269,10 @@ class SuperPlayerViewState extends State<SuperPlayerView> with WidgetsBindingObs ...@@ -269,6 +269,10 @@ class SuperPlayerViewState extends State<SuperPlayerView> with WidgetsBindingObs
_isLoading = true; _isLoading = true;
_coverViewKey.currentState?.hideCover(); _coverViewKey.currentState?.hideCover();
break; break;
case SuperPlayerState.PREPARED:
_isPlaying = false;
_isLoading = false;
break;
case SuperPlayerState.INIT: case SuperPlayerState.INIT:
_isPlaying = false; _isPlaying = false;
_isLoading = true; _isLoading = true;
...@@ -600,7 +604,7 @@ class SuperPlayerViewState extends State<SuperPlayerView> with WidgetsBindingObs ...@@ -600,7 +604,7 @@ class SuperPlayerViewState extends State<SuperPlayerView> with WidgetsBindingObs
int playAction = _playController.videoModel!.playAction; int playAction = _playController.videoModel!.playAction;
if (playerState == SuperPlayerState.LOADING && playAction == SuperPlayerModel.PLAY_ACTION_PRELOAD) { if (playerState == SuperPlayerState.LOADING && playAction == SuperPlayerModel.PLAY_ACTION_PRELOAD) {
_playController.resume(); _playController.resume();
} else if (playerState == SuperPlayerState.INIT) { } else if (playerState == SuperPlayerState.INIT || playerState == SuperPlayerState.PREPARED) {
if (playAction == SuperPlayerModel.PLAY_ACTION_PRELOAD) { if (playAction == SuperPlayerModel.PLAY_ACTION_PRELOAD) {
_playController.resume(); _playController.resume();
} else if (playAction == SuperPlayerModel.PLAY_ACTION_MANUAL_PLAY) { } else if (playAction == SuperPlayerModel.PLAY_ACTION_MANUAL_PLAY) {
...@@ -805,16 +809,16 @@ class FullScreenController { ...@@ -805,16 +809,16 @@ class FullScreenController {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: SystemUiOverlay.values); SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: SystemUiOverlay.values);
} else if (orientationDirection == TXVodPlayEvent.ORIENTATION_LANDSCAPE_RIGHT) { } else if (orientationDirection == TXVodPlayEvent.ORIENTATION_LANDSCAPE_RIGHT) {
enterFullScreen();
SystemChrome.setPreferredOrientations( SystemChrome.setPreferredOrientations(
Platform.isIOS ? [DeviceOrientation.landscapeRight] : [DeviceOrientation.landscapeLeft]); Platform.isIOS ? [DeviceOrientation.landscapeRight] : [DeviceOrientation.landscapeLeft]);
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersive); SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersive);
enterFullScreen();
} else if (orientationDirection == TXVodPlayEvent.ORIENTATION_PORTRAIT_DOWN) { } else if (orientationDirection == TXVodPlayEvent.ORIENTATION_PORTRAIT_DOWN) {
} else if (orientationDirection == TXVodPlayEvent.ORIENTATION_LANDSCAPE_LEFT) { } else if (orientationDirection == TXVodPlayEvent.ORIENTATION_LANDSCAPE_LEFT) {
enterFullScreen();
SystemChrome.setPreferredOrientations( SystemChrome.setPreferredOrientations(
Platform.isIOS ? [DeviceOrientation.landscapeLeft] : [DeviceOrientation.landscapeRight]); Platform.isIOS ? [DeviceOrientation.landscapeLeft] : [DeviceOrientation.landscapeRight]);
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersive); SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersive);
enterFullScreen();
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论