From 2d45e096b1ef23b8371b65246ed61788c3775c25 Mon Sep 17 00:00:00 2001 From: Rashed Mazumder Date: Mon, 11 Nov 2019 14:52:52 +0600 Subject: [PATCH 1/3] custom chewie player --- CHANGELOG.md | 3 - example/android/gradlew.bat | 180 +++++++++--------- .../ios/Flutter/flutter_export_environment.sh | 8 + example/pubspec.yaml | 5 +- pubspec.yaml | 8 +- 5 files changed, 107 insertions(+), 97 deletions(-) create mode 100755 example/ios/Flutter/flutter_export_environment.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index e74a52430..55a9b2443 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,5 @@ # Changelog -## 0.9.8+1 - * Require latest flutter stable version - ## 0.9.8 * Hero Widget is no longer used (thanks @localpcguy) diff --git a/example/android/gradlew.bat b/example/android/gradlew.bat index 8a0b282aa..aec99730b 100644 --- a/example/android/gradlew.bat +++ b/example/android/gradlew.bat @@ -1,90 +1,90 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windowz variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/example/ios/Flutter/flutter_export_environment.sh b/example/ios/Flutter/flutter_export_environment.sh new file mode 100755 index 000000000..16bc382e9 --- /dev/null +++ b/example/ios/Flutter/flutter_export_environment.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# This is a generated file; do not edit or check into version control. +export "FLUTTER_ROOT=/Users/phillywiggins/lab/flutter" +export "FLUTTER_APPLICATION_PATH=/Users/phillywiggins/lab/chewie/example" +export "FLUTTER_TARGET=lib/main.dart" +export "FLUTTER_BUILD_DIR=build" +export "SYMROOT=${SOURCE_ROOT}/../build/ios" +export "FLUTTER_FRAMEWORK_DIR=/Users/phillywiggins/lab/flutter/bin/cache/artifacts/engine/ios" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 51a24767f..a08264b43 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -4,7 +4,10 @@ description: An example of how to use the chewie for Flutter dependencies: chewie: path: ../ - video_player: ^0.10.0+2 +# video_player: ^0.10.0+2 + video_player: + path: ../../video_player-0.10.1+3 + auto_orientation: ^0.0.2 flutter: sdk: flutter diff --git a/pubspec.yaml b/pubspec.yaml index 4ae616fa5..36dbf2635 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: chewie description: A video player for Flutter with Cupertino and Material play controls -version: 0.9.8+1 +version: 0.9.8 homepage: https://github.com/brianegan/chewie authors: - Brian Egan @@ -8,11 +8,13 @@ authors: environment: sdk: ">=2.0.0-dev.28.0 <3.0.0" - flutter: ">=1.9.1 <2.0.0" dependencies: open_iconic_flutter: ">=0.3.0 <0.4.0" - video_player: ">=0.7.0 <0.11.0" +# video_player: ">=0.7.0 <0.11.0" + video_player: + path: ../video_player-0.10.1+3 + screen: ">=0.0.4 <0.1.0" flutter: sdk: flutter From 8f5d9f0793d83b0121be170ba7c1a944d6d982ea Mon Sep 17 00:00:00 2001 From: Rashed Mazumder Date: Mon, 11 Nov 2019 15:08:13 +0600 Subject: [PATCH 2/3] git video player path added --- example/ios/Flutter/flutter_export_environment.sh | 6 +++--- example/pubspec.yaml | 4 +++- pubspec.yaml | 4 +++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/example/ios/Flutter/flutter_export_environment.sh b/example/ios/Flutter/flutter_export_environment.sh index 16bc382e9..0dc8d1c77 100755 --- a/example/ios/Flutter/flutter_export_environment.sh +++ b/example/ios/Flutter/flutter_export_environment.sh @@ -1,8 +1,8 @@ #!/bin/sh # This is a generated file; do not edit or check into version control. -export "FLUTTER_ROOT=/Users/phillywiggins/lab/flutter" -export "FLUTTER_APPLICATION_PATH=/Users/phillywiggins/lab/chewie/example" +export "FLUTTER_ROOT=/Users/rashedoz/softwares/Softs/flutter" +export "FLUTTER_APPLICATION_PATH=/Volumes/rashed_personal/FLutter_Core_Dev/CustomChewie/chewie/example" export "FLUTTER_TARGET=lib/main.dart" export "FLUTTER_BUILD_DIR=build" export "SYMROOT=${SOURCE_ROOT}/../build/ios" -export "FLUTTER_FRAMEWORK_DIR=/Users/phillywiggins/lab/flutter/bin/cache/artifacts/engine/ios" +export "FLUTTER_FRAMEWORK_DIR=/Users/rashedoz/softwares/Softs/flutter/bin/cache/artifacts/engine/ios" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index a08264b43..5aa7cb8fa 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -6,7 +6,9 @@ dependencies: path: ../ # video_player: ^0.10.0+2 video_player: - path: ../../video_player-0.10.1+3 + git: + url: https://github.com/rashedoz/plugins.git + path: packages/video_player auto_orientation: ^0.0.2 flutter: diff --git a/pubspec.yaml b/pubspec.yaml index 36dbf2635..ca4799eb7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -13,7 +13,9 @@ dependencies: open_iconic_flutter: ">=0.3.0 <0.4.0" # video_player: ">=0.7.0 <0.11.0" video_player: - path: ../video_player-0.10.1+3 + git: + url: https://github.com/rashedoz/plugins.git + path: packages/video_player screen: ">=0.0.4 <0.1.0" flutter: From 8538084b613801319a2585bb92ff967d9d9ef6f4 Mon Sep 17 00:00:00 2001 From: Rashed Mazumder Date: Sun, 29 Dec 2019 17:54:11 +0600 Subject: [PATCH 3/3] Seek after video finish problem solved --- lib/src/material_progress_bar.dart | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/lib/src/material_progress_bar.dart b/lib/src/material_progress_bar.dart index 47bd95d62..9c4144e38 100644 --- a/lib/src/material_progress_bar.dart +++ b/lib/src/material_progress_bar.dart @@ -5,12 +5,12 @@ import 'package:video_player/video_player.dart'; class MaterialVideoProgressBar extends StatefulWidget { MaterialVideoProgressBar( - this.controller, { - ChewieProgressColors colors, - this.onDragEnd, - this.onDragStart, - this.onDragUpdate, - }) : colors = colors ?? ChewieProgressColors(); + this.controller, { + ChewieProgressColors colors, + this.onDragEnd, + this.onDragStart, + this.onDragUpdate, + }) : colors = colors ?? ChewieProgressColors(); final VideoPlayerController controller; final ChewieProgressColors colors; @@ -99,6 +99,12 @@ class _VideoProgressBarState extends State { if (_controllerWasPlaying) { controller.play(); } + /// Seek playes video without resuming the controls to play state + /// Check if seeked from video end then play video controller + if(controller.value.position == controller.value.duration){ + controller.pause(); + } + //////// if (widget.onDragEnd != null) { widget.onDragEnd(); @@ -108,6 +114,13 @@ class _VideoProgressBarState extends State { if (!controller.value.initialized) { return; } + /// Seek playes video without resuming the controls to play state + /// Check and play video if the controller is in pause state + if(!controller.value.isPlaying){ + controller.play(); + } + //////// + seekToRelativePosition(details.globalPosition); }, ); @@ -145,7 +158,7 @@ class _ProgressBarPainter extends CustomPainter { final double playedPartPercent = value.position.inMilliseconds / value.duration.inMilliseconds; final double playedPart = - playedPartPercent > 1 ? size.width : playedPartPercent * size.width; + playedPartPercent > 1 ? size.width : playedPartPercent * size.width; for (DurationRange range in value.buffered) { final double start = range.startFraction(value.duration) * size.width; final double end = range.endFraction(value.duration) * size.width;