Skip to content

Commit

Permalink
Merge pull request #435 from yangsfang/master
Browse files Browse the repository at this point in the history
Restore Flutter 3.3-3.7 compatibility
  • Loading branch information
illia-romanenko authored Sep 8, 2023
2 parents 76d14e7 + 403cc3d commit 9467489
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 23 deletions.
6 changes: 3 additions & 3 deletions flutter_vlc_player/example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ android {

defaultConfig {
applicationId "software.solid.fluttervlcplayerexample"
minSdkVersion 20
targetSdkVersion 30
minSdkVersion 23
targetSdkVersion 33
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand All @@ -55,7 +55,7 @@ flutter {
}

dependencies {
testImplementation 'junit:junit:4.12'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode|smallestScreenSize"
android:hardwareAccelerated="true"
android:resizeableActivity="true"
android:windowSoftInputMode="adjustResize">
android:windowSoftInputMode="adjustResize"
android:exported="true">
<!-- This keeps the window background of the activity showing
until Flutter renders its first frame. It can be removed if
there is no splash screen (such as the default splash screen
Expand Down
11 changes: 11 additions & 0 deletions flutter_vlc_player/example/lib/single_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,19 @@ class _SingleTabState extends State<SingleTab> {
]),
),
);
break;
case VideoType.file:
final file = File(initVideo.path);
_controller = VlcPlayerController.file(
file,
);
break;
case VideoType.asset:
_controller = VlcPlayerController.asset(
initVideo.path,
options: VlcPlayerOptions(),
);
break;
case VideoType.recorded:
break;
}
Expand Down Expand Up @@ -160,12 +163,16 @@ class _SingleTabState extends State<SingleTab> {
switch (video.type) {
case VideoType.network:
iconData = Icons.cloud;
break;
case VideoType.file:
iconData = Icons.insert_drive_file;
break;
case VideoType.asset:
iconData = Icons.all_inbox;
break;
case VideoType.recorded:
iconData = Icons.videocam;
break;
}

return ListTile(
Expand Down Expand Up @@ -201,6 +208,7 @@ class _SingleTabState extends State<SingleTab> {
video.path,
hwAcc: HwAcc.full,
);
break;
case VideoType.file:
if (!mounted) break;
ScaffoldMessenger.of(context).showSnackBar(
Expand Down Expand Up @@ -228,11 +236,14 @@ class _SingleTabState extends State<SingleTab> {
),
);
}
break;
case VideoType.asset:
await _controller.setMediaFromAsset(video.path);
break;
case VideoType.recorded:
final recordedFile = File(video.path);
await _controller.setMediaFromFile(recordedFile);
break;
}
setState(() {
selectedVideoIndex = index;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ class VlcPlayerWithControlsState extends State<VlcPlayerWithControls>
child: AnimatedOpacity(
opacity: recordingTextOpacity,
duration: const Duration(seconds: 1),
child: const Wrap(
child: Wrap(
crossAxisAlignment: WrapCrossAlignment.center,
children: [
Icon(Icons.circle, color: Colors.red),
Expand Down
4 changes: 2 additions & 2 deletions flutter_vlc_player/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Demonstrates how to use the flutter_vlc_player plugin.
publish_to: 'none'

environment:
sdk: ">=3.0.5 <4.0.0"
sdk: ">=2.18.0 <4.0.0"

dependencies:
cupertino_icons: ^1.0.5
Expand All @@ -20,7 +20,7 @@ dev_dependencies:
flutter_test:
sdk: flutter

solid_lints: ^0.0.19
solid_lints: ^0.0.18

# The following section is specific to Flutter.
flutter:
Expand Down
2 changes: 2 additions & 0 deletions flutter_vlc_player/lib/src/vlc_app_life_cycle_observer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ class VlcAppLifeCycleObserver extends Object with WidgetsBindingObserver {
case AppLifecycleState.paused:
_wasPlayingBeforePause = _controller.value.isPlaying;
_controller.pause();
break;
case AppLifecycleState.resumed:
if (_wasPlayingBeforePause) {
_controller.play();
}
break;
default:
}
}
Expand Down
17 changes: 9 additions & 8 deletions flutter_vlc_player/lib/src/vlc_player_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -206,14 +206,14 @@ class VlcPlayerController extends ValueNotifier<VlcPlayerValue> {
playingState: PlayingState.buffering,
errorDescription: VlcPlayerValue.noError,
);

break;
case VlcMediaEventType.paused:
value = value.copyWith(
isPlaying: false,
isBuffering: false,
playingState: PlayingState.paused,
);

break;
case VlcMediaEventType.stopped:
value = value.copyWith(
isPlaying: false,
Expand All @@ -222,7 +222,7 @@ class VlcPlayerController extends ValueNotifier<VlcPlayerValue> {
playingState: PlayingState.stopped,
position: Duration.zero,
);

break;
case VlcMediaEventType.playing:
value = value.copyWith(
isEnded: false,
Expand All @@ -238,7 +238,7 @@ class VlcPlayerController extends ValueNotifier<VlcPlayerValue> {
activeSpuTrack: event.activeSpuTrack,
errorDescription: VlcPlayerValue.noError,
);

break;
case VlcMediaEventType.ended:
value = value.copyWith(
isPlaying: false,
Expand All @@ -248,7 +248,7 @@ class VlcPlayerController extends ValueNotifier<VlcPlayerValue> {
playingState: PlayingState.ended,
position: event.position,
);

break;
case VlcMediaEventType.buffering:
case VlcMediaEventType.timeChanged:
value = value.copyWith(
Expand All @@ -269,7 +269,7 @@ class VlcPlayerController extends ValueNotifier<VlcPlayerValue> {
: value.playingState,
errorDescription: VlcPlayerValue.noError,
);

break;
case VlcMediaEventType.mediaChanged:
break;

Expand All @@ -279,7 +279,7 @@ class VlcPlayerController extends ValueNotifier<VlcPlayerValue> {
isRecording: event.isRecording,
recordPath: event.recordPath,
);

break;
case VlcMediaEventType.error:
value = value.copyWith(
isPlaying: false,
Expand All @@ -288,7 +288,7 @@ class VlcPlayerController extends ValueNotifier<VlcPlayerValue> {
playingState: PlayingState.error,
errorDescription: VlcPlayerValue.unknownError,
);

break;
case VlcMediaEventType.unknown:
break;
}
Expand Down Expand Up @@ -318,6 +318,7 @@ class VlcPlayerController extends ValueNotifier<VlcPlayerValue> {
event.rendererId,
event.rendererName,
);
break;
case VlcRendererEventType.unknown:
break;
}
Expand Down
8 changes: 4 additions & 4 deletions flutter_vlc_player/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: flutter_vlc_player
description: A VLC-powered alternative to Flutter's video_player. Supports multiple players on one screen.
version: 7.3.0
version: 7.3.1
homepage: https://github.com/solid-software/flutter_vlc_player/

environment:
sdk: '>=3.0.5 <4.0.0'
flutter: ">=2.12.0"
sdk: '>=2.18.0 <4.0.0'
flutter: ">=3.3.0"

flutter:
plugin:
Expand All @@ -29,4 +29,4 @@ dev_dependencies:

pigeon: ^0.2.4
plugin_platform_interface: ^2.1.3
solid_lints: ^0.0.19
solid_lints: ^0.0.18
8 changes: 4 additions & 4 deletions flutter_vlc_player_platform_interface/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: flutter_vlc_player_platform_interface
description: A common platform interface for the flutter vlc player plugin.
homepage: https://github.com/solid-software/flutter_vlc_player
version: 2.0.3
version: 2.0.4

environment:
sdk: '>=3.0.5 <4.0.0'
flutter: ">=1.12.0"
sdk: '>=2.18.0 <4.0.0'
flutter: ">=3.3.0"

dependencies:
flutter:
Expand All @@ -18,4 +18,4 @@ dev_dependencies:
sdk: flutter

mockito: ^5.3.2
solid_lints: 0.0.19
solid_lints: ^0.0.18

0 comments on commit 9467489

Please sign in to comment.