From 7df26e933af80c0957c8ec8c2c9fb92a0398bf73 Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 29 Dec 2021 09:29:59 +0100 Subject: [PATCH 01/18] Updated dependencies --- CHANGELOG.md | 4 + lib/src/video_player/video_player.dart | 2 - pubspec.lock | 238 ++++--------------------- pubspec.yaml | 15 +- 4 files changed, 46 insertions(+), 213 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 88a700a93..d2b06d594 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.0.80 +* Removed pedantic dependency. +* Updated depenedencies. + ## 0.0.79 * Fixed kotlin version issue. diff --git a/lib/src/video_player/video_player.dart b/lib/src/video_player/video_player.dart index ee161c315..baa13428e 100644 --- a/lib/src/video_player/video_player.dart +++ b/lib/src/video_player/video_player.dart @@ -10,8 +10,6 @@ import 'package:better_player/src/video_player/video_player_platform_interface.d import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:meta/meta.dart'; -import 'package:pedantic/pedantic.dart'; final VideoPlayerPlatform _videoPlayerPlatform = VideoPlayerPlatform.instance // This will clear all open videos on the platform when a full restart is diff --git a/pubspec.lock b/pubspec.lock index cc929f2da..05d2839a1 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,7 +7,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.8.1" + version: "2.8.2" boolean_selector: dependency: transitive description: @@ -15,34 +15,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.0" - cached_network_image: - dependency: transitive - description: - name: cached_network_image - url: "https://pub.dartlang.org" - source: hosted - version: "3.1.0" - cached_network_image_platform_interface: - dependency: transitive - description: - name: cached_network_image_platform_interface - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.0" - cached_network_image_web: - dependency: transitive - description: - name: cached_network_image_web - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.1" characters: dependency: transitive description: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" charcode: dependency: transitive description: @@ -64,13 +43,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.15.0" - crypto: - dependency: transitive - description: - name: crypto - url: "https://pub.dartlang.org" - source: hosted - version: "3.0.1" csslib: dependency: transitive description: @@ -84,7 +56,7 @@ packages: name: cupertino_icons url: "https://pub.dartlang.org" source: hosted - version: "1.0.3" + version: "1.0.4" fake_async: dependency: transitive description: @@ -111,20 +83,6 @@ packages: description: flutter source: sdk version: "0.0.0" - flutter_blurhash: - dependency: transitive - description: - name: flutter_blurhash - url: "https://pub.dartlang.org" - source: hosted - version: "0.6.0" - flutter_cache_manager: - dependency: transitive - description: - name: flutter_cache_manager - url: "https://pub.dartlang.org" - source: hosted - version: "3.1.2" flutter_localizations: dependency: "direct dev" description: flutter @@ -146,35 +104,21 @@ packages: name: flutter_widget_from_html_core url: "https://pub.dartlang.org" source: hosted - version: "0.7.0" - html: - dependency: transitive - description: - name: html - url: "https://pub.dartlang.org" - source: hosted - version: "0.15.0" - html_unescape: + version: "0.8.4" + fwfh_text_style: dependency: transitive description: - name: html_unescape + name: fwfh_text_style url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" - http: - dependency: transitive - description: - name: http - url: "https://pub.dartlang.org" - source: hosted - version: "0.13.3" - http_parser: + version: "2.7.2" + html: dependency: transitive description: - name: http_parser + name: html url: "https://pub.dartlang.org" source: hosted - version: "4.0.0" + version: "0.15.0" intl: dependency: transitive description: @@ -195,14 +139,14 @@ packages: name: lint url: "https://pub.dartlang.org" source: hosted - version: "1.5.3" + version: "1.8.1" matcher: dependency: transitive description: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10" + version: "0.12.11" meta: dependency: "direct main" description: @@ -210,13 +154,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.7.0" - octo_image: - dependency: transitive - description: - name: octo_image - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.0+1" path: dependency: transitive description: @@ -230,14 +167,28 @@ packages: name: path_provider url: "https://pub.dartlang.org" source: hosted - version: "2.0.5" + version: "2.0.8" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.11" + path_provider_ios: + dependency: transitive + description: + name: path_provider_ios + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.7" path_provider_linux: dependency: transitive description: name: path_provider_linux url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.2" path_provider_macos: dependency: transitive description: @@ -258,14 +209,7 @@ packages: name: path_provider_windows url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" - pedantic: - dependency: "direct main" - description: - name: pedantic - url: "https://pub.dartlang.org" - source: hosted - version: "1.11.1" + version: "2.0.4" petitparser: dependency: transitive description: @@ -273,13 +217,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "4.3.0" - photo_view: - dependency: transitive - description: - name: photo_view - url: "https://pub.dartlang.org" - source: hosted - version: "0.11.1" platform: dependency: transitive description: @@ -301,13 +238,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "4.1.0" - rxdart: - dependency: transitive - description: - name: rxdart - url: "https://pub.dartlang.org" - source: hosted - version: "0.27.2" sky_engine: dependency: transitive description: flutter @@ -320,20 +250,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.8.1" - sqflite: - dependency: transitive - description: - name: sqflite - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.0+4" - sqflite_common: - dependency: transitive - description: - name: sqflite_common - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.1+1" stack_trace: dependency: transitive description: @@ -355,13 +271,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.0" - synchronized: - dependency: transitive - description: - name: synchronized - url: "https://pub.dartlang.org" - source: hosted - version: "3.0.0" term_glyph: dependency: transitive description: @@ -375,14 +284,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.2" - tweet_ui: - dependency: "direct main" - description: - name: tweet_ui - url: "https://pub.dartlang.org" - source: hosted - version: "3.0.0" + version: "0.4.3" typed_data: dependency: transitive description: @@ -390,90 +292,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.3.0" - url_launcher: - dependency: transitive - description: - name: url_launcher - url: "https://pub.dartlang.org" - source: hosted - version: "6.0.12" - url_launcher_linux: - dependency: transitive - description: - name: url_launcher_linux - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.2" - url_launcher_macos: - dependency: transitive - description: - name: url_launcher_macos - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.2" - url_launcher_platform_interface: - dependency: transitive - description: - name: url_launcher_platform_interface - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.4" - url_launcher_web: - dependency: transitive - description: - name: url_launcher_web - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.4" - url_launcher_windows: - dependency: transitive - description: - name: url_launcher_windows - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.2" - uuid: - dependency: transitive - description: - name: uuid - url: "https://pub.dartlang.org" - source: hosted - version: "3.0.4" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" - video_player: - dependency: transitive - description: - name: video_player - url: "https://pub.dartlang.org" - source: hosted - version: "2.2.5" - video_player_platform_interface: - dependency: transitive - description: - name: video_player_platform_interface - url: "https://pub.dartlang.org" - source: hosted - version: "4.2.0" - video_player_web: - dependency: transitive - description: - name: video_player_web - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.4" + version: "2.1.1" visibility_detector: dependency: "direct main" description: name: visibility_detector url: "https://pub.dartlang.org" source: hosted - version: "0.2.0" + version: "0.2.2" wakelock: dependency: "direct main" description: @@ -529,7 +361,7 @@ packages: name: xml url: "https://pub.dartlang.org" source: hosted - version: "5.3.0" + version: "5.3.1" sdks: - dart: ">=2.14.0 <3.0.0" - flutter: ">=2.5.0" + dart: ">=2.15.0-7.0.dev <3.0.0" + flutter: ">=2.6.0-0" diff --git a/pubspec.yaml b/pubspec.yaml index 7e8310f8e..2d7798222 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: better_player description: Advanced video player based on video_player and Chewie. It's solves many typical use cases and it's easy to run. -version: 0.0.79 +version: 0.0.80 # Disabled because of warning from analyzer # authors: # - Jakub Homlala @@ -14,20 +14,19 @@ environment: dependencies: flutter: sdk: flutter - cupertino_icons: ^1.0.3 + cupertino_icons: ^1.0.4 wakelock: ^0.5.6 - pedantic: ^1.11.1 meta: ^1.7.0 - flutter_widget_from_html_core: ^0.7.0 - visibility_detector: ^0.2.0 - path_provider: ^2.0.5 + flutter_widget_from_html_core: ^0.8.4 + visibility_detector: ^0.2.2 + path_provider: ^2.0.8 collection: ^1.15.0 - xml: ^5.3.0 + xml: ^5.3.1 dev_dependencies: + lint: ^1.8.1 flutter_test: sdk: flutter - lint: ^1.5.3 flutter_localizations: sdk: flutter From f34b048f4ea248418766cade2630850509c61f6b Mon Sep 17 00:00:00 2001 From: Alan Date: Wed, 29 Dec 2021 00:33:00 -0800 Subject: [PATCH 02/18] Fix bug where a render error can occur if the width of the player is less than 240 pixels. (#810) --- lib/src/controls/better_player_material_controls.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/src/controls/better_player_material_controls.dart b/lib/src/controls/better_player_material_controls.dart index ded2121f6..90bc945ad 100644 --- a/lib/src/controls/better_player_material_controls.dart +++ b/lib/src/controls/better_player_material_controls.dart @@ -382,12 +382,12 @@ class _BetterPlayerMaterialControlsState mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ if (_controlsConfiguration.enableSkips) - _buildSkipButton() + Expanded(child: _buildSkipButton()) else const SizedBox(), - _buildReplayButton(_controller!), + Expanded(child: _buildReplayButton(_controller!)), if (_controlsConfiguration.enableSkips) - _buildForwardButton() + Expanded(child: _buildForwardButton()) else const SizedBox(), ], From 760dc96ee91d8cd50b90d683b002e198a66a50dd Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 29 Dec 2021 09:35:20 +0100 Subject: [PATCH 03/18] Updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2b06d594..6b9bcd438 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## 0.0.80 * Removed pedantic dependency. * Updated depenedencies. +* Fixed controls render issue for small player (by https://github.com/admarwick) ## 0.0.79 * Fixed kotlin version issue. From 8bfdb9c96421d60f3e9bcf357ec13e45b1432eb3 Mon Sep 17 00:00:00 2001 From: Peter Majchrak Date: Wed, 29 Dec 2021 09:36:41 +0100 Subject: [PATCH 04/18] Switch from jcenter to mavenCentral (#798) --- android/build.gradle | 6 ++---- example/android/build.gradle | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index ef2bf4a35..dddb0a3be 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -13,7 +13,7 @@ buildscript { repositories { google() - jcenter() + mavenCentral() } dependencies { @@ -24,7 +24,7 @@ buildscript { rootProject.allprojects { repositories { google() - jcenter() + mavenCentral() } } @@ -69,5 +69,3 @@ dependencies { repositories { mavenCentral() } - - diff --git a/example/android/build.gradle b/example/android/build.gradle index ca7d37f31..ab194ad56 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -4,7 +4,7 @@ buildscript { ext.multidexVersion = "2.0.1" repositories { google() - jcenter() + mavenCentral() } dependencies { @@ -16,7 +16,7 @@ buildscript { allprojects { repositories { google() - jcenter() + mavenCentral() } } From 82b5762bba64b77bef2f99d97585af1813a6fbfa Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 29 Dec 2021 09:40:40 +0100 Subject: [PATCH 05/18] Updated changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b9bcd438..d48b9259b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,8 @@ ## 0.0.80 * Removed pedantic dependency. -* Updated depenedencies. +* Updated dependencies. * Fixed controls render issue for small player (by https://github.com/admarwick) +* Fixed deprecated jCenter. Replaced jCenter with mavenCentral (by https://github.com/petoknm) ## 0.0.79 * Fixed kotlin version issue. From b71f27d7ed0daad7ab1161ce079128d0ed5c0bcf Mon Sep 17 00:00:00 2001 From: masoudk2000 <52602761+masoudk2000@users.noreply.github.com> Date: Wed, 29 Dec 2021 12:11:28 +0330 Subject: [PATCH 06/18] Fixed badState error (#796) --- lib/src/controls/better_player_cupertino_progress_bar.dart | 3 ++- lib/src/controls/better_player_material_progress_bar.dart | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/src/controls/better_player_cupertino_progress_bar.dart b/lib/src/controls/better_player_cupertino_progress_bar.dart index 000f44e22..c3c1758f7 100644 --- a/lib/src/controls/better_player_cupertino_progress_bar.dart +++ b/lib/src/controls/better_player_cupertino_progress_bar.dart @@ -37,7 +37,8 @@ class _VideoProgressBarState extends State { _VideoProgressBarState() { listener = () { - setState(() {}); + if (mounted) + setState(() {}); }; } diff --git a/lib/src/controls/better_player_material_progress_bar.dart b/lib/src/controls/better_player_material_progress_bar.dart index bf261c8a7..e894cde44 100644 --- a/lib/src/controls/better_player_material_progress_bar.dart +++ b/lib/src/controls/better_player_material_progress_bar.dart @@ -37,7 +37,8 @@ class _VideoProgressBarState extends State { _VideoProgressBarState() { listener = () { - setState(() {}); + if (mounted) + setState(() {}); }; } From 06081432bfeb52a8f63ab6c8e61a9668ac9338ea Mon Sep 17 00:00:00 2001 From: David Eriksson Date: Wed, 29 Dec 2021 09:44:38 +0100 Subject: [PATCH 07/18] Add dependencies on GCDWebServer and PINCache (#787) Trying to fix part of https://github.com/jhomlala/betterplayer/issues/714 --- ios/better_player.podspec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ios/better_player.podspec b/ios/better_player.podspec index fb9dd7744..99210ca87 100644 --- a/ios/better_player.podspec +++ b/ios/better_player.podspec @@ -16,7 +16,9 @@ A new flutter plugin project. s.public_header_files = 'Classes/**/*.h' s.dependency 'Flutter' s.dependency 'Cache', '~> 6.0.0' + s.dependency 'GCDWebServer' s.dependency 'HLSCachingReverseProxyServer' + s.dependency 'PINCache' s.platform = :ios, '11.0' s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'VALID_ARCHS[sdk=iphonesimulator*]' => 'x86_64' } From c8317af07523a84c3c535ddd6b63029405f7f23f Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 29 Dec 2021 09:45:36 +0100 Subject: [PATCH 08/18] Updated changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d48b9259b..6ca96aa59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ * Updated dependencies. * Fixed controls render issue for small player (by https://github.com/admarwick) * Fixed deprecated jCenter. Replaced jCenter with mavenCentral (by https://github.com/petoknm) +* Fixed iOS GCDWebServer and PINCache import issue (by https://github.com/twogood) +* Added is mounted check in player controls (by https://github.com/masoudk2000) ## 0.0.79 * Fixed kotlin version issue. From 2ab3c8d23eede7eb33d73995236cd670a106f829 Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 29 Dec 2021 10:29:47 +0100 Subject: [PATCH 09/18] Lint & format changes --- .../configuration/better_player_configuration.dart | 4 ---- .../better_player_controls_configuration.dart | 2 -- lib/src/controls/better_player_controls_state.dart | 3 --- .../better_player_cupertino_progress_bar.dart | 4 +--- .../better_player_material_progress_bar.dart | 5 +---- lib/src/core/better_player.dart | 3 --- lib/src/core/better_player_controller.dart | 12 ------------ lib/src/core/better_player_with_controls.dart | 2 -- lib/src/list/better_player_list_video_player.dart | 3 --- lib/src/playlist/better_player_playlist.dart | 4 ---- .../playlist/better_player_playlist_controller.dart | 3 --- .../subtitles/better_player_subtitles_drawer.dart | 2 -- .../subtitles/better_player_subtitles_factory.dart | 2 -- .../video_player/method_channel_video_player.dart | 1 - lib/src/video_player/video_player.dart | 1 - .../video_player_platform_interface.dart | 5 ----- 16 files changed, 2 insertions(+), 54 deletions(-) diff --git a/lib/src/configuration/better_player_configuration.dart b/lib/src/configuration/better_player_configuration.dart index 5eaf5c157..fa9ec564e 100644 --- a/lib/src/configuration/better_player_configuration.dart +++ b/lib/src/configuration/better_player_configuration.dart @@ -1,11 +1,7 @@ import 'package:better_player/better_player.dart'; -import 'package:better_player/src/configuration/better_player_translations.dart'; -import 'package:better_player/src/subtitles/better_player_subtitles_configuration.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'better_player_event.dart'; - ///Configuration of Better Player. Allows to setup general behavior of player. ///Master configuration which contains children that configure specific part ///of player. diff --git a/lib/src/configuration/better_player_controls_configuration.dart b/lib/src/configuration/better_player_controls_configuration.dart index 8d0bf8026..d40bcf5e5 100644 --- a/lib/src/configuration/better_player_controls_configuration.dart +++ b/lib/src/configuration/better_player_controls_configuration.dart @@ -1,6 +1,4 @@ -import 'dart:ui'; import 'package:better_player/better_player.dart'; -import 'package:better_player/src/controls/better_player_overflow_menu_item.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; diff --git a/lib/src/controls/better_player_controls_state.dart b/lib/src/controls/better_player_controls_state.dart index dcd490fe8..a6086b68a 100644 --- a/lib/src/controls/better_player_controls_state.dart +++ b/lib/src/controls/better_player_controls_state.dart @@ -1,11 +1,8 @@ import 'dart:io'; import 'dart:math'; import 'package:better_player/better_player.dart'; -import 'package:better_player/src/asms/better_player_asms_audio_track.dart'; -import 'package:better_player/src/asms/better_player_asms_track.dart'; import 'package:better_player/src/controls/better_player_clickable_widget.dart'; import 'package:better_player/src/core/better_player_utils.dart'; -import 'package:better_player/src/video_player/video_player.dart'; import 'package:collection/collection.dart' show IterableExtension; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; diff --git a/lib/src/controls/better_player_cupertino_progress_bar.dart b/lib/src/controls/better_player_cupertino_progress_bar.dart index c3c1758f7..b0a9107b1 100644 --- a/lib/src/controls/better_player_cupertino_progress_bar.dart +++ b/lib/src/controls/better_player_cupertino_progress_bar.dart @@ -4,7 +4,6 @@ import 'package:better_player/src/core/better_player_controller.dart'; import 'package:better_player/src/video_player/video_player.dart'; import 'package:better_player/src/video_player/video_player_platform_interface.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; class BetterPlayerCupertinoVideoProgressBar extends StatefulWidget { BetterPlayerCupertinoVideoProgressBar( @@ -37,8 +36,7 @@ class _VideoProgressBarState extends State { _VideoProgressBarState() { listener = () { - if (mounted) - setState(() {}); + if (mounted) setState(() {}); }; } diff --git a/lib/src/controls/better_player_material_progress_bar.dart b/lib/src/controls/better_player_material_progress_bar.dart index e894cde44..4d5d07acc 100644 --- a/lib/src/controls/better_player_material_progress_bar.dart +++ b/lib/src/controls/better_player_material_progress_bar.dart @@ -1,10 +1,8 @@ import 'dart:async'; import 'package:better_player/better_player.dart'; -import 'package:better_player/src/controls/better_player_progress_colors.dart'; import 'package:better_player/src/video_player/video_player.dart'; import 'package:better_player/src/video_player/video_player_platform_interface.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; class BetterPlayerMaterialVideoProgressBar extends StatefulWidget { BetterPlayerMaterialVideoProgressBar( @@ -37,8 +35,7 @@ class _VideoProgressBarState extends State { _VideoProgressBarState() { listener = () { - if (mounted) - setState(() {}); + if (mounted) setState(() {}); }; } diff --git a/lib/src/core/better_player.dart b/lib/src/core/better_player.dart index 3f6b081e0..0e0e57d74 100644 --- a/lib/src/core/better_player.dart +++ b/lib/src/core/better_player.dart @@ -5,12 +5,9 @@ import 'package:better_player/src/core/better_player_utils.dart'; import 'package:better_player/src/core/better_player_with_controls.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter/widgets.dart'; import 'package:visibility_detector/visibility_detector.dart'; import 'package:wakelock/wakelock.dart'; -import 'better_player_controller_provider.dart'; - ///Widget which uses provided controller to render video player. class BetterPlayer extends StatefulWidget { const BetterPlayer({Key? key, required this.controller}) : super(key: key); diff --git a/lib/src/core/better_player_controller.dart b/lib/src/core/better_player_controller.dart index cd259522e..50b72f64a 100644 --- a/lib/src/core/better_player_controller.dart +++ b/lib/src/core/better_player_controller.dart @@ -1,19 +1,7 @@ import 'dart:async'; import 'dart:io'; import 'package:better_player/better_player.dart'; -import 'package:better_player/src/asms/better_player_asms_audio_track.dart'; -import 'package:better_player/src/asms/better_player_asms_data_holder.dart'; -import 'package:better_player/src/asms/better_player_asms_subtitle.dart'; -import 'package:better_player/src/asms/better_player_asms_track.dart'; -import 'package:better_player/src/asms/better_player_asms_utils.dart'; -import 'package:better_player/src/configuration/better_player_configuration.dart'; import 'package:better_player/src/configuration/better_player_controller_event.dart'; -import 'package:better_player/src/configuration/better_player_drm_type.dart'; -import 'package:better_player/src/configuration/better_player_event.dart'; -import 'package:better_player/src/configuration/better_player_event_type.dart'; -import 'package:better_player/src/configuration/better_player_translations.dart'; -import 'package:better_player/src/configuration/better_player_video_format.dart'; -import 'package:better_player/src/core/better_player_controller_provider.dart'; import 'package:better_player/src/core/better_player_utils.dart'; import 'package:better_player/src/subtitles/better_player_subtitle.dart'; import 'package:better_player/src/subtitles/better_player_subtitles_factory.dart'; diff --git a/lib/src/core/better_player_with_controls.dart b/lib/src/core/better_player_with_controls.dart index 36ce76b09..abeb328b0 100644 --- a/lib/src/core/better_player_with_controls.dart +++ b/lib/src/core/better_player_with_controls.dart @@ -5,9 +5,7 @@ import 'package:better_player/better_player.dart'; import 'package:better_player/src/configuration/better_player_controller_event.dart'; import 'package:better_player/src/controls/better_player_cupertino_controls.dart'; import 'package:better_player/src/controls/better_player_material_controls.dart'; -import 'package:better_player/src/core/better_player_controller.dart'; import 'package:better_player/src/core/better_player_utils.dart'; -import 'package:better_player/src/subtitles/better_player_subtitles_configuration.dart'; import 'package:better_player/src/subtitles/better_player_subtitles_drawer.dart'; import 'package:better_player/src/video_player/video_player.dart'; import 'package:flutter/material.dart'; diff --git a/lib/src/list/better_player_list_video_player.dart b/lib/src/list/better_player_list_video_player.dart index 590ca4697..79683ddf4 100644 --- a/lib/src/list/better_player_list_video_player.dart +++ b/lib/src/list/better_player_list_video_player.dart @@ -1,8 +1,5 @@ import 'package:better_player/better_player.dart'; -import 'package:better_player/src/configuration/better_player_configuration.dart'; -import 'package:better_player/src/configuration/better_player_data_source.dart'; import 'package:better_player/src/core/better_player_utils.dart'; -import 'package:better_player/src/list/better_player_list_video_player_controller.dart'; import 'package:flutter/material.dart'; ///Special version of Better Player which is used to play video in list view. diff --git a/lib/src/playlist/better_player_playlist.dart b/lib/src/playlist/better_player_playlist.dart index 4a2671ea8..574d32fa1 100644 --- a/lib/src/playlist/better_player_playlist.dart +++ b/lib/src/playlist/better_player_playlist.dart @@ -1,9 +1,5 @@ import 'package:better_player/better_player.dart'; -import 'package:better_player/src/configuration/better_player_configuration.dart'; -import 'package:better_player/src/configuration/better_player_data_source.dart'; import 'package:better_player/src/core/better_player_utils.dart'; -import 'package:better_player/src/playlist/better_player_playlist_configuration.dart'; -import 'package:better_player/src/playlist/better_player_playlist_controller.dart'; // Flutter imports: import 'package:flutter/material.dart'; diff --git a/lib/src/playlist/better_player_playlist_controller.dart b/lib/src/playlist/better_player_playlist_controller.dart index 99a0200cc..5ed7d2c78 100644 --- a/lib/src/playlist/better_player_playlist_controller.dart +++ b/lib/src/playlist/better_player_playlist_controller.dart @@ -1,8 +1,5 @@ import 'dart:async'; - import 'package:better_player/better_player.dart'; -import 'package:better_player/src/configuration/better_player_data_source.dart'; -import 'package:better_player/src/core/better_player_controller.dart'; ///Controller used to manage playlist player. class BetterPlayerPlaylistController { diff --git a/lib/src/subtitles/better_player_subtitles_drawer.dart b/lib/src/subtitles/better_player_subtitles_drawer.dart index 66226ede4..b6c084b0a 100644 --- a/lib/src/subtitles/better_player_subtitles_drawer.dart +++ b/lib/src/subtitles/better_player_subtitles_drawer.dart @@ -1,8 +1,6 @@ import 'dart:async'; import 'package:better_player/better_player.dart'; import 'package:better_player/src/subtitles/better_player_subtitle.dart'; -import 'package:better_player/src/subtitles/better_player_subtitles_configuration.dart'; -import 'package:better_player/src/video_player/video_player.dart'; import 'package:flutter/material.dart'; import 'package:flutter_widget_from_html_core/flutter_widget_from_html_core.dart'; diff --git a/lib/src/subtitles/better_player_subtitles_factory.dart b/lib/src/subtitles/better_player_subtitles_factory.dart index 868df68c1..e21a91d69 100644 --- a/lib/src/subtitles/better_player_subtitles_factory.dart +++ b/lib/src/subtitles/better_player_subtitles_factory.dart @@ -2,9 +2,7 @@ import 'dart:convert'; import 'dart:io'; import 'package:better_player/better_player.dart'; import 'package:better_player/src/core/better_player_utils.dart'; -import 'package:better_player/src/subtitles/better_player_subtitles_source.dart'; import 'better_player_subtitle.dart'; -import 'better_player_subtitles_source_type.dart'; class BetterPlayerSubtitlesFactory { static Future> parseSubtitles( diff --git a/lib/src/video_player/method_channel_video_player.dart b/lib/src/video_player/method_channel_video_player.dart index 0f70fc21a..a4066d5f0 100644 --- a/lib/src/video_player/method_channel_video_player.dart +++ b/lib/src/video_player/method_channel_video_player.dart @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. import 'dart:async'; -import 'dart:ui'; import 'package:better_player/src/configuration/better_player_buffering_configuration.dart'; import 'package:better_player/src/core/better_player_utils.dart'; import 'package:flutter/foundation.dart'; diff --git a/lib/src/video_player/video_player.dart b/lib/src/video_player/video_player.dart index baa13428e..7a8453f13 100644 --- a/lib/src/video_player/video_player.dart +++ b/lib/src/video_player/video_player.dart @@ -7,7 +7,6 @@ import 'dart:async'; import 'dart:io'; import 'package:better_player/src/configuration/better_player_buffering_configuration.dart'; import 'package:better_player/src/video_player/video_player_platform_interface.dart'; -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; diff --git a/lib/src/video_player/video_player_platform_interface.dart b/lib/src/video_player/video_player_platform_interface.dart index 7e3a07b5a..336f54b04 100644 --- a/lib/src/video_player/video_player_platform_interface.dart +++ b/lib/src/video_player/video_player_platform_interface.dart @@ -4,16 +4,11 @@ // Dart imports: import 'dart:async'; -import 'dart:ui'; // Flutter imports: import 'package:better_player/src/configuration/better_player_buffering_configuration.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/widgets.dart'; - -// Package imports: -import 'package:meta/meta.dart' show visibleForTesting; - import 'method_channel_video_player.dart'; /// The interface that implementations of video_player must implement. From 4cca357678c5c62934dcb232d926d2be5b5005b9 Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 29 Dec 2021 10:35:48 +0100 Subject: [PATCH 10/18] Updated installation documentation page --- CHANGELOG.md | 1 + docs/install.md | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ca96aa59..34902e655 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * Fixed deprecated jCenter. Replaced jCenter with mavenCentral (by https://github.com/petoknm) * Fixed iOS GCDWebServer and PINCache import issue (by https://github.com/twogood) * Added is mounted check in player controls (by https://github.com/masoudk2000) +* Updated installation documentation page. ## 0.0.79 * Fixed kotlin version issue. diff --git a/docs/install.md b/docs/install.md index 298e4d0db..af2e4d094 100644 --- a/docs/install.md +++ b/docs/install.md @@ -4,7 +4,7 @@ ```yaml dependencies: - better_player: ^0.0.79 + better_player: ^0.0.80 ``` 2. Install it @@ -21,9 +21,14 @@ import 'package:better_player/better_player.dart'; 4. (Required) iOS configuration -Set deployment info of your project to **min. iOS 11.0 version**. This can be done in XCode in Runner -> General configuration screen. +* Set deployment info of your project to **min. iOS 11.0 version**. +* Set Swift 5 version. -5. (Optional) Additional iOS configuration +5. (Required) Android configuration. +* Set compileSdkVersion to *31*. +* Set kotlin version to *1.5.31*. + +6. (Optional) Additional iOS configuration Add this into your `info.plist` file to support full screen rotation (Better Player will rotate screen to horizontal position when full screen is enabled): From cae601eda2ab3703c489bfae4ff9b47fe52da151 Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 29 Dec 2021 10:37:15 +0100 Subject: [PATCH 11/18] Updated installation documentation page --- docs/install.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/install.md b/docs/install.md index af2e4d094..652867d70 100644 --- a/docs/install.md +++ b/docs/install.md @@ -19,12 +19,13 @@ $ flutter pub get import 'package:better_player/better_player.dart'; ``` -4. (Required) iOS configuration - +4. (Required) iOS configuration + You need to change these settings in order to run Better Player on iOS: * Set deployment info of your project to **min. iOS 11.0 version**. * Set Swift 5 version. -5. (Required) Android configuration. +5. (Required) Android configuration. + You need to change these settings in order to run Better Player on Android: * Set compileSdkVersion to *31*. * Set kotlin version to *1.5.31*. From d881857b1e92c9311448f3d1f65d416a47f86e28 Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 29 Dec 2021 11:34:41 +0100 Subject: [PATCH 12/18] Updated installation documentation page --- docs/install.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/install.md b/docs/install.md index 652867d70..ce6e955e9 100644 --- a/docs/install.md +++ b/docs/install.md @@ -28,6 +28,7 @@ import 'package:better_player/better_player.dart'; You need to change these settings in order to run Better Player on Android: * Set compileSdkVersion to *31*. * Set kotlin version to *1.5.31*. +* Enable multidex. 6. (Optional) Additional iOS configuration From bccc68297f0859110aad5758cd14307925c2de61 Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 29 Dec 2021 12:21:31 +0100 Subject: [PATCH 13/18] Fixed full screen button padding in material controls. --- CHANGELOG.md | 3 ++ example/lib/pages/normal_player_page.dart | 5 +++ .../better_player_material_controls.dart | 32 ++++++++++--------- 3 files changed, 25 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 34902e655..901d4b69c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.0.81 +* Fixed full screen button padding in material controls. + ## 0.0.80 * Removed pedantic dependency. * Updated dependencies. diff --git a/example/lib/pages/normal_player_page.dart b/example/lib/pages/normal_player_page.dart index 8ea1f2701..076107f0d 100644 --- a/example/lib/pages/normal_player_page.dart +++ b/example/lib/pages/normal_player_page.dart @@ -1,6 +1,7 @@ import 'package:better_player/better_player.dart'; import 'package:better_player_example/constants.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; class NormalPlayerPage extends StatefulWidget { @override @@ -19,6 +20,10 @@ class _NormalPlayerPageState extends State { fit: BoxFit.contain, autoPlay: true, looping: true, + deviceOrientationsAfterFullScreen: [ + DeviceOrientation.portraitDown, + DeviceOrientation.portraitUp + ], ); _betterPlayerDataSource = BetterPlayerDataSource( BetterPlayerDataSourceType.network, diff --git a/lib/src/controls/better_player_material_controls.dart b/lib/src/controls/better_player_material_controls.dart index 90bc945ad..a018854bb 100644 --- a/lib/src/controls/better_player_material_controls.dart +++ b/lib/src/controls/better_player_material_controls.dart @@ -334,21 +334,23 @@ class _BetterPlayerMaterialControlsState } Widget _buildExpandButton() { - return BetterPlayerMaterialClickableWidget( - onTap: _onExpandCollapse, - child: AnimatedOpacity( - opacity: controlsNotVisible ? 0.0 : 1.0, - duration: _controlsConfiguration.controlsHideTime, - child: Container( - height: _controlsConfiguration.controlBarHeight, - margin: const EdgeInsets.only(right: 12.0), - padding: const EdgeInsets.symmetric(horizontal: 8.0), - child: Center( - child: Icon( - _betterPlayerController!.isFullScreen - ? _controlsConfiguration.fullscreenDisableIcon - : _controlsConfiguration.fullscreenEnableIcon, - color: _controlsConfiguration.iconsColor, + return Padding( + padding: EdgeInsets.only(right: 12.0), + child: BetterPlayerMaterialClickableWidget( + onTap: _onExpandCollapse, + child: AnimatedOpacity( + opacity: controlsNotVisible ? 0.0 : 1.0, + duration: _controlsConfiguration.controlsHideTime, + child: Container( + height: _controlsConfiguration.controlBarHeight, + padding: const EdgeInsets.symmetric(horizontal: 8.0), + child: Center( + child: Icon( + _betterPlayerController!.isFullScreen + ? _controlsConfiguration.fullscreenDisableIcon + : _controlsConfiguration.fullscreenEnableIcon, + color: _controlsConfiguration.iconsColor, + ), ), ), ), From 2995565201b650b5c63e90b32250337b627e10dc Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 29 Dec 2021 16:52:35 +0100 Subject: [PATCH 14/18] Added setBetterPlayerControlsConfiguration method --- CHANGELOG.md | 1 + docs/controlsconfiguration.md | 9 +++++++++ .../lib/pages/controls_configuration_page.dart | 11 +++++++++++ .../better_player_cupertino_progress_bar.dart | 4 ++-- lib/src/core/better_player_controller.dart | 16 ++++++++++++++++ lib/src/core/better_player_with_controls.dart | 2 +- 6 files changed, 40 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 901d4b69c..0c093dcfb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## 0.0.81 * Fixed full screen button padding in material controls. +* Added `setBetterPlayerControlsConfiguration` in `BetterPlayerControlsConfiguration`. ## 0.0.80 * Removed pedantic dependency. diff --git a/docs/controlsconfiguration.md b/docs/controlsconfiguration.md index 33651b5f7..b785d9d86 100644 --- a/docs/controlsconfiguration.md +++ b/docs/controlsconfiguration.md @@ -163,4 +163,13 @@ final double sigmaX; ///Quality of Gaussian Blur for y (iOS only). final double sigmaY; +``` + +You can change controls configuration in runtime with `setBetterPlayerControlsConfiguration` method of `BetterPlayerController`. + +```dart + _betterPlayerController.setBetterPlayerControlsConfiguration( + BetterPlayerControlsConfiguration( + overflowModalColor: Colors.amberAccent), + ); ``` \ No newline at end of file diff --git a/example/lib/pages/controls_configuration_page.dart b/example/lib/pages/controls_configuration_page.dart index a12c1815a..c3d650010 100644 --- a/example/lib/pages/controls_configuration_page.dart +++ b/example/lib/pages/controls_configuration_page.dart @@ -61,6 +61,17 @@ class _ControlsConfigurationPageState extends State { aspectRatio: 16 / 9, child: BetterPlayer(controller: _betterPlayerController), ), + ElevatedButton( + onPressed: () { + setState(() { + _betterPlayerController.setBetterPlayerControlsConfiguration( + BetterPlayerControlsConfiguration( + overflowModalColor: Colors.amberAccent), + ); + }); + }, + child: Text("Reset settings"), + ) ], ), ); diff --git a/lib/src/controls/better_player_cupertino_progress_bar.dart b/lib/src/controls/better_player_cupertino_progress_bar.dart index b0a9107b1..983754729 100644 --- a/lib/src/controls/better_player_cupertino_progress_bar.dart +++ b/lib/src/controls/better_player_cupertino_progress_bar.dart @@ -67,8 +67,8 @@ class _VideoProgressBarState @override Widget build(BuildContext context) { - final bool enableProgressBarDrag = betterPlayerController! - .betterPlayerConfiguration.controlsConfiguration.enableProgressBarDrag; + final bool enableProgressBarDrag = + betterPlayerController!.betterPlayerControlsConfiguration.enableProgressBarDrag; return GestureDetector( onHorizontalDragStart: (DragStartDetails details) { if (!controller!.value.initialized || !enableProgressBarDrag) { diff --git a/lib/src/core/better_player_controller.dart b/lib/src/core/better_player_controller.dart index 50b72f64a..247f95814 100644 --- a/lib/src/core/better_player_controller.dart +++ b/lib/src/core/better_player_controller.dart @@ -42,6 +42,13 @@ class BetterPlayerController { ///between flutter high level code and lower level native code. VideoPlayerController? videoPlayerController; + ///Controls configuration + late BetterPlayerControlsConfiguration _betterPlayerControlsConfiguration; + + ///Controls configuration + BetterPlayerControlsConfiguration get betterPlayerControlsConfiguration => + _betterPlayerControlsConfiguration; + ///Expose all active eventListeners List get eventListeners => _eventListeners.sublist(1); @@ -205,6 +212,8 @@ class BetterPlayerController { this.betterPlayerPlaylistConfiguration, BetterPlayerDataSource? betterPlayerDataSource, }) { + this._betterPlayerControlsConfiguration = + betterPlayerConfiguration.controlsConfiguration; _eventListeners.add(eventListener); if (betterPlayerDataSource != null) { setupDataSource(betterPlayerDataSource); @@ -1239,6 +1248,13 @@ class BetterPlayerController { betterPlayerDataSource.cacheConfiguration?.key); } + /// Sets the new [betterPlayerControlsConfiguration] instance in the + /// controller. + void setBetterPlayerControlsConfiguration( + BetterPlayerControlsConfiguration betterPlayerControlsConfiguration) { + this._betterPlayerControlsConfiguration = betterPlayerControlsConfiguration; + } + /// Add controller internal event. void _postControllerEvent(BetterPlayerControllerEvent event) { if (!_controllerEventStreamController.isClosed) { diff --git a/lib/src/core/better_player_with_controls.dart b/lib/src/core/better_player_with_controls.dart index abeb328b0..ea553c3db 100644 --- a/lib/src/core/better_player_with_controls.dart +++ b/lib/src/core/better_player_with_controls.dart @@ -25,7 +25,7 @@ class _BetterPlayerWithControlsState extends State { widget.controller!.betterPlayerConfiguration.subtitlesConfiguration; BetterPlayerControlsConfiguration get controlsConfiguration => - widget.controller!.betterPlayerConfiguration.controlsConfiguration; + widget.controller!.betterPlayerControlsConfiguration; final StreamController playerVisibilityStreamController = StreamController(); From 3904ba7c44c3c4baf7a39148b2a4a5bb94a6aeb3 Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 29 Dec 2021 16:58:02 +0100 Subject: [PATCH 15/18] Added `setOverriddenFit` in `BetterPlayerController`. --- CHANGELOG.md | 3 ++- lib/src/core/better_player_controller.dart | 16 ++++++++++++++++ lib/src/core/better_player_with_controls.dart | 2 +- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c093dcfb..e877ccd58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## 0.0.81 * Fixed full screen button padding in material controls. -* Added `setBetterPlayerControlsConfiguration` in `BetterPlayerControlsConfiguration`. +* Added `setBetterPlayerControlsConfiguration` in `BetterPlayerController`. +* Added `setOverriddenFit` in `BetterPlayerController`. ## 0.0.80 * Removed pedantic dependency. diff --git a/lib/src/core/better_player_controller.dart b/lib/src/core/better_player_controller.dart index 247f95814..d1a53bc31 100644 --- a/lib/src/core/better_player_controller.dart +++ b/lib/src/core/better_player_controller.dart @@ -146,6 +146,9 @@ class BetterPlayerController { ///in configuration. double? _overriddenAspectRatio; + ///Overridden fit which will be used instead of fit passed in configuration. + BoxFit? _overriddenFit; + ///Was Picture in Picture opened. bool _wasInPipMode = false; @@ -1036,6 +1039,19 @@ class BetterPlayerController { return _overriddenAspectRatio ?? betterPlayerConfiguration.aspectRatio; } + // ignore: use_setters_to_change_properties + ///Setup overridden fit. + void setOverriddenFit(BoxFit fit) { + _overriddenFit = fit; + } + + ///Get fit used in current video. If fit is null, then fit from + ///BetterPlayerConfiguration will be used. Otherwise [_overriddenFit] will be + ///used. + BoxFit getFit() { + return _overriddenFit ?? betterPlayerConfiguration.fit; + } + ///Enable Picture in Picture (PiP) mode. [betterPlayerGlobalKey] is required ///to open PiP mode in iOS. When device is not supported, PiP mode won't be ///open. diff --git a/lib/src/core/better_player_with_controls.dart b/lib/src/core/better_player_with_controls.dart index ea553c3db..49c91f94e 100644 --- a/lib/src/core/better_player_with_controls.dart +++ b/lib/src/core/better_player_with_controls.dart @@ -134,7 +134,7 @@ class _BetterPlayerWithControlsState extends State { angle: rotation * pi / 180, child: _BetterPlayerVideoFitWidget( betterPlayerController, - betterPlayerController.betterPlayerConfiguration.fit, + betterPlayerController.getFit(), ), ), betterPlayerController.betterPlayerConfiguration.overlay ?? From e5c8e959ef193605825190bfbcf851e9bf868f07 Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 29 Dec 2021 17:00:47 +0100 Subject: [PATCH 16/18] Added `setOverriddenFit` in `BetterPlayerController`. --- docs/_sidebar.md | 1 + docs/overriddenfit.md | 8 ++++++++ example/lib/pages/normal_player_page.dart | 1 + 3 files changed, 10 insertions(+) create mode 100644 docs/overriddenfit.md diff --git a/docs/_sidebar.md b/docs/_sidebar.md index 6838376a7..1bc3c1434 100644 --- a/docs/_sidebar.md +++ b/docs/_sidebar.md @@ -24,6 +24,7 @@ * [Custom element in overflow menu](customelementinoverflowmenu.md) * [Enable/disable controls](enabledisablecontrols.md) * [Overridden aspect ratio](overriddenaspectratio.md) + * [Overridden fit](overriddenfit.md) * [Overriden duration](overriddenduration.md) * [Mix audio with others](mixaudiowithothers.md) * [Manual dispose](manualdispose.md) diff --git a/docs/overriddenfit.md b/docs/overriddenfit.md new file mode 100644 index 000000000..99b5095a3 --- /dev/null +++ b/docs/overriddenfit.md @@ -0,0 +1,8 @@ +## Overriden aspect ratio + +You can override `BetterPlayerConfiguration`'s `fit` parameter in runtime with `setOverridenFit` +method from `betterPlayerController`. + +```dart +betterPlayerController.setOverriddenFit(BoxFit.contain); +``` \ No newline at end of file diff --git a/example/lib/pages/normal_player_page.dart b/example/lib/pages/normal_player_page.dart index 076107f0d..35ba944d7 100644 --- a/example/lib/pages/normal_player_page.dart +++ b/example/lib/pages/normal_player_page.dart @@ -31,6 +31,7 @@ class _NormalPlayerPageState extends State { ); _betterPlayerController = BetterPlayerController(betterPlayerConfiguration); _betterPlayerController.setupDataSource(_betterPlayerDataSource); + _betterPlayerController.setOverriddenFit(BoxFit.contain) super.initState(); } From e4bfae97b9fcffa8a3f7e74ce9c60eb92d2e70cd Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 29 Dec 2021 17:02:55 +0100 Subject: [PATCH 17/18] General refactor --- example/lib/pages/normal_player_page.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/example/lib/pages/normal_player_page.dart b/example/lib/pages/normal_player_page.dart index 35ba944d7..076107f0d 100644 --- a/example/lib/pages/normal_player_page.dart +++ b/example/lib/pages/normal_player_page.dart @@ -31,7 +31,6 @@ class _NormalPlayerPageState extends State { ); _betterPlayerController = BetterPlayerController(betterPlayerConfiguration); _betterPlayerController.setupDataSource(_betterPlayerDataSource); - _betterPlayerController.setOverriddenFit(BoxFit.contain) super.initState(); } From 4cb99f69d715d2cdb70dae4462a47afa6e5ac854 Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 29 Dec 2021 17:29:45 +0100 Subject: [PATCH 18/18] Format --- lib/src/controls/better_player_cupertino_progress_bar.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/src/controls/better_player_cupertino_progress_bar.dart b/lib/src/controls/better_player_cupertino_progress_bar.dart index 983754729..713cb37c9 100644 --- a/lib/src/controls/better_player_cupertino_progress_bar.dart +++ b/lib/src/controls/better_player_cupertino_progress_bar.dart @@ -67,8 +67,8 @@ class _VideoProgressBarState @override Widget build(BuildContext context) { - final bool enableProgressBarDrag = - betterPlayerController!.betterPlayerControlsConfiguration.enableProgressBarDrag; + final bool enableProgressBarDrag = betterPlayerController! + .betterPlayerControlsConfiguration.enableProgressBarDrag; return GestureDetector( onHorizontalDragStart: (DragStartDetails details) { if (!controller!.value.initialized || !enableProgressBarDrag) {