├── .github └── workflows │ └── ci.yml ├── .gitignore ├── .pubignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── example ├── .gitignore ├── README.md ├── analysis_options.yaml ├── android │ ├── .gitignore │ ├── app │ │ ├── build.gradle │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── kotlin │ │ │ │ └── com │ │ │ │ │ └── example │ │ │ │ │ └── example │ │ │ │ │ └── MainActivity.kt │ │ │ └── res │ │ │ │ ├── drawable-v21 │ │ │ │ └── launch_background.xml │ │ │ │ ├── drawable │ │ │ │ └── launch_background.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── values-night │ │ │ │ └── styles.xml │ │ │ │ └── values │ │ │ │ └── styles.xml │ │ │ └── profile │ │ │ └── AndroidManifest.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ └── settings.gradle ├── assets │ └── SampleVideo_720x480_20mb.mp4 ├── ios │ ├── .gitignore │ ├── Flutter │ │ ├── AppFrameworkInfo.plist │ │ ├── Debug.xcconfig │ │ └── Release.xcconfig │ ├── Podfile │ ├── Podfile.lock │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ └── WorkspaceSettings.xcsettings │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── Runner │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── Icon-App-20x20@1x.png │ │ │ ├── Icon-App-20x20@2x.png │ │ │ ├── Icon-App-20x20@3x.png │ │ │ ├── Icon-App-29x29@1x.png │ │ │ ├── Icon-App-29x29@2x.png │ │ │ ├── Icon-App-29x29@3x.png │ │ │ ├── Icon-App-40x40@1x.png │ │ │ ├── Icon-App-40x40@2x.png │ │ │ ├── Icon-App-40x40@3x.png │ │ │ ├── Icon-App-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ └── LaunchImage.imageset │ │ │ ├── Contents.json │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ └── README.md │ │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ │ ├── Info.plist │ │ └── Runner-Bridging-Header.h ├── lib │ ├── examples │ │ ├── load_vimeo_from_urls.dart │ │ ├── load_youtube_from_urls.dart │ │ ├── play_list_of_videos.dart │ │ └── play_videos_list_dynamically.dart │ ├── main.dart │ └── screens │ │ ├── cutom_video_controllers.dart │ │ ├── from_asset.dart │ │ ├── from_network.dart │ │ ├── from_network_urls.dart │ │ ├── from_vimeo_id.dart │ │ ├── from_vimeo_private_id.dart │ │ └── from_youtube.dart ├── macos │ ├── .gitignore │ ├── Flutter │ │ ├── Flutter-Debug.xcconfig │ │ ├── Flutter-Release.xcconfig │ │ └── GeneratedPluginRegistrant.swift │ ├── Podfile │ ├── Podfile.lock │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── Runner │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── app_icon_1024.png │ │ │ ├── app_icon_128.png │ │ │ ├── app_icon_16.png │ │ │ ├── app_icon_256.png │ │ │ ├── app_icon_32.png │ │ │ ├── app_icon_512.png │ │ │ └── app_icon_64.png │ │ ├── Base.lproj │ │ └── MainMenu.xib │ │ ├── Configs │ │ ├── AppInfo.xcconfig │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ └── Warnings.xcconfig │ │ ├── DebugProfile.entitlements │ │ ├── Info.plist │ │ ├── MainFlutterWindow.swift │ │ └── Release.entitlements ├── pubspec.yaml ├── test │ └── widget_test.dart ├── web │ ├── favicon.png │ ├── icons │ │ ├── Icon-192.png │ │ ├── Icon-512.png │ │ ├── Icon-maskable-192.png │ │ └── Icon-maskable-512.png │ ├── index.html │ └── manifest.json └── windows │ ├── .gitignore │ ├── CMakeLists.txt │ ├── flutter │ ├── CMakeLists.txt │ ├── generated_plugin_registrant.cc │ ├── generated_plugin_registrant.h │ └── generated_plugins.cmake │ └── runner │ ├── CMakeLists.txt │ ├── Runner.rc │ ├── flutter_window.cpp │ ├── flutter_window.h │ ├── main.cpp │ ├── resource.h │ ├── resources │ └── app_icon.ico │ ├── runner.exe.manifest │ ├── utils.cpp │ ├── utils.h │ ├── win32_window.cpp │ └── win32_window.h ├── lib ├── pod_player.dart └── src │ ├── controllers │ ├── pod_base_controller.dart │ ├── pod_gestures_controller.dart │ ├── pod_getx_video_controller.dart │ ├── pod_player_controller.dart │ ├── pod_ui_controller.dart │ ├── pod_video_controller.dart │ └── pod_video_quality_controller.dart │ ├── models │ ├── overlay_options.dart │ ├── play_video_from.dart │ ├── pod_player_config.dart │ ├── pod_player_labels.dart │ ├── pod_progress_bar_config.dart │ └── vimeo_models.dart │ ├── pod_player.dart │ ├── utils │ ├── enums.dart │ ├── logger.dart │ └── video_apis.dart │ └── widgets │ ├── animated_play_pause_icon.dart │ ├── core │ ├── overlays │ │ ├── mobile_bottomsheet.dart │ │ ├── mobile_overlay.dart │ │ ├── overlays.dart │ │ ├── web_dropdown_menu.dart │ │ └── web_overlay.dart │ ├── pod_core_player.dart │ └── video_gesture_detector.dart │ ├── doubble_tap_effect.dart │ ├── double_tap_icon.dart │ ├── full_screen_view.dart │ ├── material_icon_button.dart │ └── pod_progress_bar.dart ├── pubspec.yaml ├── screenshots └── logo.png ├── scripts └── verify_pub.sh └── test └── pod_player_test.dart /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | branches: [master] 6 | pull_request: 7 | branches: [master] 8 | 9 | jobs: 10 | check-format: 11 | name: Check format using flutter format 12 | runs-on: ubuntu-latest 13 | container: cirrusci/flutter:stable 14 | 15 | steps: 16 | - name: Checkout code 17 | uses: actions/checkout@v2 18 | - name: Check format 19 | run: dart format --set-exit-if-changed . 20 | 21 | lint: 22 | name: Check lints 23 | runs-on: ubuntu-latest 24 | container: cirrusci/flutter:stable 25 | 26 | steps: 27 | - name: Checkout code 28 | uses: actions/checkout@v2 29 | - name: Get dependencies 30 | run: flutter pub get 31 | - name: Lint using flutter analyze 32 | run: flutter analyze 33 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. 25 | **/doc/api/ 26 | **/ios/Flutter/.last_build_id 27 | .dart_tool/ 28 | .flutter-plugins 29 | .flutter-plugins-dependencies 30 | .packages 31 | .pub-cache/ 32 | .pub/ 33 | /build/ 34 | 35 | # Web related 36 | lib/generated_plugin_registrant.dart 37 | 38 | # Symbolication related 39 | app.*.symbols 40 | 41 | # Obfuscation related 42 | app.*.map.json 43 | 44 | # Android Studio will place build artifacts here 45 | /android/app/debug 46 | /android/app/profile 47 | /android/app/release 48 | pubspec.lock 49 | .metadata 50 | example/assets/long_video.mkv 51 | -------------------------------------------------------------------------------- /.pubignore: -------------------------------------------------------------------------------- 1 | /build 2 | /example/build 3 | /example/assets/SampleVideo_720x480_20mb.mp4 4 | /scripts -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 0.2.2 2 | - fixed broken vimeo api requests 3 | - upgraded minimum sdk version from ">=2.17.0 <4.0.0" to ">=3.0.0 <4.0.0" 4 | - upgraded all the dependencies to latest version 5 | - fix typos in README.md 6 | 7 | ## 0.2.1 8 | - upgraded all dependencies 9 | - upgraded `http` lib to `^1.1.0` 10 | - fix fullscreen issue in IOS 11 | 12 | ## 0.2.0 13 | - upgraded dependencies 14 | - migrate from `wakelock` to `wakelock_plus` PR [#129](https://github.com/newtaDev/pod_player/pull/129) 15 | - fixed all lint rules 16 | - migrated `VideoPlayerController.network` to `VideoPlayerController.networkUrl` 17 | - Breaking: 18 | - In `PlayVideoFrom.file` [file] param datatype changed from [dynamic] to [File] 19 | ## 0.1.5 20 | - merged PR #103 21 | - support unlisted vimeo videos 22 | - upgraded dependencies 23 | - Updated Readme file 24 | ## 0.1.4 25 | - added pod player logo to pub.dev 26 | ## 0.1.3 27 | - fix: unable to find directory entry in pubspec.yaml #114 28 | - merged PR #109 29 | ## 0.1.2 30 | - fixed #82 31 | ## 0.1.1 32 | - Feature 33 | - support vimeo private video [ref](https://github.com/newtaDev/pod_player#how-to-play-video-from-vimeo-private-videos) 34 | - double tap ripple effect added 35 | - upgraded dependencies 36 | - merged PR #66 #77 #78 37 | ## 0.1.0 38 | 39 | - Breaking change: 40 | 41 | - In `PodPlayerConfig` `initialVideoQuality` changed to `videoQualityPriority` to support priority of video qualities 42 | 43 | ```dart 44 | controller = PodPlayerController( 45 | podPlayerConfig: const PodPlayerConfig( 46 | videoQualityPriority: [1080, 720, 360], 47 | ), 48 | )..initialise() 49 | ``` 50 | 51 | - Features 52 | 53 | - Support for youtube live videos By [`(@vodino)`](https://github.com/vodino) 54 | - Added: `videoQualityPriority` to `PodPlayerConfig` By [`(@emersonsiega)`](https://github.com/emersonsiega) 55 | - Added: callback `onToggleFullScreen` when changes in fullscreen mode [#48](https://github.com/newtaDev/pod_player/issues/48) 56 | - Added: `hideOverlay` and `showOverlay` functions to controller 57 | 58 | - Bug Fixes 59 | - Merged PR #54 By [`(@emersonsiega)`](https://github.com/emersonsiega) 60 | - Fix unhandled exception on initialization [#49](https://github.com/newtaDev/pod_player/issues/49) 61 | - Add video quality priority list 62 | - Changes in `onToggleFullScreen` 63 | 64 | ## 0.0.8 65 | 66 | - Merged PR #37 & #38, By [`(@Jeferson505)`](https://github.com/Jeferson505) 67 | - Added `PodPlayerLabels` param to `PodVideoPlayer` widget 68 | - Added PodPlayerLabels usage example in `from_asset` file 69 | - Seted `normal` playback speed to `1x` 70 | - bug fix and added example for playing videos in list 71 | 72 | ## 0.0.7 73 | 74 | - dependencies upgraded 75 | - video_player: ^2.4.5 76 | - code refactor 77 | 78 | ## 0.0.6 79 | 80 | - Upgraded to Dart 2.17.0 81 | - Bug fixes 82 | - Added some examples 83 | 84 | ## 0.0.5 85 | 86 | - Features 87 | - Added support for thumbnails 88 | - Added `isFullScreen` getter to controller 89 | - Updated docs 90 | 91 | ## 0.0.4 92 | 93 | - Features 94 | - support for RTL (by @karbalaidev) 95 | - initialVideoQuality added 96 | - Bug fixes 97 | 98 | ## 0.0.3 99 | 100 | - Bug fix #4 101 | 102 | ## 0.0.2 103 | 104 | - Ignored .mp4 video file in pub 105 | 106 | ## 0.0.1 107 | 108 | - Initial release 109 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Newton Michael 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:very_good_analysis/analysis_options.yaml 2 | analyzer: 3 | errors: 4 | missing_required_param: error 5 | prefer_const_declarations: warning 6 | prefer_const_constructors: warning 7 | import_of_legacy_library_into_null_safe: warning 8 | public_member_api_docs: ignore 9 | language: 10 | strict-casts: true 11 | strict-raw-types: true 12 | linter: 13 | rules: 14 | omit_local_variable_types: false 15 | prefer_const_declarations: true 16 | prefer_const_constructors: true 17 | public_member_api_docs: false 18 | use_key_in_widget_constructors: true 19 | prefer_int_literals: true 20 | lines_longer_than_80_chars: false 21 | prefer_relative_imports: true 22 | always_use_package_imports: false 23 | avoid_print: true 24 | prefer_single_quotes: true 25 | avoid_redundant_argument_values: true 26 | unnecessary_parenthesis: true 27 | prefer_final_locals: true 28 | avoid_dynamic_calls: false 29 | sort_constructors_first: false 30 | sort_pub_dependencies: false 31 | avoid_positional_boolean_parameters: false 32 | use_build_context_synchronously: false 33 | use_setters_to_change_properties: false 34 | avoid_bool_literals_in_conditional_expressions: false 35 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | **/ios/Flutter/.last_build_id 26 | .dart_tool/ 27 | .flutter-plugins 28 | .flutter-plugins-dependencies 29 | .packages 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Web related 35 | lib/generated_plugin_registrant.dart 36 | 37 | # Symbolication related 38 | app.*.symbols 39 | 40 | # Obfuscation related 41 | app.*.map.json 42 | 43 | # Android Studio will place build artifacts here 44 | /android/app/debug 45 | /android/app/profile 46 | /android/app/release 47 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # example 2 | 3 | A new Flutter project. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.dev/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /example/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer, which statically analyzes Dart code to 2 | # check for errors, warnings, and lints. 3 | # 4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled 5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be 6 | # invoked from the command line by running `flutter analyze`. 7 | 8 | # The following line activates a set of recommended lints for Flutter apps, 9 | # packages, and plugins designed to encourage good coding practices. 10 | include: package:flutter_lints/flutter.yaml 11 | 12 | linter: 13 | # The lint rules applied to this project can be customized in the 14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 15 | # included above or to enable additional rules. A list of all available lints 16 | # and their documentation is published at 17 | # https://dart-lang.github.io/linter/lints/index.html. 18 | # 19 | # Instead of disabling a lint rule for the entire project in the 20 | # section below, it can also be suppressed for a single line of code 21 | # or a specific dart file by using the `// ignore: name_of_lint` and 22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 23 | # producing the lint. 24 | rules: 25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 27 | 28 | # Additional information about this file can be found at 29 | # https://dart.dev/guides/language/analysis-options 30 | -------------------------------------------------------------------------------- /example/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion flutter.compileSdkVersion 30 | ndkVersion flutter.ndkVersion 31 | 32 | compileOptions { 33 | sourceCompatibility JavaVersion.VERSION_1_8 34 | targetCompatibility JavaVersion.VERSION_1_8 35 | } 36 | 37 | kotlinOptions { 38 | jvmTarget = '1.8' 39 | } 40 | 41 | sourceSets { 42 | main.java.srcDirs += 'src/main/kotlin' 43 | } 44 | 45 | defaultConfig { 46 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 47 | applicationId "com.example.example" 48 | // You can update the following values to match your application needs. 49 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration. 50 | minSdkVersion 19 51 | targetSdkVersion flutter.targetSdkVersion 52 | versionCode flutterVersionCode.toInteger() 53 | versionName flutterVersionName 54 | } 55 | 56 | buildTypes { 57 | release { 58 | // TODO: Add your own signing config for the release build. 59 | // Signing with the debug keys for now, so `flutter run --release` works. 60 | signingConfig signingConfigs.debug 61 | } 62 | } 63 | } 64 | 65 | flutter { 66 | source '../..' 67 | } 68 | 69 | dependencies { 70 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 71 | } 72 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 8 | 16 | 20 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /example/android/app/src/main/kotlin/com/example/example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.example 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newtaDev/pod_player/f3ea20e044d50bac6f35ac408edd65276f534540/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newtaDev/pod_player/f3ea20e044d50bac6f35ac408edd65276f534540/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newtaDev/pod_player/f3ea20e044d50bac6f35ac408edd65276f534540/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newtaDev/pod_player/f3ea20e044d50bac6f35ac408edd65276f534540/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newtaDev/pod_player/f3ea20e044d50bac6f35ac408edd65276f534540/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.6.10' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:7.1.2' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | mavenCentral() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | tasks.register("clean", Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip 7 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /example/assets/SampleVideo_720x480_20mb.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newtaDev/pod_player/f3ea20e044d50bac6f35ac408edd65276f534540/example/assets/SampleVideo_720x480_20mb.mp4 -------------------------------------------------------------------------------- /example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 12.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '12.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def flutter_root 14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) 15 | unless File.exist?(generated_xcode_build_settings_path) 16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" 17 | end 18 | 19 | File.foreach(generated_xcode_build_settings_path) do |line| 20 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 21 | return matches[1].strip if matches 22 | end 23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" 24 | end 25 | 26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 27 | 28 | flutter_ios_podfile_setup 29 | 30 | target 'Runner' do 31 | use_frameworks! 32 | use_modular_headers! 33 | 34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 35 | end 36 | 37 | post_install do |installer| 38 | installer.pods_project.targets.each do |target| 39 | flutter_additional_ios_build_settings(target) 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /example/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Flutter (1.0.0) 3 | - package_info_plus (0.4.5): 4 | - Flutter 5 | - video_player_avfoundation (0.0.1): 6 | - Flutter 7 | - FlutterMacOS 8 | - wakelock_plus (0.0.1): 9 | - Flutter 10 | 11 | DEPENDENCIES: 12 | - Flutter (from `Flutter`) 13 | - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`) 14 | - video_player_avfoundation (from `.symlinks/plugins/video_player_avfoundation/darwin`) 15 | - wakelock_plus (from `.symlinks/plugins/wakelock_plus/ios`) 16 | 17 | EXTERNAL SOURCES: 18 | Flutter: 19 | :path: Flutter 20 | package_info_plus: 21 | :path: ".symlinks/plugins/package_info_plus/ios" 22 | video_player_avfoundation: 23 | :path: ".symlinks/plugins/video_player_avfoundation/darwin" 24 | wakelock_plus: 25 | :path: ".symlinks/plugins/wakelock_plus/ios" 26 | 27 | SPEC CHECKSUMS: 28 | Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 29 | package_info_plus: 58f0028419748fad15bf008b270aaa8e54380b1c 30 | video_player_avfoundation: 02011213dab73ae3687df27ce441fbbcc82b5579 31 | wakelock_plus: 78ec7c5b202cab7761af8e2b2b3d0671be6c4ae1 32 | 33 | PODFILE CHECKSUM: c4c93c5f6502fe2754f48404d3594bf779584011 34 | 35 | COCOAPODS: 1.15.2 36 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newtaDev/pod_player/f3ea20e044d50bac6f35ac408edd65276f534540/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newtaDev/pod_player/f3ea20e044d50bac6f35ac408edd65276f534540/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newtaDev/pod_player/f3ea20e044d50bac6f35ac408edd65276f534540/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newtaDev/pod_player/f3ea20e044d50bac6f35ac408edd65276f534540/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newtaDev/pod_player/f3ea20e044d50bac6f35ac408edd65276f534540/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newtaDev/pod_player/f3ea20e044d50bac6f35ac408edd65276f534540/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newtaDev/pod_player/f3ea20e044d50bac6f35ac408edd65276f534540/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newtaDev/pod_player/f3ea20e044d50bac6f35ac408edd65276f534540/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newtaDev/pod_player/f3ea20e044d50bac6f35ac408edd65276f534540/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newtaDev/pod_player/f3ea20e044d50bac6f35ac408edd65276f534540/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newtaDev/pod_player/f3ea20e044d50bac6f35ac408edd65276f534540/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newtaDev/pod_player/f3ea20e044d50bac6f35ac408edd65276f534540/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newtaDev/pod_player/f3ea20e044d50bac6f35ac408edd65276f534540/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newtaDev/pod_player/f3ea20e044d50bac6f35ac408edd65276f534540/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newtaDev/pod_player/f3ea20e044d50bac6f35ac408edd65276f534540/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newtaDev/pod_player/f3ea20e044d50bac6f35ac408edd65276f534540/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newtaDev/pod_player/f3ea20e044d50bac6f35ac408edd65276f534540/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newtaDev/pod_player/f3ea20e044d50bac6f35ac408edd65276f534540/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CADisableMinimumFrameDurationOnPhone 6 | 7 | CFBundleDevelopmentRegion 8 | $(DEVELOPMENT_LANGUAGE) 9 | CFBundleDisplayName 10 | Example 11 | CFBundleExecutable 12 | $(EXECUTABLE_NAME) 13 | CFBundleIdentifier 14 | $(PRODUCT_BUNDLE_IDENTIFIER) 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | example 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | $(FLUTTER_BUILD_NAME) 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | $(FLUTTER_BUILD_NUMBER) 27 | LSRequiresIPhoneOS 28 | 29 | NSAppTransportSecurity 30 | 31 | NSAllowsArbitraryLoads 32 | 33 | 34 | UIApplicationSupportsIndirectInputEvents 35 | 36 | UILaunchStoryboardName 37 | LaunchScreen 38 | UIMainStoryboardFile 39 | Main 40 | UISupportedInterfaceOrientations 41 | 42 | UIInterfaceOrientationPortrait 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | UISupportedInterfaceOrientations~ipad 47 | 48 | UIInterfaceOrientationPortrait 49 | UIInterfaceOrientationPortraitUpsideDown 50 | UIInterfaceOrientationLandscapeLeft 51 | UIInterfaceOrientationLandscapeRight 52 | 53 | UIViewControllerBasedStatusBarAppearance 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /example/lib/examples/load_vimeo_from_urls.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:pod_player/pod_player.dart'; 3 | 4 | void main(List args) { 5 | runApp(const VimeoApp()); 6 | } 7 | 8 | class VimeoApp extends StatelessWidget { 9 | const VimeoApp({Key? key}) : super(key: key); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | return MaterialApp( 14 | home: Scaffold( 15 | appBar: AppBar(title: const Text('Load vimeo video from quality urls')), 16 | body: const VimeoVideoViewer(), 17 | ), 18 | ); 19 | } 20 | } 21 | 22 | class VimeoVideoViewer extends StatefulWidget { 23 | const VimeoVideoViewer({Key? key}) : super(key: key); 24 | 25 | @override 26 | State createState() => VimeoVideoViewerState(); 27 | } 28 | 29 | class VimeoVideoViewerState extends State { 30 | late final PodPlayerController controller; 31 | bool isLoading = true; 32 | @override 33 | void initState() { 34 | loadVideo(); 35 | super.initState(); 36 | } 37 | 38 | void loadVideo() async { 39 | final urls = await PodPlayerController.getVimeoUrls('518228118'); 40 | setState(() => isLoading = false); 41 | controller = PodPlayerController( 42 | playVideoFrom: PlayVideoFrom.networkQualityUrls(videoUrls: urls!), 43 | podPlayerConfig: const PodPlayerConfig( 44 | videoQualityPriority: [360], 45 | ), 46 | )..initialise(); 47 | } 48 | 49 | @override 50 | Widget build(BuildContext context) { 51 | return isLoading 52 | ? const Center(child: CircularProgressIndicator()) 53 | : Center(child: PodVideoPlayer(controller: controller)); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /example/lib/examples/load_youtube_from_urls.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:pod_player/pod_player.dart'; 3 | 4 | void main(List args) { 5 | runApp(const YoutubeApp()); 6 | } 7 | 8 | class YoutubeApp extends StatelessWidget { 9 | const YoutubeApp({Key? key}) : super(key: key); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | return MaterialApp( 14 | home: Scaffold( 15 | appBar: 16 | AppBar(title: const Text('Load youtube video from quality urls')), 17 | body: const YoutubeVideoViewer(), 18 | ), 19 | ); 20 | } 21 | } 22 | 23 | class YoutubeVideoViewer extends StatefulWidget { 24 | const YoutubeVideoViewer({Key? key}) : super(key: key); 25 | 26 | @override 27 | State createState() => _YoutubeVideoViewerState(); 28 | } 29 | 30 | class _YoutubeVideoViewerState extends State { 31 | late final PodPlayerController controller; 32 | bool isLoading = true; 33 | @override 34 | void initState() { 35 | loadVideo(); 36 | super.initState(); 37 | } 38 | 39 | void loadVideo() async { 40 | final urls = await PodPlayerController.getYoutubeUrls( 41 | 'https://youtu.be/A3ltMaM6noM', 42 | ); 43 | setState(() => isLoading = false); 44 | controller = PodPlayerController( 45 | playVideoFrom: PlayVideoFrom.networkQualityUrls(videoUrls: urls!), 46 | podPlayerConfig: const PodPlayerConfig( 47 | videoQualityPriority: [360], 48 | ), 49 | )..initialise(); 50 | } 51 | 52 | @override 53 | Widget build(BuildContext context) { 54 | return isLoading 55 | ? const Center(child: CircularProgressIndicator()) 56 | : Center(child: PodVideoPlayer(controller: controller)); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /example/lib/examples/play_list_of_videos.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:pod_player/pod_player.dart'; 3 | 4 | void main(List args) { 5 | PodVideoPlayer.enableLogs = true; 6 | runApp(const ListOfVideosApp()); 7 | } 8 | 9 | class ListOfVideosApp extends StatelessWidget { 10 | const ListOfVideosApp({Key? key}) : super(key: key); 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | return MaterialApp( 15 | home: Scaffold( 16 | appBar: AppBar(title: const Text("Play List of Videos")), 17 | body: Builder(builder: (context) { 18 | return Center( 19 | child: Column( 20 | mainAxisSize: MainAxisSize.min, 21 | children: [ 22 | ElevatedButton( 23 | child: const Text('List of Asset videos'), 24 | onPressed: () { 25 | Navigator.of(context).push(MaterialPageRoute( 26 | builder: (context) => ListOfVideosScreen( 27 | videosList: [ 28 | PlayVideoFrom.asset( 29 | 'assets/SampleVideo_720x480_20mb.mp4'), 30 | PlayVideoFrom.asset( 31 | 'assets/SampleVideo_720x480_20mb.mp4'), 32 | PlayVideoFrom.asset( 33 | 'assets/SampleVideo_720x480_20mb.mp4'), 34 | PlayVideoFrom.asset( 35 | 'assets/SampleVideo_720x480_20mb.mp4'), 36 | PlayVideoFrom.asset( 37 | 'assets/SampleVideo_720x480_20mb.mp4'), 38 | ], 39 | ), 40 | )); 41 | }), 42 | ElevatedButton( 43 | child: const Text('List of Network videos'), 44 | onPressed: () { 45 | Navigator.of(context).push(MaterialPageRoute( 46 | builder: (context) => ListOfVideosScreen( 47 | videosList: [ 48 | PlayVideoFrom.network( 49 | 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4'), 50 | PlayVideoFrom.network( 51 | 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerFun.mp4'), 52 | PlayVideoFrom.network( 53 | 'https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4'), 54 | PlayVideoFrom.network( 55 | 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerFun.mp4'), 56 | PlayVideoFrom.network( 57 | 'http://techslides.com/demos/sample-videos/small.mp4'), 58 | PlayVideoFrom.network( 59 | 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerFun.mp4'), 60 | PlayVideoFrom.network( 61 | 'http://techslides.com/demos/sample-videos/small.mp4'), 62 | PlayVideoFrom.network( 63 | 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerFun.mp4'), 64 | PlayVideoFrom.network( 65 | 'http://techslides.com/demos/sample-videos/small.mp4'), 66 | PlayVideoFrom.network( 67 | 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerFun.mp4'), 68 | PlayVideoFrom.network( 69 | 'http://techslides.com/demos/sample-videos/small.mp4'), 70 | ], 71 | ), 72 | )); 73 | }), 74 | ], 75 | ), 76 | ); 77 | }), 78 | ), 79 | ); 80 | } 81 | } 82 | 83 | class ListOfVideosScreen extends StatelessWidget { 84 | final List videosList; 85 | const ListOfVideosScreen({Key? key, required this.videosList}) 86 | : super(key: key); 87 | 88 | @override 89 | Widget build(BuildContext context) { 90 | return MaterialApp( 91 | home: Scaffold( 92 | appBar: AppBar(title: const Text("Play List of Videos")), 93 | body: ListOfVideosViewer( 94 | videosList: videosList, 95 | ), 96 | ), 97 | ); 98 | } 99 | } 100 | 101 | class ListOfVideosViewer extends StatefulWidget { 102 | final List videosList; 103 | const ListOfVideosViewer({Key? key, required this.videosList}) 104 | : super(key: key); 105 | 106 | @override 107 | State createState() => _ListOfVideosViewerState(); 108 | } 109 | 110 | class _ListOfVideosViewerState extends State { 111 | List controllers = []; 112 | 113 | @override 114 | void initState() { 115 | widget.videosList.forEach(initListOfVideos); 116 | super.initState(); 117 | } 118 | 119 | void initListOfVideos(PlayVideoFrom playVideoFrom) { 120 | //* lazily Initialise 121 | controllers.add( 122 | PodPlayerController( 123 | playVideoFrom: playVideoFrom, 124 | podPlayerConfig: const PodPlayerConfig(autoPlay: false), 125 | ), 126 | ); 127 | 128 | //* Initialise on init 129 | // controllers.add( 130 | // PodPlayerController( 131 | // playVideoFrom: playVideoFrom, 132 | // podPlayerConfig: const PodPlayerConfig(autoPlay: false), 133 | // )..initialise(), 134 | // ); 135 | } 136 | 137 | @override 138 | void dispose() { 139 | controllers.forEach(_disposeCtr); 140 | super.dispose(); 141 | } 142 | 143 | void _disposeCtr(PodPlayerController ctr) => ctr.dispose(); 144 | 145 | @override 146 | Widget build(BuildContext context) { 147 | return ListView.builder( 148 | itemCount: controllers.length, 149 | itemBuilder: (context, index) { 150 | //Initialize lazily 151 | controllers[index].initialise(); 152 | return Padding( 153 | padding: const EdgeInsets.symmetric(vertical: 40), 154 | child: PodVideoPlayer(controller: controllers[index]), 155 | ); 156 | }, 157 | ); 158 | } 159 | } 160 | -------------------------------------------------------------------------------- /example/lib/examples/play_videos_list_dynamically.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:visibility_detector/visibility_detector.dart'; 3 | 4 | import 'package:pod_player/pod_player.dart'; 5 | 6 | void main(List args) { 7 | PodVideoPlayer.enableLogs = true; 8 | runApp(const ListOfVideosApp()); 9 | } 10 | 11 | class ListOfVideosApp extends StatelessWidget { 12 | const ListOfVideosApp({Key? key}) : super(key: key); 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | return MaterialApp( 17 | home: ListOfVideosScreen( 18 | controllers: [ 19 | PodPlayerController( 20 | playVideoFrom: PlayVideoFrom.youtube( 21 | 'https://www.youtube.com/watch?v=bk6Xst6euQk'), 22 | podPlayerConfig: const PodPlayerConfig(autoPlay: false), 23 | ), 24 | PodPlayerController( 25 | playVideoFrom: 26 | PlayVideoFrom.youtube('https://youtu.be/A3ltMaM6noM'), 27 | podPlayerConfig: const PodPlayerConfig(autoPlay: false), 28 | ), 29 | PodPlayerController( 30 | playVideoFrom: PlayVideoFrom.youtube( 31 | 'https://www.youtube.com/watch?v=TjBA6jy4ako'), 32 | podPlayerConfig: const PodPlayerConfig(autoPlay: false), 33 | ), 34 | PodPlayerController( 35 | playVideoFrom: PlayVideoFrom.youtube( 36 | 'https://www.youtube.com/watch?v=HqFgRHTuDyc'), 37 | podPlayerConfig: const PodPlayerConfig(autoPlay: false), 38 | ), 39 | PodPlayerController( 40 | playVideoFrom: PlayVideoFrom.youtube( 41 | 'https://www.youtube.com/watch?v=GpxD-T060RY'), 42 | podPlayerConfig: const PodPlayerConfig(autoPlay: false), 43 | ), 44 | ], 45 | ), 46 | ); 47 | } 48 | } 49 | 50 | class ListOfVideosScreen extends StatelessWidget { 51 | final List controllers; 52 | 53 | const ListOfVideosScreen({Key? key, required this.controllers}) 54 | : super(key: key); 55 | 56 | @override 57 | Widget build(BuildContext context) { 58 | return MaterialApp( 59 | home: Scaffold( 60 | appBar: AppBar(title: const Text("Play List of Videos")), 61 | body: ListView.builder( 62 | itemCount: controllers.length, 63 | itemBuilder: (context, index) { 64 | return VideoViewer( 65 | controller: controllers[index], 66 | controllers: controllers, 67 | ); 68 | }, 69 | )), 70 | ); 71 | } 72 | } 73 | 74 | class VideoViewer extends StatefulWidget { 75 | final PodPlayerController controller; 76 | final List controllers; 77 | 78 | const VideoViewer({ 79 | Key? key, 80 | required this.controller, 81 | required this.controllers, 82 | }) : super(key: key); 83 | 84 | @override 85 | State createState() => VideoViewerState(); 86 | } 87 | 88 | class VideoViewerState extends State { 89 | @override 90 | void dispose() { 91 | widget.controller.dispose(); 92 | super.dispose(); 93 | } 94 | 95 | @override 96 | Widget build(BuildContext context) { 97 | widget.controller.initialise(); 98 | 99 | return Padding( 100 | padding: const EdgeInsets.symmetric(vertical: 80), 101 | child: VisibilityDetector( 102 | key: Key(widget.controller.getTag), 103 | onVisibilityChanged: (VisibilityInfo info) async { 104 | // print(widget.controllers.any((element) => element.isVideoPlaying)); 105 | // print(info.visibleFraction); 106 | if (info.visibleFraction == 1) { 107 | widget.controller.play(); 108 | } else { 109 | widget.controller.pause(); 110 | } 111 | }, 112 | child: PodVideoPlayer( 113 | controller: widget.controller, 114 | alwaysShowProgressBar: true, 115 | overlayBuilder: (options) { 116 | return Container( 117 | color: Colors.grey.withOpacity(0.2), 118 | child: Row( 119 | children: [ 120 | ElevatedButton( 121 | child: Text( 122 | options.isMute ? 'UnMute' : 'Mute', 123 | ), 124 | onPressed: () { 125 | widget.controller.toggleVolume(); 126 | }, 127 | ), 128 | const SizedBox(width: 10), 129 | ElevatedButton( 130 | child: Text( 131 | options.podVideoState == PodVideoState.paused 132 | ? 'Play' 133 | : 'Pause', 134 | ), 135 | onPressed: () { 136 | widget.controller.togglePlayPause(); 137 | }, 138 | ), 139 | const SizedBox(width: 10), 140 | ElevatedButton( 141 | child: const Text('Full Screen'), 142 | onPressed: () {}, 143 | ), 144 | ], 145 | ), 146 | ); 147 | }), 148 | ), 149 | ); 150 | } 151 | } 152 | -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:example/screens/from_asset.dart'; 2 | import 'package:example/screens/from_network.dart'; 3 | import 'package:example/screens/from_network_urls.dart'; 4 | import 'package:example/screens/from_vimeo_private_id.dart'; 5 | import 'package:example/screens/from_youtube.dart'; 6 | import 'package:flutter/material.dart'; 7 | import 'package:pod_player/pod_player.dart'; 8 | 9 | import 'screens/cutom_video_controllers.dart'; 10 | import 'screens/from_vimeo_id.dart'; 11 | 12 | void main() { 13 | PodVideoPlayer.enableLogs = true; 14 | runApp(const MyApp()); 15 | } 16 | 17 | class MyApp extends StatelessWidget { 18 | const MyApp({Key? key}) : super(key: key); 19 | 20 | @override 21 | Widget build(BuildContext context) { 22 | return MaterialApp( 23 | title: 'Flutter Demo', 24 | routes: { 25 | '/fromVimeoId': (context) => const PlayVideoFromVimeoId(), 26 | '/fromVimeoPrivateId': (context) => const PlayVideoFromVimeoPrivateId(), 27 | '/fromYoutube': (context) => const PlayVideoFromYoutube(), 28 | '/fromAsset': (context) => const PlayVideoFromAsset(), 29 | '/fromNetwork': (context) => const PlayVideoFromNetwork(), 30 | '/fromNetworkQualityUrls': (context) => 31 | const PlayVideoFromNetworkQualityUrls(), 32 | '/customVideo': (context) => const CustomVideoControlls(), 33 | }, 34 | home: const MainPage(), 35 | ); 36 | } 37 | } 38 | 39 | class MainPage extends StatefulWidget { 40 | const MainPage({Key? key}) : super(key: key); 41 | 42 | @override 43 | State createState() => _MainPageState(); 44 | } 45 | 46 | class _MainPageState extends State { 47 | @override 48 | Widget build(BuildContext context) { 49 | return Scaffold( 50 | body: Center( 51 | child: ListView( 52 | shrinkWrap: true, 53 | children: [ 54 | // _button('Play video from File'), 55 | _button( 56 | 'Play video from Network', 57 | onPressed: () => Navigator.of(context).pushNamed('/fromNetwork'), 58 | ), 59 | _button( 60 | 'Play video from Youtube', 61 | onPressed: () => Navigator.of(context).pushNamed('/fromYoutube'), 62 | ), 63 | _button( 64 | 'Play video from Network quality urls', 65 | onPressed: () => 66 | Navigator.of(context).pushNamed('/fromNetworkQualityUrls'), 67 | ), 68 | _button( 69 | 'Play video from Asset (with custom labels)', 70 | onPressed: () => Navigator.of(context).pushNamed('/fromAsset'), 71 | ), 72 | _button( 73 | 'Play video from Vimeo', 74 | onPressed: () => Navigator.of(context).pushNamed('/fromVimeoId'), 75 | ), 76 | _button( 77 | 'Play private video from Vimeo', 78 | onPressed: () => 79 | Navigator.of(context).pushNamed('/fromVimeoPrivateId'), 80 | ), 81 | _button( 82 | 'Custom Video player', 83 | onPressed: () => Navigator.of(context).pushNamed('/customVideo'), 84 | ), 85 | ], 86 | ), 87 | ), 88 | ); 89 | } 90 | 91 | Widget _button(String text, {void Function()? onPressed}) { 92 | return Center( 93 | child: Padding( 94 | padding: const EdgeInsets.all(20), 95 | child: OutlinedButton( 96 | onPressed: onPressed ?? () {}, 97 | child: Text( 98 | text, 99 | style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold), 100 | ), 101 | ), 102 | ), 103 | ); 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /example/lib/screens/from_asset.dart: -------------------------------------------------------------------------------- 1 | import 'package:pod_player/pod_player.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class PlayVideoFromAsset extends StatefulWidget { 5 | const PlayVideoFromAsset({Key? key}) : super(key: key); 6 | 7 | @override 8 | State createState() => _PlayVideoFromAssetState(); 9 | } 10 | 11 | class _PlayVideoFromAssetState extends State { 12 | late final PodPlayerController controller; 13 | @override 14 | void initState() { 15 | controller = PodPlayerController( 16 | playVideoFrom: PlayVideoFrom.asset('assets/SampleVideo_720x480_20mb.mp4'), 17 | )..initialise(); 18 | super.initState(); 19 | } 20 | 21 | @override 22 | void dispose() { 23 | controller.dispose(); 24 | super.dispose(); 25 | } 26 | 27 | @override 28 | Widget build(BuildContext context) { 29 | return Scaffold( 30 | appBar: AppBar( 31 | title: const Text('Play video from Asset (with custom labels)'), 32 | ), 33 | body: Center( 34 | child: PodVideoPlayer( 35 | controller: controller, 36 | podPlayerLabels: const PodPlayerLabels( 37 | play: "PLAY", 38 | pause: "PAUSE", 39 | error: "ERROR WHILE TRYING TO PLAY VIDEO", 40 | exitFullScreen: "EXIT FULL SCREEN", 41 | fullscreen: "FULL SCREEN", 42 | loopVideo: "LOOP VIDEO", 43 | mute: "MUTE", 44 | playbackSpeed: "PLAYBACK SPEED", 45 | settings: "SETTINGS", 46 | unmute: "UNMUTE", 47 | optionEnabled: "YES", 48 | optionDisabled: "NO", 49 | quality: "QUALITY", 50 | ), 51 | ), 52 | ), 53 | ); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /example/lib/screens/from_network.dart: -------------------------------------------------------------------------------- 1 | import 'package:pod_player/pod_player.dart'; 2 | import 'package:flutter/foundation.dart'; 3 | import 'package:flutter/material.dart'; 4 | 5 | class PlayVideoFromNetwork extends StatefulWidget { 6 | const PlayVideoFromNetwork({Key? key}) : super(key: key); 7 | 8 | @override 9 | State createState() => _PlayVideoFromAssetState(); 10 | } 11 | 12 | class _PlayVideoFromAssetState extends State { 13 | late final PodPlayerController controller; 14 | final videoTextFieldCtr = TextEditingController(); 15 | 16 | @override 17 | void initState() { 18 | controller = PodPlayerController( 19 | playVideoFrom: PlayVideoFrom.network( 20 | 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerFun.mp4', 21 | ), 22 | )..initialise(); 23 | super.initState(); 24 | } 25 | 26 | @override 27 | void dispose() { 28 | controller.dispose(); 29 | super.dispose(); 30 | } 31 | 32 | @override 33 | Widget build(BuildContext context) { 34 | return Scaffold( 35 | appBar: AppBar(title: const Text('Play video from Netwok')), 36 | body: SafeArea( 37 | child: Center( 38 | child: ListView( 39 | shrinkWrap: true, 40 | children: [ 41 | PodVideoPlayer( 42 | controller: controller, 43 | podProgressBarConfig: const PodProgressBarConfig( 44 | padding: kIsWeb 45 | ? EdgeInsets.zero 46 | : EdgeInsets.only( 47 | bottom: 20, 48 | left: 20, 49 | right: 20, 50 | ), 51 | playingBarColor: Colors.blue, 52 | circleHandlerColor: Colors.blue, 53 | backgroundColor: Colors.blueGrey, 54 | ), 55 | ), 56 | const SizedBox(height: 40), 57 | _loadVideoFromUrl() 58 | ], 59 | ), 60 | ), 61 | ), 62 | ); 63 | } 64 | 65 | Row _loadVideoFromUrl() { 66 | return Row( 67 | children: [ 68 | Expanded( 69 | flex: 2, 70 | child: TextField( 71 | controller: videoTextFieldCtr, 72 | decoration: const InputDecoration( 73 | labelText: 'Enter video url', 74 | floatingLabelBehavior: FloatingLabelBehavior.always, 75 | hintText: 76 | 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerFun.mp4', 77 | border: OutlineInputBorder(), 78 | ), 79 | ), 80 | ), 81 | const SizedBox(width: 10), 82 | FocusScope( 83 | canRequestFocus: false, 84 | child: ElevatedButton( 85 | onPressed: () async { 86 | if (videoTextFieldCtr.text.isEmpty) { 87 | snackBar('Please enter the url'); 88 | return; 89 | } 90 | try { 91 | snackBar('Loading....'); 92 | FocusScope.of(context).unfocus(); 93 | await controller.changeVideo( 94 | playVideoFrom: PlayVideoFrom.network(videoTextFieldCtr.text), 95 | ); 96 | if (!mounted) return; 97 | ScaffoldMessenger.of(context).hideCurrentSnackBar(); 98 | } catch (e) { 99 | snackBar('Unable to load,\n $e'); 100 | } 101 | }, 102 | child: const Text('Load Video'), 103 | ), 104 | ), 105 | ], 106 | ); 107 | } 108 | 109 | void snackBar(String text) { 110 | ScaffoldMessenger.of(context) 111 | ..hideCurrentSnackBar() 112 | ..showSnackBar( 113 | SnackBar( 114 | content: Text(text), 115 | ), 116 | ); 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /example/lib/screens/from_network_urls.dart: -------------------------------------------------------------------------------- 1 | import 'package:pod_player/pod_player.dart'; 2 | import 'package:flutter/foundation.dart'; 3 | import 'package:flutter/material.dart'; 4 | 5 | class PlayVideoFromNetworkQualityUrls extends StatefulWidget { 6 | const PlayVideoFromNetworkQualityUrls({Key? key}) : super(key: key); 7 | 8 | @override 9 | State createState() => 10 | _PlayVideoFromAssetState(); 11 | } 12 | 13 | class _PlayVideoFromAssetState extends State { 14 | late final PodPlayerController controller; 15 | @override 16 | void initState() { 17 | controller = PodPlayerController( 18 | playVideoFrom: PlayVideoFrom.networkQualityUrls( 19 | videoUrls: [ 20 | VideoQalityUrls( 21 | quality: 360, 22 | url: 23 | 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerFun.mp4', 24 | ), 25 | VideoQalityUrls( 26 | quality: 720, 27 | url: 28 | 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4', 29 | ), 30 | ], 31 | ), 32 | )..initialise(); 33 | super.initState(); 34 | } 35 | 36 | @override 37 | void dispose() { 38 | controller.dispose(); 39 | super.dispose(); 40 | } 41 | 42 | @override 43 | Widget build(BuildContext context) { 44 | return Scaffold( 45 | appBar: AppBar(title: const Text('Play video from Quality urls')), 46 | body: SafeArea( 47 | child: Center( 48 | child: PodVideoPlayer( 49 | controller: controller, 50 | podProgressBarConfig: const PodProgressBarConfig( 51 | padding: kIsWeb 52 | ? EdgeInsets.zero 53 | : EdgeInsets.only( 54 | bottom: 20, 55 | left: 20, 56 | right: 20, 57 | ), 58 | playingBarColor: Colors.blue, 59 | circleHandlerColor: Colors.blue, 60 | backgroundColor: Colors.blueGrey, 61 | ), 62 | ), 63 | ), 64 | ), 65 | ); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /example/lib/screens/from_vimeo_id.dart: -------------------------------------------------------------------------------- 1 | import 'package:pod_player/pod_player.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class PlayVideoFromVimeoId extends StatefulWidget { 5 | const PlayVideoFromVimeoId({Key? key}) : super(key: key); 6 | 7 | @override 8 | State createState() => _PlayVideoFromVimeoIdState(); 9 | } 10 | 11 | class _PlayVideoFromVimeoIdState extends State { 12 | late final PodPlayerController controller; 13 | final videoTextFieldCtr = TextEditingController(); 14 | final hashTextFieldCtr = TextEditingController(); 15 | 16 | @override 17 | void initState() { 18 | controller = PodPlayerController( 19 | playVideoFrom: PlayVideoFrom.vimeo('518228118'), 20 | )..initialise(); 21 | super.initState(); 22 | } 23 | 24 | @override 25 | void dispose() { 26 | controller.dispose(); 27 | super.dispose(); 28 | } 29 | 30 | @override 31 | Widget build(BuildContext context) { 32 | return Scaffold( 33 | appBar: AppBar(title: const Text('Vimeo Player')), 34 | body: SafeArea( 35 | child: Center( 36 | child: ListView( 37 | shrinkWrap: true, 38 | children: [ 39 | PodVideoPlayer(controller: controller), 40 | const SizedBox(height: 40), 41 | _loadVideoFromUrl() 42 | ], 43 | ), 44 | ), 45 | ), 46 | ); 47 | } 48 | 49 | Row _loadVideoFromUrl() { 50 | return Row( 51 | children: [ 52 | Expanded( 53 | flex: 2, 54 | child: TextField( 55 | controller: videoTextFieldCtr, 56 | decoration: const InputDecoration( 57 | labelText: 'Enter vimeo id', 58 | floatingLabelBehavior: FloatingLabelBehavior.always, 59 | hintText: 'ex: 518228118', 60 | border: OutlineInputBorder(), 61 | ), 62 | ), 63 | ), 64 | Expanded( 65 | flex: 2, 66 | child: TextField( 67 | controller: hashTextFieldCtr, 68 | decoration: const InputDecoration( 69 | labelText: 'Enter vimeo hash', 70 | floatingLabelBehavior: FloatingLabelBehavior.always, 71 | hintText: 'ex: ddefbc', 72 | border: OutlineInputBorder(), 73 | ), 74 | ), 75 | ), 76 | const SizedBox(width: 10), 77 | FocusScope( 78 | canRequestFocus: false, 79 | child: ElevatedButton( 80 | onPressed: () async { 81 | if (videoTextFieldCtr.text.isEmpty) { 82 | snackBar('Please enter the id'); 83 | return; 84 | } 85 | try { 86 | snackBar('Loading....'); 87 | FocusScope.of(context).unfocus(); 88 | final vimeoHash = hashTextFieldCtr.text; 89 | await controller.changeVideo( 90 | playVideoFrom: PlayVideoFrom.vimeo( 91 | videoTextFieldCtr.text, 92 | hash: vimeoHash.isNotEmpty ? vimeoHash : null, 93 | ), 94 | ); 95 | if (!mounted) return; 96 | ScaffoldMessenger.of(context).hideCurrentSnackBar(); 97 | } catch (e) { 98 | snackBar('Unable to load,\n $e'); 99 | } 100 | }, 101 | child: const Text('Load Video'), 102 | ), 103 | ), 104 | ], 105 | ); 106 | } 107 | 108 | void snackBar(String text) { 109 | ScaffoldMessenger.of(context) 110 | ..hideCurrentSnackBar() 111 | ..showSnackBar( 112 | SnackBar( 113 | content: Text(text), 114 | ), 115 | ); 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /example/lib/screens/from_vimeo_private_id.dart: -------------------------------------------------------------------------------- 1 | import 'package:pod_player/pod_player.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class PlayVideoFromVimeoPrivateId extends StatefulWidget { 5 | const PlayVideoFromVimeoPrivateId({Key? key}) : super(key: key); 6 | 7 | @override 8 | State createState() => 9 | _PlayVideoFromVimeoPrivateIdState(); 10 | } 11 | 12 | class _PlayVideoFromVimeoPrivateIdState 13 | extends State { 14 | late final PodPlayerController controller; 15 | final videoTextFieldCtr = TextEditingController(); 16 | final tokenTextFieldCtr = TextEditingController(); 17 | 18 | @override 19 | void initState() { 20 | controller = PodPlayerController( 21 | playVideoFrom: PlayVideoFrom.vimeo('518228118'), 22 | )..initialise(); 23 | super.initState(); 24 | } 25 | 26 | @override 27 | void dispose() { 28 | controller.dispose(); 29 | super.dispose(); 30 | } 31 | 32 | @override 33 | Widget build(BuildContext context) { 34 | return Scaffold( 35 | appBar: AppBar(title: const Text('Vimeo Player')), 36 | body: SafeArea( 37 | child: Center( 38 | child: ListView( 39 | shrinkWrap: true, 40 | children: [ 41 | PodVideoPlayer(controller: controller), 42 | const SizedBox(height: 40), 43 | _loadVideoFromUrl() 44 | ], 45 | ), 46 | ), 47 | ), 48 | ); 49 | } 50 | 51 | Row _loadVideoFromUrl() { 52 | return Row( 53 | children: [ 54 | Expanded( 55 | flex: 2, 56 | child: TextField( 57 | controller: videoTextFieldCtr, 58 | decoration: const InputDecoration( 59 | labelText: 'Enter vimeo private id', 60 | floatingLabelBehavior: FloatingLabelBehavior.always, 61 | hintText: 'ex: 518228118', 62 | border: OutlineInputBorder(), 63 | ), 64 | ), 65 | ), 66 | Expanded( 67 | flex: 2, 68 | child: TextField( 69 | controller: tokenTextFieldCtr, 70 | decoration: const InputDecoration( 71 | labelText: 'Enter vimeo access token', 72 | floatingLabelBehavior: FloatingLabelBehavior.always, 73 | hintText: 'ex: {32chars}', 74 | border: OutlineInputBorder(), 75 | ), 76 | ), 77 | ), 78 | const SizedBox(width: 10), 79 | FocusScope( 80 | canRequestFocus: false, 81 | child: ElevatedButton( 82 | onPressed: () async { 83 | if (videoTextFieldCtr.text.isEmpty) { 84 | snackBar('Please enter the id'); 85 | return; 86 | } 87 | if (tokenTextFieldCtr.text.isEmpty) { 88 | snackBar('Please enter the access token'); 89 | return; 90 | } 91 | try { 92 | snackBar('Loading....'); 93 | FocusScope.of(context).unfocus(); 94 | 95 | final Map headers = {}; 96 | headers['Authorization'] = 'Bearer ${tokenTextFieldCtr.text}'; 97 | 98 | await controller.changeVideo( 99 | playVideoFrom: PlayVideoFrom.vimeoPrivateVideos( 100 | videoTextFieldCtr.text, 101 | httpHeaders: headers, 102 | ), 103 | ); 104 | if (!mounted) return; 105 | ScaffoldMessenger.of(context).hideCurrentSnackBar(); 106 | } catch (e) { 107 | snackBar('Unable to load,\n $e'); 108 | } 109 | }, 110 | child: const Text('Load Video'), 111 | ), 112 | ), 113 | ], 114 | ); 115 | } 116 | 117 | void snackBar(String text) { 118 | ScaffoldMessenger.of(context) 119 | ..hideCurrentSnackBar() 120 | ..showSnackBar( 121 | SnackBar( 122 | content: Text(text), 123 | ), 124 | ); 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /example/lib/screens/from_youtube.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:pod_player/pod_player.dart'; 3 | 4 | class PlayVideoFromYoutube extends StatefulWidget { 5 | const PlayVideoFromYoutube({Key? key}) : super(key: key); 6 | 7 | @override 8 | State createState() => _PlayVideoFromVimeoIdState(); 9 | } 10 | 11 | class _PlayVideoFromVimeoIdState extends State { 12 | late final PodPlayerController controller; 13 | final videoTextFieldCtr = TextEditingController(); 14 | @override 15 | void initState() { 16 | controller = PodPlayerController( 17 | playVideoFrom: PlayVideoFrom.youtube('https://youtu.be/A3ltMaM6noM'), 18 | podPlayerConfig: const PodPlayerConfig( 19 | videoQualityPriority: [720, 360], 20 | autoPlay: false, 21 | ), 22 | )..initialise(); 23 | super.initState(); 24 | } 25 | 26 | @override 27 | void dispose() { 28 | controller.dispose(); 29 | super.dispose(); 30 | } 31 | 32 | @override 33 | Widget build(BuildContext context) { 34 | return Scaffold( 35 | appBar: AppBar(title: const Text('Youtube player')), 36 | body: SafeArea( 37 | child: Center( 38 | child: ListView( 39 | shrinkWrap: true, 40 | children: [ 41 | PodVideoPlayer( 42 | controller: controller, 43 | videoThumbnail: const DecorationImage( 44 | image: NetworkImage( 45 | 'https://images.unsplash.com/photo-1569317002804-ab77bcf1bce4?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MXx8dW5zcGxhc2h8ZW58MHx8MHx8&w=1000&q=80', 46 | ), 47 | fit: BoxFit.cover, 48 | ), 49 | ), 50 | const SizedBox(height: 40), 51 | _loadVideoFromUrl() 52 | ], 53 | ), 54 | ), 55 | ), 56 | ); 57 | } 58 | 59 | Row _loadVideoFromUrl() { 60 | return Row( 61 | children: [ 62 | Expanded( 63 | flex: 2, 64 | child: TextField( 65 | controller: videoTextFieldCtr, 66 | decoration: const InputDecoration( 67 | labelText: 'Enter youtube url/id', 68 | floatingLabelBehavior: FloatingLabelBehavior.always, 69 | hintText: 'https://youtu.be/A3ltMaM6noM', 70 | border: OutlineInputBorder(), 71 | ), 72 | ), 73 | ), 74 | const SizedBox(width: 10), 75 | FocusScope( 76 | canRequestFocus: false, 77 | child: ElevatedButton( 78 | onPressed: () async { 79 | if (videoTextFieldCtr.text.isEmpty) { 80 | snackBar('Please enter the url'); 81 | return; 82 | } 83 | try { 84 | snackBar('Loading....'); 85 | FocusScope.of(context).unfocus(); 86 | await controller.changeVideo( 87 | playVideoFrom: PlayVideoFrom.youtube(videoTextFieldCtr.text), 88 | ); 89 | if (!mounted) return; 90 | ScaffoldMessenger.of(context).hideCurrentSnackBar(); 91 | } catch (e) { 92 | snackBar('Unable to load,\n $e'); 93 | } 94 | }, 95 | child: const Text('Load Video'), 96 | ), 97 | ), 98 | ], 99 | ); 100 | } 101 | 102 | void snackBar(String text) { 103 | ScaffoldMessenger.of(context) 104 | ..hideCurrentSnackBar() 105 | ..showSnackBar( 106 | SnackBar( 107 | content: Text(text), 108 | ), 109 | ); 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /example/macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /example/macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import package_info_plus 9 | import video_player_avfoundation 10 | import wakelock_plus 11 | 12 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 13 | FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin")) 14 | FVPVideoPlayerPlugin.register(with: registry.registrar(forPlugin: "FVPVideoPlayerPlugin")) 15 | WakelockPlusMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockPlusMacosPlugin")) 16 | } 17 | -------------------------------------------------------------------------------- /example/macos/Podfile: -------------------------------------------------------------------------------- 1 | platform :osx, '10.11' 2 | 3 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 4 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 5 | 6 | project 'Runner', { 7 | 'Debug' => :debug, 8 | 'Profile' => :release, 9 | 'Release' => :release, 10 | } 11 | 12 | def flutter_root 13 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) 14 | unless File.exist?(generated_xcode_build_settings_path) 15 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" 16 | end 17 | 18 | File.foreach(generated_xcode_build_settings_path) do |line| 19 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 20 | return matches[1].strip if matches 21 | end 22 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" 23 | end 24 | 25 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 26 | 27 | flutter_macos_podfile_setup 28 | 29 | target 'Runner' do 30 | use_frameworks! 31 | use_modular_headers! 32 | 33 | flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) 34 | end 35 | 36 | post_install do |installer| 37 | installer.pods_project.targets.each do |target| 38 | flutter_additional_macos_build_settings(target) 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /example/macos/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - FlutterMacOS (1.0.0) 3 | - media_kit_libs_macos_video (1.0.4): 4 | - FlutterMacOS 5 | - media_kit_native_event_loop (1.0.0): 6 | - FlutterMacOS 7 | - media_kit_video (0.0.1): 8 | - FlutterMacOS 9 | - package_info_plus (0.0.1): 10 | - FlutterMacOS 11 | - screen_brightness_macos (0.1.0): 12 | - FlutterMacOS 13 | - wakelock_plus (0.0.1): 14 | - FlutterMacOS 15 | 16 | DEPENDENCIES: 17 | - FlutterMacOS (from `Flutter/ephemeral`) 18 | - media_kit_libs_macos_video (from `Flutter/ephemeral/.symlinks/plugins/media_kit_libs_macos_video/macos`) 19 | - media_kit_native_event_loop (from `Flutter/ephemeral/.symlinks/plugins/media_kit_native_event_loop/macos`) 20 | - media_kit_video (from `Flutter/ephemeral/.symlinks/plugins/media_kit_video/macos`) 21 | - package_info_plus (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos`) 22 | - screen_brightness_macos (from `Flutter/ephemeral/.symlinks/plugins/screen_brightness_macos/macos`) 23 | - wakelock_plus (from `Flutter/ephemeral/.symlinks/plugins/wakelock_plus/macos`) 24 | 25 | EXTERNAL SOURCES: 26 | FlutterMacOS: 27 | :path: Flutter/ephemeral 28 | media_kit_libs_macos_video: 29 | :path: Flutter/ephemeral/.symlinks/plugins/media_kit_libs_macos_video/macos 30 | media_kit_native_event_loop: 31 | :path: Flutter/ephemeral/.symlinks/plugins/media_kit_native_event_loop/macos 32 | media_kit_video: 33 | :path: Flutter/ephemeral/.symlinks/plugins/media_kit_video/macos 34 | package_info_plus: 35 | :path: Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos 36 | screen_brightness_macos: 37 | :path: Flutter/ephemeral/.symlinks/plugins/screen_brightness_macos/macos 38 | wakelock_plus: 39 | :path: Flutter/ephemeral/.symlinks/plugins/wakelock_plus/macos 40 | 41 | SPEC CHECKSUMS: 42 | FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 43 | media_kit_libs_macos_video: b3e2bbec2eef97c285f2b1baa7963c67c753fb82 44 | media_kit_native_event_loop: 81fd5b45192b72f8b5b69eaf5b540f45777eb8d5 45 | media_kit_video: c75b07f14d59706c775778e4dd47dd027de8d1e5 46 | package_info_plus: 02d7a575e80f194102bef286361c6c326e4c29ce 47 | screen_brightness_macos: 2d6d3af2165592d9a55ffcd95b7550970e41ebda 48 | wakelock_plus: 4783562c9a43d209c458cb9b30692134af456269 49 | 50 | PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7 51 | 52 | COCOAPODS: 1.11.2 53 | -------------------------------------------------------------------------------- /example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /example/macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @NSApplicationMain 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "app_icon_16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "app_icon_32.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "app_icon_32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "app_icon_64.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "app_icon_128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "app_icon_256.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "app_icon_256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "app_icon_512.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "app_icon_512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "app_icon_1024.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newtaDev/pod_player/f3ea20e044d50bac6f35ac408edd65276f534540/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newtaDev/pod_player/f3ea20e044d50bac6f35ac408edd65276f534540/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newtaDev/pod_player/f3ea20e044d50bac6f35ac408edd65276f534540/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newtaDev/pod_player/f3ea20e044d50bac6f35ac408edd65276f534540/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newtaDev/pod_player/f3ea20e044d50bac6f35ac408edd65276f534540/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newtaDev/pod_player/f3ea20e044d50bac6f35ac408edd65276f534540/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newtaDev/pod_player/f3ea20e044d50bac6f35ac408edd65276f534540/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /example/macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = example 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2022 com.example. All rights reserved. 15 | -------------------------------------------------------------------------------- /example/macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /example/macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /example/macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /example/macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /example/macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /example/macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController.init() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /example/macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: example 2 | description: A new Flutter project. 3 | 4 | publish_to: "none" 5 | 6 | version: 1.0.0+1 7 | 8 | environment: 9 | sdk: ">=2.16.1 <3.0.0" 10 | 11 | dependencies: 12 | flutter: 13 | sdk: flutter 14 | 15 | pod_player: 16 | path: ../ 17 | 18 | cupertino_icons: ^1.0.5 19 | visibility_detector: ^0.3.3 20 | 21 | dev_dependencies: 22 | flutter_test: 23 | sdk: flutter 24 | 25 | flutter_lints: ^2.0.1 26 | 27 | flutter: 28 | uses-material-design: true 29 | 30 | assets: 31 | - assets/ -------------------------------------------------------------------------------- /example/test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility that Flutter provides. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:example/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(const MyApp()); 17 | 18 | // Verify that our counter starts at 0. 19 | expect(find.text('0'), findsOneWidget); 20 | expect(find.text('1'), findsNothing); 21 | 22 | // Tap the '+' icon and trigger a frame. 23 | await tester.tap(find.byIcon(Icons.add)); 24 | await tester.pump(); 25 | 26 | // Verify that our counter has incremented. 27 | expect(find.text('0'), findsNothing); 28 | expect(find.text('1'), findsOneWidget); 29 | }); 30 | } 31 | -------------------------------------------------------------------------------- /example/web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newtaDev/pod_player/f3ea20e044d50bac6f35ac408edd65276f534540/example/web/favicon.png -------------------------------------------------------------------------------- /example/web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newtaDev/pod_player/f3ea20e044d50bac6f35ac408edd65276f534540/example/web/icons/Icon-192.png -------------------------------------------------------------------------------- /example/web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newtaDev/pod_player/f3ea20e044d50bac6f35ac408edd65276f534540/example/web/icons/Icon-512.png -------------------------------------------------------------------------------- /example/web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newtaDev/pod_player/f3ea20e044d50bac6f35ac408edd65276f534540/example/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /example/web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newtaDev/pod_player/f3ea20e044d50bac6f35ac408edd65276f534540/example/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /example/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | example 33 | 34 | 35 | 36 | 39 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /example/web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example", 3 | "short_name": "example", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter project.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | }, 22 | { 23 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /example/windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /example/windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(example LANGUAGES CXX) 3 | 4 | set(BINARY_NAME "example") 5 | 6 | cmake_policy(SET CMP0063 NEW) 7 | 8 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 9 | 10 | # Configure build options. 11 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) 12 | if(IS_MULTICONFIG) 13 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" 14 | CACHE STRING "" FORCE) 15 | else() 16 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 17 | set(CMAKE_BUILD_TYPE "Debug" CACHE 18 | STRING "Flutter build mode" FORCE) 19 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 20 | "Debug" "Profile" "Release") 21 | endif() 22 | endif() 23 | 24 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") 25 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") 26 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") 27 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") 28 | 29 | # Use Unicode for all projects. 30 | add_definitions(-DUNICODE -D_UNICODE) 31 | 32 | # Compilation settings that should be applied to most targets. 33 | function(APPLY_STANDARD_SETTINGS TARGET) 34 | target_compile_features(${TARGET} PUBLIC cxx_std_17) 35 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") 36 | target_compile_options(${TARGET} PRIVATE /EHsc) 37 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") 38 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") 39 | endfunction() 40 | 41 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 42 | 43 | # Flutter library and tool build rules. 44 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 45 | 46 | # Application build 47 | add_subdirectory("runner") 48 | 49 | # Generated plugin build rules, which manage building the plugins and adding 50 | # them to the application. 51 | include(flutter/generated_plugins.cmake) 52 | 53 | 54 | # === Installation === 55 | # Support files are copied into place next to the executable, so that it can 56 | # run in place. This is done instead of making a separate bundle (as on Linux) 57 | # so that building and running from within Visual Studio will work. 58 | set(BUILD_BUNDLE_DIR "$") 59 | # Make the "install" step default, as it's required to run. 60 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) 61 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 62 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 63 | endif() 64 | 65 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 66 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") 67 | 68 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 69 | COMPONENT Runtime) 70 | 71 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 72 | COMPONENT Runtime) 73 | 74 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 75 | COMPONENT Runtime) 76 | 77 | if(PLUGIN_BUNDLED_LIBRARIES) 78 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 79 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 80 | COMPONENT Runtime) 81 | endif() 82 | 83 | # Fully re-copy the assets directory on each build to avoid having stale files 84 | # from a previous install. 85 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 86 | install(CODE " 87 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 88 | " COMPONENT Runtime) 89 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 90 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 91 | 92 | # Install the AOT library on non-Debug builds only. 93 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 94 | CONFIGURATIONS Profile;Release 95 | COMPONENT Runtime) 96 | -------------------------------------------------------------------------------- /example/windows/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | 3 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 4 | 5 | # Configuration provided via flutter tool. 6 | include(${EPHEMERAL_DIR}/generated_config.cmake) 7 | 8 | # TODO: Move the rest of this into files in ephemeral. See 9 | # https://github.com/flutter/flutter/issues/57146. 10 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") 11 | 12 | # === Flutter Library === 13 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") 14 | 15 | # Published to parent scope for install step. 16 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 17 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 18 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 19 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) 20 | 21 | list(APPEND FLUTTER_LIBRARY_HEADERS 22 | "flutter_export.h" 23 | "flutter_windows.h" 24 | "flutter_messenger.h" 25 | "flutter_plugin_registrar.h" 26 | "flutter_texture_registrar.h" 27 | ) 28 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") 29 | add_library(flutter INTERFACE) 30 | target_include_directories(flutter INTERFACE 31 | "${EPHEMERAL_DIR}" 32 | ) 33 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") 34 | add_dependencies(flutter flutter_assemble) 35 | 36 | # === Wrapper === 37 | list(APPEND CPP_WRAPPER_SOURCES_CORE 38 | "core_implementations.cc" 39 | "standard_codec.cc" 40 | ) 41 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") 42 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN 43 | "plugin_registrar.cc" 44 | ) 45 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") 46 | list(APPEND CPP_WRAPPER_SOURCES_APP 47 | "flutter_engine.cc" 48 | "flutter_view_controller.cc" 49 | ) 50 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") 51 | 52 | # Wrapper sources needed for a plugin. 53 | add_library(flutter_wrapper_plugin STATIC 54 | ${CPP_WRAPPER_SOURCES_CORE} 55 | ${CPP_WRAPPER_SOURCES_PLUGIN} 56 | ) 57 | apply_standard_settings(flutter_wrapper_plugin) 58 | set_target_properties(flutter_wrapper_plugin PROPERTIES 59 | POSITION_INDEPENDENT_CODE ON) 60 | set_target_properties(flutter_wrapper_plugin PROPERTIES 61 | CXX_VISIBILITY_PRESET hidden) 62 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) 63 | target_include_directories(flutter_wrapper_plugin PUBLIC 64 | "${WRAPPER_ROOT}/include" 65 | ) 66 | add_dependencies(flutter_wrapper_plugin flutter_assemble) 67 | 68 | # Wrapper sources needed for the runner. 69 | add_library(flutter_wrapper_app STATIC 70 | ${CPP_WRAPPER_SOURCES_CORE} 71 | ${CPP_WRAPPER_SOURCES_APP} 72 | ) 73 | apply_standard_settings(flutter_wrapper_app) 74 | target_link_libraries(flutter_wrapper_app PUBLIC flutter) 75 | target_include_directories(flutter_wrapper_app PUBLIC 76 | "${WRAPPER_ROOT}/include" 77 | ) 78 | add_dependencies(flutter_wrapper_app flutter_assemble) 79 | 80 | # === Flutter tool backend === 81 | # _phony_ is a non-existent file to force this command to run every time, 82 | # since currently there's no way to get a full input/output list from the 83 | # flutter tool. 84 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") 85 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) 86 | add_custom_command( 87 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 88 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} 89 | ${CPP_WRAPPER_SOURCES_APP} 90 | ${PHONY_OUTPUT} 91 | COMMAND ${CMAKE_COMMAND} -E env 92 | ${FLUTTER_TOOL_ENVIRONMENT} 93 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" 94 | windows-x64 $ 95 | VERBATIM 96 | ) 97 | add_custom_target(flutter_assemble DEPENDS 98 | "${FLUTTER_LIBRARY}" 99 | ${FLUTTER_LIBRARY_HEADERS} 100 | ${CPP_WRAPPER_SOURCES_CORE} 101 | ${CPP_WRAPPER_SOURCES_PLUGIN} 102 | ${CPP_WRAPPER_SOURCES_APP} 103 | ) 104 | -------------------------------------------------------------------------------- /example/windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | 10 | void RegisterPlugins(flutter::PluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /example/windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /example/windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 9 | ) 10 | 11 | set(PLUGIN_BUNDLED_LIBRARIES) 12 | 13 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 18 | endforeach(plugin) 19 | 20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 23 | endforeach(ffi_plugin) 24 | -------------------------------------------------------------------------------- /example/windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(runner LANGUAGES CXX) 3 | 4 | add_executable(${BINARY_NAME} WIN32 5 | "flutter_window.cpp" 6 | "main.cpp" 7 | "utils.cpp" 8 | "win32_window.cpp" 9 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 10 | "Runner.rc" 11 | "runner.exe.manifest" 12 | ) 13 | apply_standard_settings(${BINARY_NAME}) 14 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 15 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 16 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 17 | add_dependencies(${BINARY_NAME} flutter_assemble) 18 | -------------------------------------------------------------------------------- /example/windows/runner/Runner.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #pragma code_page(65001) 4 | #include "resource.h" 5 | 6 | #define APSTUDIO_READONLY_SYMBOLS 7 | ///////////////////////////////////////////////////////////////////////////// 8 | // 9 | // Generated from the TEXTINCLUDE 2 resource. 10 | // 11 | #include "winres.h" 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | #undef APSTUDIO_READONLY_SYMBOLS 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | // English (United States) resources 18 | 19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""winres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "\r\n" 42 | "\0" 43 | END 44 | 45 | #endif // APSTUDIO_INVOKED 46 | 47 | 48 | ///////////////////////////////////////////////////////////////////////////// 49 | // 50 | // Icon 51 | // 52 | 53 | // Icon with lowest ID value placed first to ensure application icon 54 | // remains consistent on all systems. 55 | IDI_APP_ICON ICON "resources\\app_icon.ico" 56 | 57 | 58 | ///////////////////////////////////////////////////////////////////////////// 59 | // 60 | // Version 61 | // 62 | 63 | #ifdef FLUTTER_BUILD_NUMBER 64 | #define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER 65 | #else 66 | #define VERSION_AS_NUMBER 1,0,0 67 | #endif 68 | 69 | #ifdef FLUTTER_BUILD_NAME 70 | #define VERSION_AS_STRING #FLUTTER_BUILD_NAME 71 | #else 72 | #define VERSION_AS_STRING "1.0.0" 73 | #endif 74 | 75 | VS_VERSION_INFO VERSIONINFO 76 | FILEVERSION VERSION_AS_NUMBER 77 | PRODUCTVERSION VERSION_AS_NUMBER 78 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 79 | #ifdef _DEBUG 80 | FILEFLAGS VS_FF_DEBUG 81 | #else 82 | FILEFLAGS 0x0L 83 | #endif 84 | FILEOS VOS__WINDOWS32 85 | FILETYPE VFT_APP 86 | FILESUBTYPE 0x0L 87 | BEGIN 88 | BLOCK "StringFileInfo" 89 | BEGIN 90 | BLOCK "040904e4" 91 | BEGIN 92 | VALUE "CompanyName", "com.example" "\0" 93 | VALUE "FileDescription", "example" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "example" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2022 com.example. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "example.exe" "\0" 98 | VALUE "ProductName", "example" "\0" 99 | VALUE "ProductVersion", VERSION_AS_STRING "\0" 100 | END 101 | END 102 | BLOCK "VarFileInfo" 103 | BEGIN 104 | VALUE "Translation", 0x409, 1252 105 | END 106 | END 107 | 108 | #endif // English (United States) resources 109 | ///////////////////////////////////////////////////////////////////////////// 110 | 111 | 112 | 113 | #ifndef APSTUDIO_INVOKED 114 | ///////////////////////////////////////////////////////////////////////////// 115 | // 116 | // Generated from the TEXTINCLUDE 3 resource. 117 | // 118 | 119 | 120 | ///////////////////////////////////////////////////////////////////////////// 121 | #endif // not APSTUDIO_INVOKED 122 | -------------------------------------------------------------------------------- /example/windows/runner/flutter_window.cpp: -------------------------------------------------------------------------------- 1 | #include "flutter_window.h" 2 | 3 | #include 4 | 5 | #include "flutter/generated_plugin_registrant.h" 6 | 7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project) 8 | : project_(project) {} 9 | 10 | FlutterWindow::~FlutterWindow() {} 11 | 12 | bool FlutterWindow::OnCreate() { 13 | if (!Win32Window::OnCreate()) { 14 | return false; 15 | } 16 | 17 | RECT frame = GetClientArea(); 18 | 19 | // The size here must match the window dimensions to avoid unnecessary surface 20 | // creation / destruction in the startup path. 21 | flutter_controller_ = std::make_unique( 22 | frame.right - frame.left, frame.bottom - frame.top, project_); 23 | // Ensure that basic setup of the controller was successful. 24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) { 25 | return false; 26 | } 27 | RegisterPlugins(flutter_controller_->engine()); 28 | SetChildContent(flutter_controller_->view()->GetNativeWindow()); 29 | return true; 30 | } 31 | 32 | void FlutterWindow::OnDestroy() { 33 | if (flutter_controller_) { 34 | flutter_controller_ = nullptr; 35 | } 36 | 37 | Win32Window::OnDestroy(); 38 | } 39 | 40 | LRESULT 41 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 42 | WPARAM const wparam, 43 | LPARAM const lparam) noexcept { 44 | // Give Flutter, including plugins, an opportunity to handle window messages. 45 | if (flutter_controller_) { 46 | std::optional result = 47 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 48 | lparam); 49 | if (result) { 50 | return *result; 51 | } 52 | } 53 | 54 | switch (message) { 55 | case WM_FONTCHANGE: 56 | flutter_controller_->engine()->ReloadSystemFonts(); 57 | break; 58 | } 59 | 60 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 61 | } 62 | -------------------------------------------------------------------------------- /example/windows/runner/flutter_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_FLUTTER_WINDOW_H_ 2 | #define RUNNER_FLUTTER_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /example/windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 9 | _In_ wchar_t *command_line, _In_ int show_command) { 10 | // Attach to console when present (e.g., 'flutter run') or create a 11 | // new console when running with a debugger. 12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 13 | CreateAndAttachConsole(); 14 | } 15 | 16 | // Initialize COM, so that it is available for use in the library and/or 17 | // plugins. 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 19 | 20 | flutter::DartProject project(L"data"); 21 | 22 | std::vector command_line_arguments = 23 | GetCommandLineArguments(); 24 | 25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 26 | 27 | FlutterWindow window(project); 28 | Win32Window::Point origin(10, 10); 29 | Win32Window::Size size(1280, 720); 30 | if (!window.CreateAndShow(L"example", origin, size)) { 31 | return EXIT_FAILURE; 32 | } 33 | window.SetQuitOnClose(true); 34 | 35 | ::MSG msg; 36 | while (::GetMessage(&msg, nullptr, 0, 0)) { 37 | ::TranslateMessage(&msg); 38 | ::DispatchMessage(&msg); 39 | } 40 | 41 | ::CoUninitialize(); 42 | return EXIT_SUCCESS; 43 | } 44 | -------------------------------------------------------------------------------- /example/windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /example/windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newtaDev/pod_player/f3ea20e044d50bac6f35ac408edd65276f534540/example/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /example/windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /example/windows/runner/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | void CreateAndAttachConsole() { 11 | if (::AllocConsole()) { 12 | FILE *unused; 13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) { 14 | _dup2(_fileno(stdout), 1); 15 | } 16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) { 17 | _dup2(_fileno(stdout), 2); 18 | } 19 | std::ios::sync_with_stdio(); 20 | FlutterDesktopResyncOutputStreams(); 21 | } 22 | } 23 | 24 | std::vector GetCommandLineArguments() { 25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. 26 | int argc; 27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); 28 | if (argv == nullptr) { 29 | return std::vector(); 30 | } 31 | 32 | std::vector command_line_arguments; 33 | 34 | // Skip the first argument as it's the binary name. 35 | for (int i = 1; i < argc; i++) { 36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i])); 37 | } 38 | 39 | ::LocalFree(argv); 40 | 41 | return command_line_arguments; 42 | } 43 | 44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) { 45 | if (utf16_string == nullptr) { 46 | return std::string(); 47 | } 48 | int target_length = ::WideCharToMultiByte( 49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 50 | -1, nullptr, 0, nullptr, nullptr); 51 | if (target_length == 0) { 52 | return std::string(); 53 | } 54 | std::string utf8_string; 55 | utf8_string.resize(target_length); 56 | int converted_length = ::WideCharToMultiByte( 57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 58 | -1, utf8_string.data(), 59 | target_length, nullptr, nullptr); 60 | if (converted_length == 0) { 61 | return std::string(); 62 | } 63 | return utf8_string; 64 | } 65 | -------------------------------------------------------------------------------- /example/windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | -------------------------------------------------------------------------------- /example/windows/runner/win32_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_WIN32_WINDOW_H_ 2 | #define RUNNER_WIN32_WINDOW_H_ 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be 11 | // inherited from by classes that wish to specialize with custom 12 | // rendering and input handling 13 | class Win32Window { 14 | public: 15 | struct Point { 16 | unsigned int x; 17 | unsigned int y; 18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {} 19 | }; 20 | 21 | struct Size { 22 | unsigned int width; 23 | unsigned int height; 24 | Size(unsigned int width, unsigned int height) 25 | : width(width), height(height) {} 26 | }; 27 | 28 | Win32Window(); 29 | virtual ~Win32Window(); 30 | 31 | // Creates and shows a win32 window with |title| and position and size using 32 | // |origin| and |size|. New windows are created on the default monitor. Window 33 | // sizes are specified to the OS in physical pixels, hence to ensure a 34 | // consistent size to will treat the width height passed in to this function 35 | // as logical pixels and scale to appropriate for the default monitor. Returns 36 | // true if the window was created successfully. 37 | bool CreateAndShow(const std::wstring& title, 38 | const Point& origin, 39 | const Size& size); 40 | 41 | // Release OS resources associated with window. 42 | void Destroy(); 43 | 44 | // Inserts |content| into the window tree. 45 | void SetChildContent(HWND content); 46 | 47 | // Returns the backing Window handle to enable clients to set icon and other 48 | // window properties. Returns nullptr if the window has been destroyed. 49 | HWND GetHandle(); 50 | 51 | // If true, closing this window will quit the application. 52 | void SetQuitOnClose(bool quit_on_close); 53 | 54 | // Return a RECT representing the bounds of the current client area. 55 | RECT GetClientArea(); 56 | 57 | protected: 58 | // Processes and route salient window messages for mouse handling, 59 | // size change and DPI. Delegates handling of these to member overloads that 60 | // inheriting classes can handle. 61 | virtual LRESULT MessageHandler(HWND window, 62 | UINT const message, 63 | WPARAM const wparam, 64 | LPARAM const lparam) noexcept; 65 | 66 | // Called when CreateAndShow is called, allowing subclass window-related 67 | // setup. Subclasses should return false if setup fails. 68 | virtual bool OnCreate(); 69 | 70 | // Called when Destroy is called. 71 | virtual void OnDestroy(); 72 | 73 | private: 74 | friend class WindowClassRegistrar; 75 | 76 | // OS callback called by message pump. Handles the WM_NCCREATE message which 77 | // is passed when the non-client area is being created and enables automatic 78 | // non-client DPI scaling so that the non-client area automatically 79 | // responsponds to changes in DPI. All other messages are handled by 80 | // MessageHandler. 81 | static LRESULT CALLBACK WndProc(HWND const window, 82 | UINT const message, 83 | WPARAM const wparam, 84 | LPARAM const lparam) noexcept; 85 | 86 | // Retrieves a class instance pointer for |window| 87 | static Win32Window* GetThisFromHandle(HWND const window) noexcept; 88 | 89 | bool quit_on_close_ = false; 90 | 91 | // window handle for top level window. 92 | HWND window_handle_ = nullptr; 93 | 94 | // window handle for hosted content. 95 | HWND child_content_ = nullptr; 96 | }; 97 | 98 | #endif // RUNNER_WIN32_WINDOW_H_ 99 | -------------------------------------------------------------------------------- /lib/pod_player.dart: -------------------------------------------------------------------------------- 1 | /// Pod Player library 2 | library pod_player; 3 | 4 | export 'package:video_player/video_player.dart'; 5 | 6 | export 'src/controllers/pod_player_controller.dart'; 7 | export 'src/models/overlay_options.dart'; 8 | export 'src/models/play_video_from.dart'; 9 | export 'src/models/pod_player_config.dart'; 10 | export 'src/models/pod_player_labels.dart'; 11 | export 'src/models/pod_progress_bar_config.dart'; 12 | export 'src/models/vimeo_models.dart'; 13 | export 'src/pod_player.dart'; 14 | export 'src/utils/enums.dart'; 15 | export 'src/widgets/pod_progress_bar.dart'; 16 | -------------------------------------------------------------------------------- /lib/src/controllers/pod_base_controller.dart: -------------------------------------------------------------------------------- 1 | part of 'pod_getx_video_controller.dart'; 2 | // ignore_for_file: prefer_final_fields 3 | 4 | class _PodBaseController extends GetxController { 5 | ///main video controller 6 | VideoPlayerController? _videoCtr; 7 | 8 | /// 9 | late PodVideoPlayerType _videoPlayerType; 10 | 11 | bool isMute = false; 12 | FocusNode? keyboardFocusWeb; 13 | 14 | bool autoPlay = true; 15 | bool _isWebAutoPlayDone = false; 16 | 17 | /// 18 | PodVideoState _podVideoState = PodVideoState.loading; 19 | 20 | /// 21 | bool isWebPopupOverlayOpen = false; 22 | 23 | /// 24 | Duration _videoDuration = Duration.zero; 25 | 26 | Duration _videoPosition = Duration.zero; 27 | 28 | String _currentPaybackSpeed = '1x'; 29 | 30 | bool? isVideoUiBinded; 31 | 32 | bool? wasVideoPlayingOnUiDispose; 33 | 34 | int doubleTapForwardSeconds = 10; 35 | String? playingVideoUrl; 36 | 37 | late BuildContext mainContext; 38 | late BuildContext fullScreenContext; 39 | 40 | ///**listners 41 | 42 | Future videoListner() async { 43 | if (!_videoCtr!.value.isInitialized) { 44 | await _videoCtr!.initialize(); 45 | } 46 | if (_videoCtr!.value.isInitialized) { 47 | // _listneToVideoState(); 48 | _listneToVideoPosition(); 49 | _listneToVolume(); 50 | if (kIsWeb && autoPlay && isMute && !_isWebAutoPlayDone) _webAutoPlay(); 51 | } 52 | } 53 | 54 | void _webAutoPlay() => _videoCtr!.setVolume(1); 55 | 56 | void _listneToVolume() { 57 | if (_videoCtr!.value.volume == 0) { 58 | if (!isMute) { 59 | isMute = true; 60 | update(['volume']); 61 | update(['update-all']); 62 | } 63 | } else { 64 | if (isMute) { 65 | isMute = false; 66 | update(['volume']); 67 | update(['update-all']); 68 | } 69 | } 70 | } 71 | 72 | // void _listneToVideoState() { 73 | // podVideoStateChanger( 74 | // _videoCtr!.value.isBuffering || !_videoCtr!.value.isInitialized 75 | // ? PodVideoState.loading 76 | // : _videoCtr!.value.isPlaying 77 | // ? PodVideoState.playing 78 | // : PodVideoState.paused, 79 | // ); 80 | // } 81 | 82 | ///updates state with id `_podVideoState` 83 | void podVideoStateChanger(PodVideoState? val, {bool updateUi = true}) { 84 | if (_podVideoState != (val ?? _podVideoState)) { 85 | _podVideoState = val ?? _podVideoState; 86 | if (updateUi) { 87 | update(['podVideoState']); 88 | update(['update-all']); 89 | } 90 | } 91 | } 92 | 93 | void _listneToVideoPosition() { 94 | if ((_videoCtr?.value.duration.inSeconds ?? Duration.zero.inSeconds) < 60) { 95 | _videoPosition = _videoCtr?.value.position ?? Duration.zero; 96 | update(['video-progress']); 97 | update(['update-all']); 98 | } else { 99 | if (_videoPosition.inSeconds != 100 | (_videoCtr?.value.position ?? Duration.zero).inSeconds) { 101 | _videoPosition = _videoCtr?.value.position ?? Duration.zero; 102 | update(['video-progress']); 103 | update(['update-all']); 104 | } 105 | } 106 | } 107 | 108 | void keyboadListner() { 109 | if (keyboardFocusWeb != null && !keyboardFocusWeb!.hasFocus) { 110 | if (keyboardFocusWeb!.canRequestFocus) { 111 | keyboardFocusWeb!.requestFocus(); 112 | } 113 | } 114 | } 115 | 116 | // void keyboadFullScreenListner() { 117 | // print(keyboardFocusOnFullScreen?.hasFocus); 118 | // if (keyboardFocusOnFullScreen != null && 119 | // !keyboardFocusOnFullScreen!.hasFocus) { 120 | // if (keyboardFocusOnFullScreen!.canRequestFocus) { 121 | // keyboardFocusOnFullScreen!.requestFocus(); 122 | // } 123 | // } 124 | // } 125 | } 126 | -------------------------------------------------------------------------------- /lib/src/controllers/pod_gestures_controller.dart: -------------------------------------------------------------------------------- 1 | part of 'pod_getx_video_controller.dart'; 2 | 3 | class _PodGesturesController extends _PodVideoQualityController { 4 | //double tap 5 | Timer? leftDoubleTapTimer; 6 | Timer? rightDoubleTapTimer; 7 | int leftDoubleTapduration = 0; 8 | int rightDubleTapduration = 0; 9 | bool isLeftDbTapIconVisible = false; 10 | bool isRightDbTapIconVisible = false; 11 | 12 | Timer? hoverOverlayTimer; 13 | 14 | ///*handle double tap 15 | 16 | void onLeftDoubleTap({int? seconds}) { 17 | isShowOverlay(true); 18 | leftDoubleTapTimer?.cancel(); 19 | rightDoubleTapTimer?.cancel(); 20 | 21 | isRightDbTapIconVisible = false; 22 | isLeftDbTapIconVisible = true; 23 | updateLeftTapDuration( 24 | leftDoubleTapduration += seconds ?? doubleTapForwardSeconds, 25 | ); 26 | seekBackward(Duration(seconds: seconds ?? doubleTapForwardSeconds)); 27 | update(['double-tap-left']); 28 | leftDoubleTapTimer = Timer(const Duration(milliseconds: 500), () { 29 | isLeftDbTapIconVisible = false; 30 | updateLeftTapDuration(0); 31 | leftDoubleTapTimer?.cancel(); 32 | if (isvideoPlaying) { 33 | playVideo(true); 34 | } 35 | isShowOverlay(false); 36 | }); 37 | } 38 | 39 | void onRightDoubleTap({int? seconds}) { 40 | isShowOverlay(true); 41 | rightDoubleTapTimer?.cancel(); 42 | leftDoubleTapTimer?.cancel(); 43 | 44 | isLeftDbTapIconVisible = false; 45 | isRightDbTapIconVisible = true; 46 | updateRightTapDuration( 47 | rightDubleTapduration += seconds ?? doubleTapForwardSeconds, 48 | ); 49 | seekForward(Duration(seconds: seconds ?? doubleTapForwardSeconds)); 50 | update(['double-tap-right']); 51 | rightDoubleTapTimer = Timer(const Duration(milliseconds: 500), () { 52 | isRightDbTapIconVisible = false; 53 | updateRightTapDuration(0); 54 | rightDoubleTapTimer?.cancel(); 55 | if (isvideoPlaying) { 56 | playVideo(true); 57 | } 58 | isShowOverlay(false); 59 | }); 60 | } 61 | 62 | void onOverlayHover() { 63 | if (kIsWeb) { 64 | hoverOverlayTimer?.cancel(); 65 | isShowOverlay(true); 66 | hoverOverlayTimer = Timer( 67 | const Duration(seconds: 3), 68 | () => isShowOverlay(false), 69 | ); 70 | } 71 | } 72 | 73 | void onOverlayHoverExit() { 74 | if (kIsWeb) { 75 | isShowOverlay(false); 76 | } 77 | } 78 | 79 | ///update doubletap durations 80 | void updateLeftTapDuration(int val) { 81 | leftDoubleTapduration = val; 82 | update(['double-tap']); 83 | update(['update-all']); 84 | } 85 | 86 | void updateRightTapDuration(int val) { 87 | rightDubleTapduration = val; 88 | update(['double-tap']); 89 | update(['update-all']); 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /lib/src/controllers/pod_ui_controller.dart: -------------------------------------------------------------------------------- 1 | part of 'pod_getx_video_controller.dart'; 2 | 3 | class _PodUiController extends _PodBaseController { 4 | bool alwaysShowProgressBar = true; 5 | PodProgressBarConfig podProgressBarConfig = const PodProgressBarConfig(); 6 | Widget Function(OverLayOptions options)? overlayBuilder; 7 | Widget? videoTitle; 8 | DecorationImage? videoThumbnail; 9 | 10 | /// Callback when fullscreen mode changes 11 | Future Function(bool isFullScreen)? onToggleFullScreen; 12 | 13 | /// Builder for custom loading widget 14 | WidgetBuilder? onLoading; 15 | 16 | ///video player labels 17 | PodPlayerLabels podPlayerLabels = const PodPlayerLabels(); 18 | } 19 | -------------------------------------------------------------------------------- /lib/src/controllers/pod_video_quality_controller.dart: -------------------------------------------------------------------------------- 1 | part of 'pod_getx_video_controller.dart'; 2 | 3 | class _PodVideoQualityController extends _PodVideoController { 4 | /// 5 | int? vimeoPlayingVideoQuality; 6 | 7 | ///vimeo all quality urls 8 | List vimeoOrVideoUrls = []; 9 | late String _videoQualityUrl; 10 | 11 | ///invokes callback from external controller 12 | VoidCallback? onVimeoVideoQualityChanged; 13 | 14 | ///*vimeo player configs 15 | /// 16 | ///get all `quality urls` 17 | Future getQualityUrlsFromVimeoId( 18 | String videoId, { 19 | String? hash, 20 | }) async { 21 | try { 22 | podVideoStateChanger(PodVideoState.loading); 23 | final vimeoVideoUrls = await VideoApis.getVimeoVideoQualityUrls( 24 | videoId, 25 | hash, 26 | ); 27 | 28 | /// 29 | vimeoOrVideoUrls = vimeoVideoUrls ?? []; 30 | } catch (e) { 31 | rethrow; 32 | } 33 | } 34 | 35 | Future getQualityUrlsFromVimeoPrivateId( 36 | String videoId, 37 | Map httpHeader, 38 | ) async { 39 | try { 40 | podVideoStateChanger(PodVideoState.loading); 41 | final vimeoVideoUrls = 42 | await VideoApis.getVimeoPrivateVideoQualityUrls(videoId, httpHeader); 43 | 44 | /// 45 | vimeoOrVideoUrls = vimeoVideoUrls ?? []; 46 | } catch (e) { 47 | rethrow; 48 | } 49 | } 50 | 51 | void sortQualityVideoUrls( 52 | List? urls, 53 | ) { 54 | final urls0 = urls; 55 | 56 | ///has issues with 240p 57 | urls0?.removeWhere((element) => element.quality == 240); 58 | 59 | ///has issues with 144p in web 60 | if (kIsWeb) { 61 | urls0?.removeWhere((element) => element.quality == 144); 62 | } 63 | 64 | ///sort 65 | urls0?.sort((a, b) => a.quality.compareTo(b.quality)); 66 | 67 | /// 68 | vimeoOrVideoUrls = urls0 ?? []; 69 | } 70 | 71 | ///get vimeo quality `ex: 1080p` url 72 | VideoQalityUrls getQualityUrl(int quality) { 73 | return vimeoOrVideoUrls.firstWhere( 74 | (element) => element.quality == quality, 75 | orElse: () => vimeoOrVideoUrls.first, 76 | ); 77 | } 78 | 79 | Future getUrlFromVideoQualityUrls({ 80 | required List qualityList, 81 | required List videoUrls, 82 | }) async { 83 | sortQualityVideoUrls(videoUrls); 84 | if (vimeoOrVideoUrls.isEmpty) { 85 | throw Exception('videoQuality cannot be empty'); 86 | } 87 | 88 | final fallback = vimeoOrVideoUrls[0]; 89 | VideoQalityUrls? urlWithQuality; 90 | for (final quality in qualityList) { 91 | urlWithQuality = vimeoOrVideoUrls.firstWhere( 92 | (url) => url.quality == quality, 93 | orElse: () => fallback, 94 | ); 95 | 96 | if (urlWithQuality != fallback) { 97 | break; 98 | } 99 | } 100 | 101 | urlWithQuality ??= fallback; 102 | _videoQualityUrl = urlWithQuality.url; 103 | vimeoPlayingVideoQuality = urlWithQuality.quality; 104 | return _videoQualityUrl; 105 | } 106 | 107 | Future> getVideoQualityUrlsFromYoutube( 108 | String youtubeIdOrUrl, 109 | bool live, 110 | ) async { 111 | return await VideoApis.getYoutubeVideoQualityUrls(youtubeIdOrUrl, live) ?? 112 | []; 113 | } 114 | 115 | Future changeVideoQuality(int? quality) async { 116 | if (vimeoOrVideoUrls.isEmpty) { 117 | throw Exception('videoQuality cannot be empty'); 118 | } 119 | if (vimeoPlayingVideoQuality != quality) { 120 | _videoQualityUrl = vimeoOrVideoUrls 121 | .where((element) => element.quality == quality) 122 | .first 123 | .url; 124 | podLog(_videoQualityUrl); 125 | vimeoPlayingVideoQuality = quality; 126 | _videoCtr?.removeListener(videoListner); 127 | podVideoStateChanger(PodVideoState.paused); 128 | podVideoStateChanger(PodVideoState.loading); 129 | playingVideoUrl = _videoQualityUrl; 130 | _videoCtr = VideoPlayerController.networkUrl(Uri.parse(_videoQualityUrl)); 131 | await _videoCtr?.initialize(); 132 | _videoDuration = _videoCtr?.value.duration ?? Duration.zero; 133 | _videoCtr?.addListener(videoListner); 134 | await _videoCtr?.seekTo(_videoPosition); 135 | setVideoPlayBack(_currentPaybackSpeed); 136 | podVideoStateChanger(PodVideoState.playing); 137 | onVimeoVideoQualityChanged?.call(); 138 | update(); 139 | update(['update-all']); 140 | } 141 | } 142 | } 143 | -------------------------------------------------------------------------------- /lib/src/models/overlay_options.dart: -------------------------------------------------------------------------------- 1 | import '../../pod_player.dart'; 2 | 3 | class OverLayOptions { 4 | final PodVideoState podVideoState; 5 | final Duration videoDuration; 6 | final Duration videoPosition; 7 | final bool isFullScreen; 8 | final bool isLooping; 9 | final bool isOverlayVisible; 10 | final bool isMute; 11 | final bool autoPlay; 12 | final String currentVideoPlaybackSpeed; 13 | final List videoPlayBackSpeeds; 14 | final PodVideoPlayerType videoPlayerType; 15 | final PodProgressBar podProgresssBar; 16 | OverLayOptions({ 17 | required this.podVideoState, 18 | required this.videoDuration, 19 | required this.videoPosition, 20 | required this.isFullScreen, 21 | required this.isLooping, 22 | required this.isOverlayVisible, 23 | required this.isMute, 24 | required this.autoPlay, 25 | required this.currentVideoPlaybackSpeed, 26 | required this.videoPlayBackSpeeds, 27 | required this.videoPlayerType, 28 | required this.podProgresssBar, 29 | }); 30 | } 31 | -------------------------------------------------------------------------------- /lib/src/models/play_video_from.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import '../../pod_player.dart'; 4 | 5 | class PlayVideoFrom { 6 | final String? dataSource; 7 | final String? hash; 8 | final PodVideoPlayerType playerType; 9 | final VideoFormat? formatHint; 10 | final String? package; 11 | final File? file; 12 | final List? videoQualityUrls; 13 | final Future? closedCaptionFile; 14 | final VideoPlayerOptions? videoPlayerOptions; 15 | final Map httpHeaders; 16 | final bool live; 17 | 18 | const PlayVideoFrom._({ 19 | required this.playerType, 20 | this.live = false, 21 | this.dataSource, 22 | this.hash, 23 | this.formatHint, 24 | this.package, 25 | this.file, 26 | this.videoQualityUrls, 27 | this.closedCaptionFile, 28 | this.videoPlayerOptions, 29 | this.httpHeaders = const {}, 30 | }); 31 | 32 | factory PlayVideoFrom.network( 33 | String dataSource, { 34 | VideoFormat? formatHint, 35 | Future? closedCaptionFile, 36 | VideoPlayerOptions? videoPlayerOptions, 37 | Map httpHeaders = const {}, 38 | }) { 39 | return PlayVideoFrom._( 40 | playerType: PodVideoPlayerType.network, 41 | dataSource: dataSource, 42 | formatHint: formatHint, 43 | closedCaptionFile: closedCaptionFile, 44 | videoPlayerOptions: videoPlayerOptions, 45 | httpHeaders: httpHeaders, 46 | ); 47 | } 48 | 49 | factory PlayVideoFrom.asset( 50 | String dataSource, { 51 | String? package, 52 | Future? closedCaptionFile, 53 | VideoPlayerOptions? videoPlayerOptions, 54 | }) { 55 | return PlayVideoFrom._( 56 | playerType: PodVideoPlayerType.asset, 57 | dataSource: dataSource, 58 | package: package, 59 | closedCaptionFile: closedCaptionFile, 60 | videoPlayerOptions: videoPlayerOptions, 61 | ); 62 | } 63 | 64 | ///File Doesnot support web apps 65 | ///[file] is `File` Datatype import it from `dart:io` 66 | factory PlayVideoFrom.file( 67 | File file, { 68 | Future? closedCaptionFile, 69 | VideoPlayerOptions? videoPlayerOptions, 70 | }) { 71 | return PlayVideoFrom._( 72 | file: file, 73 | playerType: PodVideoPlayerType.file, 74 | closedCaptionFile: closedCaptionFile, 75 | videoPlayerOptions: videoPlayerOptions, 76 | ); 77 | } 78 | 79 | factory PlayVideoFrom.vimeo( 80 | String dataSource, { 81 | String? hash, 82 | VideoFormat? formatHint, 83 | Future? closedCaptionFile, 84 | VideoPlayerOptions? videoPlayerOptions, 85 | Map httpHeaders = const {}, 86 | }) { 87 | return PlayVideoFrom._( 88 | playerType: PodVideoPlayerType.vimeo, 89 | dataSource: dataSource, 90 | hash: hash, 91 | formatHint: formatHint, 92 | closedCaptionFile: closedCaptionFile, 93 | videoPlayerOptions: videoPlayerOptions, 94 | httpHeaders: httpHeaders, 95 | ); 96 | } 97 | 98 | factory PlayVideoFrom.vimeoPrivateVideos( 99 | String dataSource, { 100 | VideoFormat? formatHint, 101 | Future? closedCaptionFile, 102 | VideoPlayerOptions? videoPlayerOptions, 103 | Map httpHeaders = const {}, 104 | }) { 105 | return PlayVideoFrom._( 106 | playerType: PodVideoPlayerType.vimeoPrivateVideos, 107 | dataSource: dataSource, 108 | formatHint: formatHint, 109 | closedCaptionFile: closedCaptionFile, 110 | videoPlayerOptions: videoPlayerOptions, 111 | httpHeaders: httpHeaders, 112 | ); 113 | } 114 | factory PlayVideoFrom.youtube( 115 | String dataSource, { 116 | bool live = false, 117 | VideoFormat? formatHint, 118 | Future? closedCaptionFile, 119 | VideoPlayerOptions? videoPlayerOptions, 120 | Map httpHeaders = const {}, 121 | }) { 122 | return PlayVideoFrom._( 123 | live: live, 124 | playerType: PodVideoPlayerType.youtube, 125 | dataSource: dataSource, 126 | formatHint: formatHint, 127 | closedCaptionFile: closedCaptionFile, 128 | videoPlayerOptions: videoPlayerOptions, 129 | httpHeaders: httpHeaders, 130 | ); 131 | } 132 | factory PlayVideoFrom.networkQualityUrls({ 133 | required List videoUrls, 134 | VideoFormat? formatHint, 135 | Future? closedCaptionFile, 136 | VideoPlayerOptions? videoPlayerOptions, 137 | Map httpHeaders = const {}, 138 | }) { 139 | return PlayVideoFrom._( 140 | playerType: PodVideoPlayerType.networkQualityUrls, 141 | videoQualityUrls: videoUrls, 142 | formatHint: formatHint, 143 | closedCaptionFile: closedCaptionFile, 144 | videoPlayerOptions: videoPlayerOptions, 145 | httpHeaders: httpHeaders, 146 | ); 147 | } 148 | } 149 | -------------------------------------------------------------------------------- /lib/src/models/pod_player_config.dart: -------------------------------------------------------------------------------- 1 | class PodPlayerConfig { 2 | final bool autoPlay; 3 | final bool isLooping; 4 | final bool forcedVideoFocus; 5 | final bool wakelockEnabled; 6 | 7 | /// Initial video quality priority. The first available option will be used, 8 | /// from start to the end of this list. If all options informed are not 9 | /// available or if nothing is provided, 360p is used. 10 | /// 11 | /// Default value is [1080, 720, 360] 12 | final List videoQualityPriority; 13 | 14 | const PodPlayerConfig({ 15 | this.autoPlay = true, 16 | this.isLooping = false, 17 | this.forcedVideoFocus = false, 18 | this.wakelockEnabled = true, 19 | this.videoQualityPriority = const [1080, 720, 360], 20 | }); 21 | 22 | PodPlayerConfig copyWith({ 23 | bool? autoPlay, 24 | bool? isLooping, 25 | bool? forcedVideoFocus, 26 | bool? wakelockEnabled, 27 | List? videoQualityPriority, 28 | }) { 29 | return PodPlayerConfig( 30 | autoPlay: autoPlay ?? this.autoPlay, 31 | isLooping: isLooping ?? this.isLooping, 32 | forcedVideoFocus: forcedVideoFocus ?? this.forcedVideoFocus, 33 | wakelockEnabled: wakelockEnabled ?? this.wakelockEnabled, 34 | videoQualityPriority: videoQualityPriority ?? this.videoQualityPriority, 35 | ); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /lib/src/models/pod_player_labels.dart: -------------------------------------------------------------------------------- 1 | class PodPlayerLabels { 2 | final String? play; 3 | final String? pause; 4 | final String? mute; 5 | final String? unmute; 6 | final String settings; 7 | final String? fullscreen; 8 | final String? exitFullScreen; 9 | final String loopVideo; 10 | final String playbackSpeed; 11 | final String quality; 12 | final String optionEnabled; 13 | final String optionDisabled; 14 | final String error; 15 | 16 | /// Labels displayed in the video player progress bar and when an error occurs 17 | const PodPlayerLabels({ 18 | this.play, 19 | this.pause, 20 | this.mute, 21 | this.unmute, 22 | this.settings = 'Settings', 23 | this.fullscreen, 24 | this.exitFullScreen, 25 | this.loopVideo = 'Loop Video', 26 | this.playbackSpeed = 'Playback speed', 27 | this.error = 'Error while playing video', 28 | this.quality = 'Quality', 29 | this.optionEnabled = 'on', 30 | this.optionDisabled = 'off', 31 | }); 32 | } 33 | -------------------------------------------------------------------------------- /lib/src/models/pod_progress_bar_config.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | typedef GetProgressBarBackgroundPaint = Paint Function({ 4 | double? width, 5 | double? height, 6 | double? circleHandlerRadius, 7 | }); 8 | 9 | typedef GetProgressBarPlayedPaint = Paint Function({ 10 | double? width, 11 | double? height, 12 | double? playedPart, 13 | double? circleHandlerRadius, 14 | }); 15 | 16 | typedef GetProgressBarBufferedPaint = Paint Function({ 17 | double? width, 18 | double? height, 19 | double? playedPart, 20 | double? circleHandlerRadius, 21 | double? bufferedStart, 22 | double? bufferedEnd, 23 | }); 24 | 25 | typedef GetProgressBarHandlePaint = Paint Function({ 26 | double? width, 27 | double? height, 28 | double? playedPart, 29 | double? circleHandlerRadius, 30 | }); 31 | 32 | class PodProgressBarConfig { 33 | const PodProgressBarConfig({ 34 | this.playingBarColor = Colors.red, 35 | this.bufferedBarColor = const Color.fromRGBO(255, 255, 255, 0.38), 36 | this.circleHandlerColor = Colors.red, 37 | this.alwaysVisibleCircleHandler = false, 38 | this.backgroundColor = const Color.fromRGBO(255, 255, 255, 0.24), 39 | this.getPlayedPaint, 40 | this.getBufferedPaint, 41 | this.getCircleHandlerPaint, 42 | this.getBackgroundPaint, 43 | this.height = 3.6, 44 | this.padding = EdgeInsets.zero, 45 | this.circleHandlerRadius = 8, 46 | this.curveRadius = 4, 47 | }); 48 | 49 | /// Color for played area, not applied if [getPlayedPaint] is provided. 50 | final Color playingBarColor; 51 | 52 | /// Color for buffered area, not applied if [getBufferedPaint] is provided. 53 | final Color bufferedBarColor; 54 | 55 | /// Color for handle, not applied if [getCircleHandlerPaint] is provided. 56 | final Color circleHandlerColor; 57 | 58 | final bool alwaysVisibleCircleHandler; 59 | 60 | /// Color for background area, not applied if [getBackgroundPaint] is provided. 61 | final Color backgroundColor; 62 | 63 | /// Paint for played area. 64 | final GetProgressBarPlayedPaint? getPlayedPaint; 65 | 66 | /// Paint for buffered area. 67 | final GetProgressBarBufferedPaint? getBufferedPaint; 68 | 69 | /// Paint for handle. 70 | final GetProgressBarHandlePaint? getCircleHandlerPaint; 71 | 72 | /// Paint for background area. 73 | final GetProgressBarBackgroundPaint? getBackgroundPaint; 74 | 75 | /// Height of the progress bar. 76 | final double height; 77 | 78 | /// Padding for the progress bar. 79 | /// Padding area is included in the [GestureDetector]. 80 | final EdgeInsetsGeometry padding; 81 | 82 | /// Handle radius. 83 | /// Should be bigger then [height] so that handle is visible. 84 | /// 0.0 will hide the handle. 85 | final double circleHandlerRadius; 86 | 87 | /// Radius to curve the ends of the bar. 88 | final double curveRadius; 89 | 90 | PodProgressBarConfig copyWith({ 91 | Color? playingBarColor, 92 | Color? bufferedBarColor, 93 | Color? circleHandlerColor, 94 | bool? alwaysVisibleCircleHandler, 95 | Color? backgroundColor, 96 | GetProgressBarPlayedPaint? getPlayedPaint, 97 | GetProgressBarBufferedPaint? getBufferedPaint, 98 | GetProgressBarHandlePaint? getCircleHandlerPaint, 99 | GetProgressBarBackgroundPaint? getBackgroundPaint, 100 | double? height, 101 | EdgeInsetsGeometry? padding, 102 | double? circleHandlerRadius, 103 | double? curveRadius, 104 | }) { 105 | return PodProgressBarConfig( 106 | playingBarColor: playingBarColor ?? this.playingBarColor, 107 | bufferedBarColor: bufferedBarColor ?? this.bufferedBarColor, 108 | circleHandlerColor: circleHandlerColor ?? this.circleHandlerColor, 109 | alwaysVisibleCircleHandler: 110 | alwaysVisibleCircleHandler ?? this.alwaysVisibleCircleHandler, 111 | backgroundColor: backgroundColor ?? this.backgroundColor, 112 | getPlayedPaint: getPlayedPaint ?? this.getPlayedPaint, 113 | getBufferedPaint: getBufferedPaint ?? this.getBufferedPaint, 114 | getCircleHandlerPaint: 115 | getCircleHandlerPaint ?? this.getCircleHandlerPaint, 116 | getBackgroundPaint: getBackgroundPaint ?? this.getBackgroundPaint, 117 | height: height ?? this.height, 118 | padding: padding ?? this.padding, 119 | circleHandlerRadius: circleHandlerRadius ?? this.circleHandlerRadius, 120 | curveRadius: curveRadius ?? this.curveRadius, 121 | ); 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /lib/src/models/vimeo_models.dart: -------------------------------------------------------------------------------- 1 | class VideoQalityUrls { 2 | int quality; 3 | String url; 4 | VideoQalityUrls({ 5 | required this.quality, 6 | required this.url, 7 | }); 8 | 9 | @override 10 | String toString() => 'VideoQalityUrls(quality: $quality, urls: $url)'; 11 | } 12 | -------------------------------------------------------------------------------- /lib/src/utils/enums.dart: -------------------------------------------------------------------------------- 1 | enum PodVideoState { 2 | loading, 3 | playing, 4 | paused, 5 | error, 6 | } 7 | 8 | enum PodVideoPlayerType { 9 | network, 10 | networkQualityUrls, 11 | file, 12 | asset, 13 | vimeo, 14 | youtube, 15 | vimeoPrivateVideos, 16 | } 17 | -------------------------------------------------------------------------------- /lib/src/utils/logger.dart: -------------------------------------------------------------------------------- 1 | import 'dart:developer'; 2 | 3 | import '../../pod_player.dart'; 4 | 5 | void podLog(String message) => 6 | PodVideoPlayer.enableLogs ? log(message, name: 'POD') : null; 7 | -------------------------------------------------------------------------------- /lib/src/utils/video_apis.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'dart:developer'; 3 | 4 | import 'package:flutter/material.dart'; 5 | import 'package:http/http.dart' as http; 6 | import 'package:http/http.dart'; 7 | import 'package:youtube_explode_dart/youtube_explode_dart.dart'; 8 | import '../models/vimeo_models.dart'; 9 | 10 | String podErrorString(String val) { 11 | return '*\n------error------\n\n$val\n\n------end------\n*'; 12 | } 13 | 14 | class VideoApis { 15 | static Future _makeRequestHash(String videoId, String? hash) { 16 | if (hash == null) { 17 | return http.get( 18 | Uri.parse('https://player.vimeo.com/video/$videoId/config'), 19 | ); 20 | } else { 21 | return http.get( 22 | Uri.parse('https://player.vimeo.com/video/$videoId/config?h=$hash'), 23 | ); 24 | } 25 | } 26 | 27 | static Future?> getVimeoVideoQualityUrls( 28 | String videoId, 29 | String? hash, 30 | ) async { 31 | try { 32 | final response = await _makeRequestHash(videoId, hash); 33 | final jsonData = jsonDecode(response.body)['request']['files']; 34 | final dashData = jsonData['dash']; 35 | final hlsData = jsonData['hls']; 36 | final defaultCDN = hlsData['default_cdn']; 37 | final cdnVideoUrl = (hlsData['cdns'][defaultCDN]['url'] as String?) ?? ''; 38 | final List rawStreamUrls = 39 | (dashData['streams'] as List?) ?? []; 40 | 41 | final List vimeoQualityUrls = []; 42 | 43 | for (final item in rawStreamUrls) { 44 | final sepList = cdnVideoUrl.split('/sep/video/'); 45 | final firstUrlPiece = sepList.firstOrNull ?? ''; 46 | final lastUrlPiece = 47 | ((sepList.lastOrNull ?? '').split('/').lastOrNull) ?? 48 | (sepList.lastOrNull ?? ''); 49 | final String urlId = 50 | ((item['id'] ?? '') as String).split('-').firstOrNull ?? ''; 51 | vimeoQualityUrls.add( 52 | VideoQalityUrls( 53 | quality: int.parse( 54 | (item['quality'] as String?)?.split('p').first ?? '0', 55 | ), 56 | url: '$firstUrlPiece/sep/video/$urlId/$lastUrlPiece', 57 | ), 58 | ); 59 | } 60 | if (vimeoQualityUrls.isEmpty) { 61 | vimeoQualityUrls.add( 62 | VideoQalityUrls( 63 | quality: 720, 64 | url: cdnVideoUrl, 65 | ), 66 | ); 67 | } 68 | 69 | return vimeoQualityUrls; 70 | } catch (error) { 71 | if (error.toString().contains('XMLHttpRequest')) { 72 | log( 73 | podErrorString( 74 | '(INFO) To play vimeo video in WEB, Please enable CORS in your browser', 75 | ), 76 | ); 77 | } 78 | debugPrint('===== VIMEO API ERROR: $error =========='); 79 | rethrow; 80 | } 81 | } 82 | 83 | static Future?> getVimeoPrivateVideoQualityUrls( 84 | String videoId, 85 | Map httpHeader, 86 | ) async { 87 | try { 88 | final response = await http.get( 89 | Uri.parse('https://api.vimeo.com/videos/$videoId'), 90 | headers: httpHeader, 91 | ); 92 | final jsonData = 93 | (jsonDecode(response.body)['files'] as List?) ?? []; 94 | 95 | final List list = []; 96 | for (int i = 0; i < jsonData.length; i++) { 97 | final String quality = 98 | (jsonData[i]['rendition'] as String?)?.split('p').first ?? '0'; 99 | final int? number = int.tryParse(quality); 100 | if (number != null && number != 0) { 101 | list.add( 102 | VideoQalityUrls( 103 | quality: number, 104 | url: jsonData[i]['link'] as String, 105 | ), 106 | ); 107 | } 108 | } 109 | return list; 110 | } catch (error) { 111 | if (error.toString().contains('XMLHttpRequest')) { 112 | log( 113 | podErrorString( 114 | '(INFO) To play vimeo video in WEB, Please enable CORS in your browser', 115 | ), 116 | ); 117 | } 118 | debugPrint('===== VIMEO API ERROR: $error =========='); 119 | rethrow; 120 | } 121 | } 122 | 123 | static Future?> getYoutubeVideoQualityUrls( 124 | String youtubeIdOrUrl, 125 | bool live, 126 | ) async { 127 | try { 128 | final yt = YoutubeExplode(); 129 | final urls = []; 130 | if (live) { 131 | final url = await yt.videos.streamsClient.getHttpLiveStreamUrl( 132 | VideoId(youtubeIdOrUrl), 133 | ); 134 | urls.add( 135 | VideoQalityUrls( 136 | quality: 360, 137 | url: url, 138 | ), 139 | ); 140 | } else { 141 | final manifest = 142 | await yt.videos.streamsClient.getManifest(youtubeIdOrUrl); 143 | urls.addAll( 144 | manifest.muxed.map( 145 | (element) => VideoQalityUrls( 146 | quality: int.parse(element.qualityLabel.split('p')[0]), 147 | url: element.url.toString(), 148 | ), 149 | ), 150 | ); 151 | } 152 | // Close the YoutubeExplode's http client. 153 | yt.close(); 154 | return urls; 155 | } catch (error) { 156 | if (error.toString().contains('XMLHttpRequest')) { 157 | log( 158 | podErrorString( 159 | '(INFO) To play youtube video in WEB, Please enable CORS in your browser', 160 | ), 161 | ); 162 | } 163 | debugPrint('===== YOUTUBE API ERROR: $error =========='); 164 | rethrow; 165 | } 166 | } 167 | } 168 | -------------------------------------------------------------------------------- /lib/src/widgets/animated_play_pause_icon.dart: -------------------------------------------------------------------------------- 1 | part of 'package:pod_player/src/pod_player.dart'; 2 | 3 | class _AnimatedPlayPauseIcon extends StatefulWidget { 4 | final double? size; 5 | final String tag; 6 | 7 | const _AnimatedPlayPauseIcon({ 8 | required this.tag, 9 | this.size, 10 | }); 11 | 12 | @override 13 | State<_AnimatedPlayPauseIcon> createState() => _AnimatedPlayPauseIconState(); 14 | } 15 | 16 | class _AnimatedPlayPauseIconState extends State<_AnimatedPlayPauseIcon> 17 | with SingleTickerProviderStateMixin { 18 | late final AnimationController _payCtr; 19 | late PodGetXVideoController _podCtr; 20 | @override 21 | void initState() { 22 | _podCtr = Get.find(tag: widget.tag); 23 | _payCtr = AnimationController( 24 | vsync: this, 25 | duration: const Duration(milliseconds: 450), 26 | ); 27 | _podCtr.addListenerId('podVideoState', playPauseListner); 28 | if (_podCtr.isvideoPlaying) { 29 | if (mounted) _payCtr.forward(); 30 | } 31 | super.initState(); 32 | } 33 | 34 | void playPauseListner() { 35 | WidgetsBinding.instance.addPostFrameCallback((timeStamp) { 36 | if (_podCtr.podVideoState == PodVideoState.playing) { 37 | if (mounted) _payCtr.forward(); 38 | } 39 | if (_podCtr.podVideoState == PodVideoState.paused) { 40 | if (mounted) _payCtr.reverse(); 41 | } 42 | }); 43 | } 44 | 45 | @override 46 | void dispose() { 47 | // podLog('Play-pause-controller-disposed'); 48 | _payCtr.dispose(); 49 | super.dispose(); 50 | } 51 | 52 | @override 53 | Widget build(BuildContext context) { 54 | return GetBuilder( 55 | tag: widget.tag, 56 | id: 'overlay', 57 | builder: (podCtr) { 58 | return GetBuilder( 59 | tag: widget.tag, 60 | id: 'podVideoState', 61 | builder: (f) => MaterialIconButton( 62 | toolTipMesg: f.isvideoPlaying 63 | ? podCtr.podPlayerLabels.pause ?? 64 | 'Pause${kIsWeb ? ' (space)' : ''}' 65 | : podCtr.podPlayerLabels.play ?? 66 | 'Play${kIsWeb ? ' (space)' : ''}', 67 | onPressed: 68 | podCtr.isOverlayVisible ? podCtr.togglePlayPauseVideo : null, 69 | child: onStateChange(podCtr), 70 | ), 71 | ); 72 | }, 73 | ); 74 | } 75 | 76 | Widget onStateChange(PodGetXVideoController podCtr) { 77 | if (kIsWeb) return _playPause(podCtr); 78 | if (podCtr.podVideoState == PodVideoState.loading) { 79 | return const SizedBox(); 80 | } else { 81 | return _playPause(podCtr); 82 | } 83 | } 84 | 85 | Widget _playPause(PodGetXVideoController podCtr) { 86 | return AnimatedIcon( 87 | icon: AnimatedIcons.play_pause, 88 | progress: _payCtr, 89 | color: Colors.white, 90 | size: widget.size, 91 | ); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /lib/src/widgets/core/overlays/mobile_overlay.dart: -------------------------------------------------------------------------------- 1 | part of 'package:pod_player/src/pod_player.dart'; 2 | 3 | class _MobileOverlay extends StatelessWidget { 4 | final String tag; 5 | 6 | const _MobileOverlay({ 7 | required this.tag, 8 | }); 9 | 10 | @override 11 | Widget build(BuildContext context) { 12 | const overlayColor = Colors.black38; 13 | const itemColor = Colors.white; 14 | final podCtr = Get.find(tag: tag); 15 | return Stack( 16 | alignment: Alignment.center, 17 | children: [ 18 | _VideoGestureDetector( 19 | tag: tag, 20 | child: ColoredBox( 21 | color: overlayColor, 22 | child: Row( 23 | children: [ 24 | Expanded( 25 | child: DoubleTapIcon( 26 | tag: tag, 27 | isForward: false, 28 | height: double.maxFinite, 29 | onDoubleTap: _isRtl() 30 | ? podCtr.onRightDoubleTap 31 | : podCtr.onLeftDoubleTap, 32 | ), 33 | ), 34 | SizedBox( 35 | height: double.infinity, 36 | child: Center( 37 | child: _AnimatedPlayPauseIcon(tag: tag, size: 42), 38 | ), 39 | ), 40 | Expanded( 41 | child: DoubleTapIcon( 42 | isForward: true, 43 | tag: tag, 44 | height: double.maxFinite, 45 | onDoubleTap: _isRtl() 46 | ? podCtr.onLeftDoubleTap 47 | : podCtr.onRightDoubleTap, 48 | ), 49 | ), 50 | ], 51 | ), 52 | ), 53 | ), 54 | Align( 55 | alignment: Alignment.topCenter, 56 | child: Row( 57 | mainAxisAlignment: MainAxisAlignment.end, 58 | children: [ 59 | Expanded( 60 | child: IgnorePointer( 61 | child: podCtr.videoTitle ?? const SizedBox(), 62 | ), 63 | ), 64 | MaterialIconButton( 65 | toolTipMesg: podCtr.podPlayerLabels.settings, 66 | color: itemColor, 67 | onPressed: () { 68 | if (podCtr.isOverlayVisible) { 69 | _bottomSheet(context); 70 | } else { 71 | podCtr.toggleVideoOverlay(); 72 | } 73 | }, 74 | child: const Icon( 75 | Icons.more_vert_rounded, 76 | ), 77 | ), 78 | ], 79 | ), 80 | ), 81 | Align( 82 | alignment: Alignment.bottomLeft, 83 | child: _MobileOverlayBottomControlles(tag: tag), 84 | ), 85 | ], 86 | ); 87 | } 88 | 89 | bool _isRtl() { 90 | final Locale locale = WidgetsBinding.instance.platformDispatcher.locale; 91 | final langs = [ 92 | 'ar', // Arabic 93 | 'fa', // Farsi 94 | 'he', // Hebrew 95 | 'ps', // Pashto 96 | 'ur', // Urdu 97 | ]; 98 | for (int i = 0; i < langs.length; i++) { 99 | final lang = langs[i]; 100 | if (locale.toString().contains(lang)) { 101 | return true; 102 | } 103 | } 104 | return false; 105 | } 106 | 107 | void _bottomSheet(BuildContext context) { 108 | showModalBottomSheet( 109 | context: context, 110 | builder: (context) => SafeArea(child: _MobileBottomSheet(tag: tag)), 111 | ); 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /lib/src/widgets/core/overlays/overlays.dart: -------------------------------------------------------------------------------- 1 | part of 'package:pod_player/src/pod_player.dart'; 2 | 3 | class _VideoOverlays extends StatelessWidget { 4 | final String tag; 5 | 6 | const _VideoOverlays({ 7 | required this.tag, 8 | }); 9 | 10 | @override 11 | Widget build(BuildContext context) { 12 | final podCtr = Get.find(tag: tag); 13 | if (podCtr.overlayBuilder != null) { 14 | return GetBuilder( 15 | id: 'update-all', 16 | tag: tag, 17 | builder: (podCtr) { 18 | ///Custom overlay 19 | final progressBar = PodProgressBar( 20 | tag: tag, 21 | podProgressBarConfig: podCtr.podProgressBarConfig, 22 | ); 23 | final overlayOptions = OverLayOptions( 24 | podVideoState: podCtr.podVideoState, 25 | videoDuration: podCtr.videoDuration, 26 | videoPosition: podCtr.videoPosition, 27 | isFullScreen: podCtr.isFullScreen, 28 | isLooping: podCtr.isLooping, 29 | isOverlayVisible: podCtr.isOverlayVisible, 30 | isMute: podCtr.isMute, 31 | autoPlay: podCtr.autoPlay, 32 | currentVideoPlaybackSpeed: podCtr.currentPaybackSpeed, 33 | videoPlayBackSpeeds: podCtr.videoPlaybackSpeeds, 34 | videoPlayerType: podCtr.videoPlayerType, 35 | podProgresssBar: progressBar, 36 | ); 37 | 38 | /// Returns the custom overlay, otherwise returns the default 39 | /// overlay with gesture detector 40 | return podCtr.overlayBuilder!(overlayOptions); 41 | }, 42 | ); 43 | } else { 44 | ///Built in overlay 45 | return GetBuilder( 46 | tag: tag, 47 | id: 'overlay', 48 | builder: (podCtr) { 49 | return AnimatedOpacity( 50 | duration: const Duration(milliseconds: 200), 51 | opacity: podCtr.isOverlayVisible ? 1 : 0, 52 | child: Stack( 53 | fit: StackFit.passthrough, 54 | children: [ 55 | if (!kIsWeb) _MobileOverlay(tag: tag), 56 | if (kIsWeb) _WebOverlay(tag: tag), 57 | ], 58 | ), 59 | ); 60 | }, 61 | ); 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /lib/src/widgets/core/overlays/web_dropdown_menu.dart: -------------------------------------------------------------------------------- 1 | part of 'package:pod_player/src/pod_player.dart'; 2 | 3 | class _WebSettingsDropdown extends StatefulWidget { 4 | final String tag; 5 | 6 | const _WebSettingsDropdown({ 7 | required this.tag, 8 | }); 9 | 10 | @override 11 | State<_WebSettingsDropdown> createState() => _WebSettingsDropdownState(); 12 | } 13 | 14 | class _WebSettingsDropdownState extends State<_WebSettingsDropdown> { 15 | @override 16 | Widget build(BuildContext context) { 17 | return Theme( 18 | data: Theme.of(context).copyWith( 19 | focusColor: Colors.white, 20 | ), 21 | child: GetBuilder( 22 | tag: widget.tag, 23 | builder: (podCtr) { 24 | return MaterialIconButton( 25 | toolTipMesg: podCtr.podPlayerLabels.settings, 26 | color: Colors.white, 27 | child: const Icon(Icons.settings), 28 | onPressed: () => podCtr.isFullScreen 29 | ? podCtr.isWebPopupOverlayOpen = true 30 | : podCtr.isWebPopupOverlayOpen = false, 31 | onTapDown: (details) async { 32 | final settingsMenu = await showMenu( 33 | context: context, 34 | items: [ 35 | if (podCtr.vimeoOrVideoUrls.isNotEmpty) 36 | PopupMenuItem( 37 | value: 'OUALITY', 38 | child: _bottomSheetTiles( 39 | title: podCtr.podPlayerLabels.quality, 40 | icon: Icons.video_settings_rounded, 41 | subText: '${podCtr.vimeoPlayingVideoQuality}p', 42 | ), 43 | ), 44 | PopupMenuItem( 45 | value: 'LOOP', 46 | child: _bottomSheetTiles( 47 | title: podCtr.podPlayerLabels.loopVideo, 48 | icon: Icons.loop_rounded, 49 | subText: podCtr.isLooping 50 | ? podCtr.podPlayerLabels.optionEnabled 51 | : podCtr.podPlayerLabels.optionDisabled, 52 | ), 53 | ), 54 | PopupMenuItem( 55 | value: 'SPEED', 56 | child: _bottomSheetTiles( 57 | title: podCtr.podPlayerLabels.playbackSpeed, 58 | icon: Icons.slow_motion_video_rounded, 59 | subText: podCtr.currentPaybackSpeed, 60 | ), 61 | ), 62 | ], 63 | position: RelativeRect.fromSize( 64 | details.globalPosition & Size.zero, 65 | MediaQuery.of(context).size, 66 | ), 67 | ); 68 | switch (settingsMenu) { 69 | case 'OUALITY': 70 | await _onVimeoQualitySelect(details, podCtr); 71 | break; 72 | case 'SPEED': 73 | await _onPlaybackSpeedSelect(details, podCtr); 74 | break; 75 | case 'LOOP': 76 | podCtr.isWebPopupOverlayOpen = false; 77 | await podCtr.toggleLooping(); 78 | break; 79 | default: 80 | podCtr.isWebPopupOverlayOpen = false; 81 | } 82 | }, 83 | ); 84 | }, 85 | ), 86 | ); 87 | } 88 | 89 | Future _onPlaybackSpeedSelect( 90 | TapDownDetails details, 91 | PodGetXVideoController podCtr, 92 | ) async { 93 | await Future.delayed( 94 | const Duration(milliseconds: 400), 95 | ); 96 | await showMenu( 97 | context: context, 98 | items: podCtr.videoPlaybackSpeeds 99 | .map( 100 | (e) => PopupMenuItem( 101 | child: ListTile( 102 | title: Text(e), 103 | ), 104 | onTap: () { 105 | podCtr.setVideoPlayBack(e); 106 | }, 107 | ), 108 | ) 109 | .toList(), 110 | position: RelativeRect.fromSize( 111 | details.globalPosition & Size.zero, 112 | // ignore: use_build_context_synchronously 113 | MediaQuery.of(context).size, 114 | ), 115 | ); 116 | podCtr.isWebPopupOverlayOpen = false; 117 | } 118 | 119 | Future _onVimeoQualitySelect( 120 | TapDownDetails details, 121 | PodGetXVideoController podCtr, 122 | ) async { 123 | await Future.delayed( 124 | const Duration(milliseconds: 400), 125 | ); 126 | await showMenu( 127 | context: context, 128 | items: podCtr.vimeoOrVideoUrls 129 | .map( 130 | (e) => PopupMenuItem( 131 | child: ListTile( 132 | title: Text('${e.quality}p'), 133 | ), 134 | onTap: () { 135 | podCtr.changeVideoQuality( 136 | e.quality, 137 | ); 138 | }, 139 | ), 140 | ) 141 | .toList(), 142 | position: RelativeRect.fromSize( 143 | details.globalPosition & Size.zero, 144 | // ignore: use_build_context_synchronously 145 | MediaQuery.of(context).size, 146 | ), 147 | ); 148 | podCtr.isWebPopupOverlayOpen = false; 149 | } 150 | 151 | Widget _bottomSheetTiles({ 152 | required String title, 153 | required IconData icon, 154 | String? subText, 155 | }) { 156 | return Padding( 157 | padding: const EdgeInsets.symmetric(vertical: 15), 158 | child: FittedBox( 159 | fit: BoxFit.scaleDown, 160 | child: Row( 161 | mainAxisSize: MainAxisSize.min, 162 | children: [ 163 | Icon(icon), 164 | const SizedBox(width: 20), 165 | Text( 166 | title, 167 | ), 168 | if (subText != null) const SizedBox(width: 10), 169 | if (subText != null) 170 | const SizedBox( 171 | height: 4, 172 | width: 4, 173 | child: DecoratedBox( 174 | decoration: BoxDecoration( 175 | color: Colors.grey, 176 | shape: BoxShape.circle, 177 | ), 178 | ), 179 | ), 180 | if (subText != null) const SizedBox(width: 6), 181 | if (subText != null) 182 | Text( 183 | subText, 184 | style: const TextStyle(color: Colors.grey), 185 | ), 186 | ], 187 | ), 188 | ), 189 | ); 190 | } 191 | } 192 | -------------------------------------------------------------------------------- /lib/src/widgets/core/pod_core_player.dart: -------------------------------------------------------------------------------- 1 | part of 'package:pod_player/src/pod_player.dart'; 2 | 3 | class _PodCoreVideoPlayer extends StatelessWidget { 4 | final VideoPlayerController videoPlayerCtr; 5 | final double videoAspectRatio; 6 | final String tag; 7 | 8 | const _PodCoreVideoPlayer({ 9 | required this.videoPlayerCtr, 10 | required this.videoAspectRatio, 11 | required this.tag, 12 | }); 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | final podCtr = Get.find(tag: tag); 17 | return Builder( 18 | builder: (ctrx) { 19 | return RawKeyboardListener( 20 | autofocus: true, 21 | focusNode: 22 | (podCtr.isFullScreen ? FocusNode() : podCtr.keyboardFocusWeb) ?? 23 | FocusNode(), 24 | onKey: (value) => podCtr.onKeyBoardEvents( 25 | event: value, 26 | appContext: ctrx, 27 | tag: tag, 28 | ), 29 | child: Stack( 30 | fit: StackFit.expand, 31 | children: [ 32 | Center( 33 | child: AspectRatio( 34 | aspectRatio: videoAspectRatio, 35 | child: VideoPlayer(videoPlayerCtr), 36 | ), 37 | ), 38 | GetBuilder( 39 | tag: tag, 40 | id: 'podVideoState', 41 | builder: (_) => GetBuilder( 42 | tag: tag, 43 | id: 'video-progress', 44 | builder: (podCtr) { 45 | if (podCtr.videoThumbnail == null) { 46 | return const SizedBox(); 47 | } 48 | 49 | if (podCtr.podVideoState == PodVideoState.paused && 50 | podCtr.videoPosition == Duration.zero) { 51 | return SizedBox.expand( 52 | child: TweenAnimationBuilder( 53 | builder: (context, value, child) => Opacity( 54 | opacity: value, 55 | child: child, 56 | ), 57 | tween: Tween(begin: 0.7, end: 1), 58 | duration: const Duration(milliseconds: 400), 59 | child: DecoratedBox( 60 | decoration: BoxDecoration( 61 | image: podCtr.videoThumbnail, 62 | ), 63 | ), 64 | ), 65 | ); 66 | } 67 | return const SizedBox(); 68 | }, 69 | ), 70 | ), 71 | _VideoOverlays(tag: tag), 72 | IgnorePointer( 73 | child: GetBuilder( 74 | tag: tag, 75 | id: 'podVideoState', 76 | builder: (podCtr) { 77 | final loadingWidget = podCtr.onLoading?.call(context) ?? 78 | const Center( 79 | child: CircularProgressIndicator( 80 | backgroundColor: Colors.transparent, 81 | color: Colors.white, 82 | strokeWidth: 2, 83 | ), 84 | ); 85 | 86 | if (kIsWeb) { 87 | switch (podCtr.podVideoState) { 88 | case PodVideoState.loading: 89 | return loadingWidget; 90 | case PodVideoState.paused: 91 | return const Center( 92 | child: Icon( 93 | Icons.play_arrow, 94 | size: 45, 95 | color: Colors.white, 96 | ), 97 | ); 98 | case PodVideoState.playing: 99 | return Center( 100 | child: TweenAnimationBuilder( 101 | builder: (context, value, child) => Opacity( 102 | opacity: value, 103 | child: child, 104 | ), 105 | tween: Tween(begin: 1, end: 0), 106 | duration: const Duration(seconds: 1), 107 | child: const Icon( 108 | Icons.pause, 109 | size: 45, 110 | color: Colors.white, 111 | ), 112 | ), 113 | ); 114 | case PodVideoState.error: 115 | return const SizedBox(); 116 | } 117 | } else { 118 | if (podCtr.podVideoState == PodVideoState.loading) { 119 | return loadingWidget; 120 | } 121 | return const SizedBox(); 122 | } 123 | }, 124 | ), 125 | ), 126 | if (!kIsWeb) 127 | GetBuilder( 128 | tag: tag, 129 | id: 'full-screen', 130 | builder: (podCtr) => podCtr.isFullScreen 131 | ? const SizedBox() 132 | : GetBuilder( 133 | tag: tag, 134 | id: 'overlay', 135 | builder: (podCtr) => podCtr.isOverlayVisible || 136 | !podCtr.alwaysShowProgressBar 137 | ? const SizedBox() 138 | : Align( 139 | alignment: Alignment.bottomCenter, 140 | child: PodProgressBar( 141 | tag: tag, 142 | alignment: Alignment.bottomCenter, 143 | podProgressBarConfig: 144 | podCtr.podProgressBarConfig, 145 | ), 146 | ), 147 | ), 148 | ), 149 | ], 150 | ), 151 | ); 152 | }, 153 | ); 154 | } 155 | } 156 | -------------------------------------------------------------------------------- /lib/src/widgets/core/video_gesture_detector.dart: -------------------------------------------------------------------------------- 1 | part of 'package:pod_player/src/pod_player.dart'; 2 | 3 | class _VideoGestureDetector extends StatelessWidget { 4 | final Widget? child; 5 | final void Function()? onDoubleTap; 6 | final void Function()? onTap; 7 | final String tag; 8 | 9 | const _VideoGestureDetector({ 10 | required this.tag, 11 | this.child, 12 | this.onDoubleTap, 13 | this.onTap, 14 | }); 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | final podCtr = Get.find(tag: tag); 19 | return MouseRegion( 20 | onHover: (event) => podCtr.onOverlayHover(), 21 | onExit: (event) => podCtr.onOverlayHoverExit(), 22 | child: GestureDetector( 23 | onTap: onTap ?? podCtr.toggleVideoOverlay, 24 | onDoubleTap: onDoubleTap, 25 | child: child, 26 | ), 27 | ); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /lib/src/widgets/double_tap_icon.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:get/get.dart'; 3 | 4 | import '../controllers/pod_getx_video_controller.dart'; 5 | import 'doubble_tap_effect.dart'; 6 | 7 | class DoubleTapIcon extends StatefulWidget { 8 | final void Function() onDoubleTap; 9 | final String tag; 10 | final bool iconOnly; 11 | final bool isForward; 12 | final double height; 13 | final double? width; 14 | 15 | const DoubleTapIcon({ 16 | required this.onDoubleTap, 17 | required this.tag, 18 | required this.isForward, 19 | super.key, 20 | this.iconOnly = false, 21 | this.height = 50, 22 | this.width, 23 | }); 24 | 25 | @override 26 | State createState() => _DoubleTapIconState(); 27 | } 28 | 29 | class _DoubleTapIconState extends State 30 | with SingleTickerProviderStateMixin { 31 | late final AnimationController _animationController; 32 | late final Animation opacityCtr; 33 | 34 | @override 35 | void initState() { 36 | super.initState(); 37 | _animationController = AnimationController( 38 | vsync: this, 39 | duration: const Duration(milliseconds: 200), 40 | ); 41 | opacityCtr = Tween(begin: 0, end: 1).animate( 42 | CurvedAnimation( 43 | parent: _animationController, 44 | curve: Curves.easeInOut, 45 | ), 46 | ); 47 | final podCtr = Get.find(tag: widget.tag); 48 | if (widget.iconOnly && !widget.isForward) { 49 | podCtr.addListenerId('double-tap-left', _onDoubleTap); 50 | } 51 | if (widget.iconOnly && widget.isForward) { 52 | podCtr.addListenerId('double-tap-right', _onDoubleTap); 53 | } 54 | } 55 | 56 | @override 57 | void dispose() { 58 | final podCtr = Get.find(tag: widget.tag); 59 | 60 | if (widget.iconOnly && !widget.isForward) { 61 | podCtr.removeListenerId('double-tap-left', _onDoubleTap); 62 | } 63 | if (widget.iconOnly && widget.isForward) { 64 | podCtr.removeListenerId('double-tap-right', _onDoubleTap); 65 | } 66 | _animationController.dispose(); 67 | super.dispose(); 68 | } 69 | 70 | void _onDoubleTap() { 71 | widget.onDoubleTap(); 72 | _animationController.forward().then((_) { 73 | _animationController.reverse(); 74 | }); 75 | } 76 | 77 | @override 78 | Widget build(BuildContext context) { 79 | if (widget.iconOnly) return iconWithText(); 80 | return DoubleTapRippleEffect( 81 | onDoubleTap: _onDoubleTap, 82 | rippleColor: Colors.white, 83 | wrapper: (parentWidget, curveRadius) { 84 | final forwardRadius = 85 | !widget.isForward ? Radius.zero : Radius.circular(curveRadius); 86 | final backwardRadius = 87 | widget.isForward ? Radius.zero : Radius.circular(curveRadius); 88 | return ClipRRect( 89 | borderRadius: BorderRadius.only( 90 | bottomLeft: forwardRadius, 91 | topLeft: forwardRadius, 92 | bottomRight: backwardRadius, 93 | topRight: backwardRadius, 94 | ), 95 | child: parentWidget, 96 | ); 97 | }, 98 | child: iconWithText(), 99 | ); 100 | } 101 | 102 | SizedBox iconWithText() { 103 | return SizedBox( 104 | height: widget.height, 105 | width: widget.width, 106 | child: AnimatedBuilder( 107 | animation: _animationController, 108 | builder: (context, child) { 109 | const icon = Icon( 110 | Icons.play_arrow_sharp, 111 | size: 32, 112 | color: Colors.white, 113 | ); 114 | return Center( 115 | child: Column( 116 | mainAxisAlignment: MainAxisAlignment.center, 117 | children: [ 118 | RotatedBox( 119 | quarterTurns: widget.isForward ? 0 : 2, 120 | child: Stack( 121 | children: [ 122 | AnimatedOpacity( 123 | duration: const Duration(milliseconds: 200), 124 | opacity: opacityCtr.value, 125 | child: icon, 126 | ), 127 | Padding( 128 | padding: const EdgeInsets.only(left: 20), 129 | child: AnimatedOpacity( 130 | duration: const Duration(milliseconds: 300), 131 | opacity: opacityCtr.value, 132 | child: icon, 133 | ), 134 | ), 135 | Padding( 136 | padding: const EdgeInsets.only(left: 40), 137 | child: AnimatedOpacity( 138 | duration: const Duration(milliseconds: 600), 139 | opacity: opacityCtr.value, 140 | child: icon, 141 | ), 142 | ), 143 | ], 144 | ), 145 | ), 146 | GetBuilder( 147 | tag: widget.tag, 148 | id: 'double-tap', 149 | builder: (podCtr) { 150 | if (widget.isForward && podCtr.isRightDbTapIconVisible) { 151 | return AnimatedOpacity( 152 | duration: const Duration(milliseconds: 300), 153 | opacity: opacityCtr.value, 154 | child: Text( 155 | '${podCtr.isLeftDbTapIconVisible ? podCtr.leftDoubleTapduration : podCtr.rightDubleTapduration} Sec', 156 | style: const TextStyle( 157 | color: Colors.white, 158 | fontWeight: FontWeight.bold, 159 | ), 160 | ), 161 | ); 162 | } 163 | if (!widget.isForward && podCtr.isLeftDbTapIconVisible) { 164 | return AnimatedOpacity( 165 | duration: const Duration(milliseconds: 300), 166 | opacity: opacityCtr.value, 167 | child: Text( 168 | '${podCtr.isLeftDbTapIconVisible ? podCtr.leftDoubleTapduration : podCtr.rightDubleTapduration} Sec', 169 | style: const TextStyle( 170 | color: Colors.white, 171 | fontWeight: FontWeight.bold, 172 | ), 173 | ), 174 | ); 175 | } 176 | return const SizedBox(); 177 | }, 178 | ), 179 | ], 180 | ), 181 | ); 182 | }, 183 | ), 184 | ); 185 | } 186 | } 187 | -------------------------------------------------------------------------------- /lib/src/widgets/full_screen_view.dart: -------------------------------------------------------------------------------- 1 | part of 'package:pod_player/src/pod_player.dart'; 2 | 3 | class FullScreenView extends StatefulWidget { 4 | final String tag; 5 | const FullScreenView({ 6 | required this.tag, 7 | super.key, 8 | }); 9 | 10 | @override 11 | State createState() => _FullScreenViewState(); 12 | } 13 | 14 | class _FullScreenViewState extends State 15 | with TickerProviderStateMixin { 16 | late PodGetXVideoController _podCtr; 17 | @override 18 | void initState() { 19 | _podCtr = Get.find(tag: widget.tag); 20 | _podCtr.fullScreenContext = context; 21 | _podCtr.keyboardFocusWeb?.removeListener(_podCtr.keyboadListner); 22 | 23 | super.initState(); 24 | } 25 | 26 | @override 27 | void dispose() { 28 | _podCtr.keyboardFocusWeb?.requestFocus(); 29 | _podCtr.keyboardFocusWeb?.addListener(_podCtr.keyboadListner); 30 | super.dispose(); 31 | } 32 | 33 | @override 34 | Widget build(BuildContext context) { 35 | final loadingWidget = _podCtr.onLoading?.call(context) ?? 36 | const CircularProgressIndicator( 37 | backgroundColor: Colors.black87, 38 | color: Colors.white, 39 | strokeWidth: 2, 40 | ); 41 | 42 | return WillPopScope( 43 | onWillPop: () async { 44 | if (kIsWeb) { 45 | await _podCtr.disableFullScreen( 46 | context, 47 | widget.tag, 48 | enablePop: false, 49 | ); 50 | } 51 | if (!kIsWeb) await _podCtr.disableFullScreen(context, widget.tag); 52 | return true; 53 | }, 54 | child: Scaffold( 55 | backgroundColor: Colors.black, 56 | body: GetBuilder( 57 | tag: widget.tag, 58 | builder: (podCtr) => Center( 59 | child: ColoredBox( 60 | color: Colors.black, 61 | child: SizedBox( 62 | height: MediaQuery.of(context).size.height, 63 | width: MediaQuery.of(context).size.width, 64 | child: Center( 65 | child: podCtr.videoCtr == null 66 | ? loadingWidget 67 | : podCtr.videoCtr!.value.isInitialized 68 | ? _PodCoreVideoPlayer( 69 | tag: widget.tag, 70 | videoPlayerCtr: podCtr.videoCtr!, 71 | videoAspectRatio: 72 | podCtr.videoCtr?.value.aspectRatio ?? 16 / 9, 73 | ) 74 | : loadingWidget, 75 | ), 76 | ), 77 | ), 78 | ), 79 | ), 80 | ), 81 | ); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /lib/src/widgets/material_icon_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class MaterialIconButton extends StatelessWidget { 4 | const MaterialIconButton({ 5 | required this.child, 6 | required this.toolTipMesg, 7 | super.key, 8 | this.color, 9 | this.radius = 12, 10 | this.onPressed, 11 | this.onHover, 12 | this.onTapDown, 13 | }); 14 | 15 | final Color? color; 16 | final Widget child; 17 | final double radius; 18 | final String toolTipMesg; 19 | final void Function()? onPressed; 20 | final void Function(bool)? onHover; 21 | final void Function(TapDownDetails details)? onTapDown; 22 | @override 23 | Widget build(BuildContext context) { 24 | return Material( 25 | type: MaterialType.transparency, 26 | shape: const CircleBorder(), 27 | child: Tooltip( 28 | message: toolTipMesg, 29 | // textStyle: TextStyle(fontSize: 0.01), 30 | child: InkWell( 31 | borderRadius: BorderRadius.circular(radius * 4), 32 | onHover: onHover, 33 | onTap: onPressed, 34 | onTapDown: onTapDown, 35 | child: Padding( 36 | padding: EdgeInsets.all(radius), 37 | child: IconTheme( 38 | data: IconThemeData(color: color, size: 24), 39 | child: child, 40 | ), 41 | ), 42 | ), 43 | ), 44 | ); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: pod_player 2 | description: Vimeo and youtube player for flutter, Pod player provides customizable video player controls that support android, ios and web. 3 | version: 0.2.2 4 | homepage: https://github.com/newtaDev/pod_player 5 | 6 | environment: 7 | sdk: ">=3.0.0 <4.0.0" 8 | flutter: ">=1.17.0" 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | # services 14 | video_player: ^2.8.5 15 | http: ^1.2.1 16 | get: ^4.6.6 17 | wakelock_plus: ^1.2.4 18 | universal_html: ^2.2.4 19 | youtube_explode_dart: ^2.2.0 20 | 21 | dev_dependencies: 22 | flutter_test: 23 | sdk: flutter 24 | very_good_analysis: ^5.0.0+1 25 | 26 | screenshots: 27 | - description: Pod video player logo 28 | path: screenshots/logo.png 29 | -------------------------------------------------------------------------------- /screenshots/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newtaDev/pod_player/f3ea20e044d50bac6f35ac408edd65276f534540/screenshots/logo.png -------------------------------------------------------------------------------- /scripts/verify_pub.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "--------------- Format code ---------------" 4 | dart format . 5 | echo "--------------- --dry-run ---------------" 6 | dart pub publish --dry-run 7 | echo "--------------- verify pub score ---------------" 8 | pana . --no-warning 9 | 10 | -------------------------------------------------------------------------------- /test/pod_player_test.dart: -------------------------------------------------------------------------------- 1 | 2 | --------------------------------------------------------------------------------