├── example ├── ios │ ├── Flutter │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ └── AppFrameworkInfo.plist │ ├── Runner │ │ ├── Runner-Bridging-Header.h │ │ ├── Assets.xcassets │ │ │ ├── LaunchImage.imageset │ │ │ │ ├── LaunchImage.png │ │ │ │ ├── LaunchImage@2x.png │ │ │ │ ├── LaunchImage@3x.png │ │ │ │ ├── README.md │ │ │ │ └── Contents.json │ │ │ └── AppIcon.appiconset │ │ │ │ ├── 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-1024x1024@1x.png │ │ │ │ ├── Icon-App-83.5x83.5@2x.png │ │ │ │ └── Contents.json │ │ ├── AppDelegate.swift │ │ ├── Base.lproj │ │ │ ├── Main.storyboard │ │ │ └── LaunchScreen.storyboard │ │ └── Info.plist │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── WorkspaceSettings.xcsettings │ │ │ └── IDEWorkspaceChecks.plist │ ├── Runner.xcodeproj │ │ ├── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ ├── WorkspaceSettings.xcsettings │ │ │ │ └── IDEWorkspaceChecks.plist │ │ ├── xcshareddata │ │ │ └── xcschemes │ │ │ │ └── Runner.xcscheme │ │ └── project.pbxproj │ └── .gitignore ├── android │ ├── gradle.properties │ ├── .gitignore │ ├── app │ │ ├── src │ │ │ ├── main │ │ │ │ ├── res │ │ │ │ │ ├── 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 │ │ │ │ │ ├── drawable │ │ │ │ │ │ └── launch_background.xml │ │ │ │ │ └── values │ │ │ │ │ │ └── styles.xml │ │ │ │ ├── kotlin │ │ │ │ │ └── com │ │ │ │ │ │ └── example │ │ │ │ │ │ └── example │ │ │ │ │ │ └── MainActivity.kt │ │ │ │ └── AndroidManifest.xml │ │ │ ├── debug │ │ │ │ └── AndroidManifest.xml │ │ │ └── profile │ │ │ │ └── AndroidManifest.xml │ │ └── build.gradle │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ ├── settings.gradle │ └── build.gradle ├── .metadata ├── .gitignore ├── test │ └── widget_test.dart ├── lib │ ├── main.dart │ └── pages │ │ ├── demo2.dart │ │ └── demo1.dart ├── pubspec.yaml ├── pubspec.lock └── README.md ├── CHANGELOG.md ├── .metadata ├── LICENSE ├── pubspec.yaml ├── .gitignore ├── lib ├── schema.dart ├── slider.dart └── fijkplayer_skin.dart ├── pubspec.lock └── README.md /example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [2.2.8] - TODO: Add release date. 2 | 3 | * TODO: Describe initial release. 4 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.enableR8=true 3 | android.useAndroidX=true 4 | android.enableJetifier=true 5 | -------------------------------------------------------------------------------- /example/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/war1644/fijkplayer_skin/HEAD/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/war1644/fijkplayer_skin/HEAD/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/war1644/fijkplayer_skin/HEAD/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/war1644/fijkplayer_skin/HEAD/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/war1644/fijkplayer_skin/HEAD/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/war1644/fijkplayer_skin/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/war1644/fijkplayer_skin/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/war1644/fijkplayer_skin/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/war1644/fijkplayer_skin/HEAD/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/war1644/fijkplayer_skin/HEAD/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/war1644/fijkplayer_skin/HEAD/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/war1644/fijkplayer_skin/HEAD/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/war1644/fijkplayer_skin/HEAD/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/war1644/fijkplayer_skin/HEAD/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/war1644/fijkplayer_skin/HEAD/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/war1644/fijkplayer_skin/HEAD/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/war1644/fijkplayer_skin/HEAD/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/war1644/fijkplayer_skin/HEAD/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/war1644/fijkplayer_skin/HEAD/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/war1644/fijkplayer_skin/HEAD/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/war1644/fijkplayer_skin/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/war1644/fijkplayer_skin/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/war1644/fijkplayer_skin/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /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/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /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-5.6.2-all.zip 7 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.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/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 8af6b2f038c1172e61d418869363a28dffec3cb4 8 | channel: stable 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 8af6b2f038c1172e61d418869363a28dffec3cb4 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /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/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/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /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/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Flutter.podspec 20 | Flutter/Generated.xcconfig 21 | Flutter/app.flx 22 | Flutter/app.zip 23 | Flutter/flutter_assets/ 24 | Flutter/flutter_export_environment.sh 25 | ServiceDefinitions.json 26 | Runner/GeneratedPluginRegistrant.* 27 | 28 | # Exceptions to above rules. 29 | !default.mode1v3 30 | !default.mode2v3 31 | !default.pbxuser 32 | !default.perspectivev3 33 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | include ':app' 6 | 7 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 8 | def properties = new Properties() 9 | 10 | assert localPropertiesFile.exists() 11 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 12 | 13 | def flutterSdkPath = properties.getProperty("flutter.sdk") 14 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 15 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 16 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.3.50' 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.5.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | jcenter() 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 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /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 | .dart_tool/ 26 | .flutter-plugins 27 | .flutter-plugins-dependencies 28 | .packages 29 | .pub-cache/ 30 | .pub/ 31 | /build/ 32 | 33 | # Web related 34 | lib/generated_plugin_registrant.dart 35 | 36 | # Symbolication related 37 | app.*.symbols 38 | 39 | # Obfuscation related 40 | app.*.map.json 41 | 42 | # Exceptions to above rules. 43 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 44 | -------------------------------------------------------------------------------- /example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 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 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 KT Rolster 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 | -------------------------------------------------------------------------------- /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(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/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 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | example 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: fijkplayer_skin 2 | description: fijkplayer the skin 3 | version: 2.2.8 4 | homepage: https://github.com/war1644/fijkplayer_skin 5 | 6 | environment: 7 | sdk: ">=2.12.0 <3.0.0" 8 | 9 | dependencies: 10 | flutter: 11 | sdk: flutter 12 | fijkplayer: ^0.10.0 13 | wakelock: ^0.5.2 14 | 15 | dev_dependencies: 16 | flutter_test: 17 | sdk: flutter 18 | 19 | 20 | # For information on the generic Dart part of this file, see the 21 | # following page: https://dart.dev/tools/pub/pubspec 22 | 23 | # The following section is specific to Flutter. 24 | flutter: 25 | 26 | # To add assets to your package, add an assets section, like this: 27 | # assets: 28 | # - images/a_dot_burr.jpeg 29 | # - images/a_dot_ham.jpeg 30 | # 31 | # For details regarding assets in packages, see 32 | # https://flutter.dev/assets-and-images/#from-packages 33 | # 34 | # An image asset can refer to one or more resolution-specific "variants", see 35 | # https://flutter.dev/assets-and-images/#resolution-aware. 36 | 37 | # To add custom fonts to your package, add a fonts section here, 38 | # in this "flutter" section. Each entry in this list should have a 39 | # "family" key with the font family name, and a "fonts" key with a 40 | # list giving the asset and other descriptors for the font. For 41 | # example: 42 | # fonts: 43 | # - family: Schyler 44 | # fonts: 45 | # - asset: fonts/Schyler-Regular.ttf 46 | # - asset: fonts/Schyler-Italic.ttf 47 | # style: italic 48 | # - family: Trajan Pro 49 | # fonts: 50 | # - asset: fonts/TrajanPro.ttf 51 | # - asset: fonts/TrajanPro_Bold.ttf 52 | # weight: 700 53 | # 54 | # For details regarding fonts in packages, see 55 | # https://flutter.dev/custom-fonts/#from-packages 56 | -------------------------------------------------------------------------------- /.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 | .dart_tool/ 26 | .flutter-plugins 27 | .flutter-plugins-dependencies 28 | .packages 29 | .pub-cache/ 30 | .pub/ 31 | build/ 32 | 33 | # Android related 34 | **/android/**/gradle-wrapper.jar 35 | **/android/.gradle 36 | **/android/captures/ 37 | **/android/gradlew 38 | **/android/gradlew.bat 39 | **/android/local.properties 40 | **/android/**/GeneratedPluginRegistrant.java 41 | 42 | # iOS/XCode related 43 | **/ios/**/*.mode1v3 44 | **/ios/**/*.mode2v3 45 | **/ios/**/*.moved-aside 46 | **/ios/**/*.pbxuser 47 | **/ios/**/*.perspectivev3 48 | **/ios/**/*sync/ 49 | **/ios/**/.sconsign.dblite 50 | **/ios/**/.tags* 51 | **/ios/**/.vagrant/ 52 | **/ios/**/DerivedData/ 53 | **/ios/**/Icon? 54 | **/ios/**/Pods/ 55 | **/ios/**/.symlinks/ 56 | **/ios/**/profile 57 | **/ios/**/xcuserdata 58 | **/ios/.generated/ 59 | **/ios/Flutter/App.framework 60 | **/ios/Flutter/Flutter.framework 61 | **/ios/Flutter/Flutter.podspec 62 | **/ios/Flutter/Generated.xcconfig 63 | **/ios/Flutter/app.flx 64 | **/ios/Flutter/app.zip 65 | **/ios/Flutter/flutter_assets/ 66 | **/ios/Flutter/flutter_export_environment.sh 67 | **/ios/ServiceDefinitions.json 68 | **/ios/Runner/GeneratedPluginRegistrant.* 69 | 70 | # Exceptions to above rules. 71 | !**/ios/**/default.mode1v3 72 | !**/ios/**/default.mode2v3 73 | !**/ios/**/default.pbxuser 74 | !**/ios/**/default.perspectivev3 75 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 76 | -------------------------------------------------------------------------------- /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 28 30 | 31 | sourceSets { 32 | main.java.srcDirs += 'src/main/kotlin' 33 | } 34 | 35 | lintOptions { 36 | disable 'InvalidPackage' 37 | } 38 | 39 | defaultConfig { 40 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 41 | applicationId "com.example.example" 42 | minSdkVersion 16 43 | targetSdkVersion 28 44 | versionCode flutterVersionCode.toInteger() 45 | versionName flutterVersionName 46 | } 47 | 48 | buildTypes { 49 | release { 50 | // TODO: Add your own signing config for the release build. 51 | // Signing with the debug keys for now, so `flutter run --release` works. 52 | signingConfig signingConfigs.debug 53 | } 54 | } 55 | } 56 | 57 | flutter { 58 | source '../..' 59 | } 60 | 61 | dependencies { 62 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 63 | } 64 | -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: must_be_immutable 2 | import 'package:flutter/material.dart'; 3 | import 'package:example/pages/demo1.dart' show Demo1; 4 | import 'package:example/pages/demo2.dart' show Demo2; 5 | 6 | void main() { 7 | // debugPaintSizeEnabled = true; 8 | runApp(MyApp()); 9 | } 10 | 11 | class MyApp extends StatelessWidget { 12 | @override 13 | Widget build(BuildContext context) { 14 | return MaterialApp( 15 | title: 'fijkplayer_skin demo', 16 | theme: ThemeData( 17 | primarySwatch: Colors.blue, 18 | visualDensity: VisualDensity.adaptivePlatformDensity, 19 | ), 20 | home: Home(), 21 | ); 22 | } 23 | } 24 | 25 | class Home extends StatelessWidget { 26 | const Home({Key? key}) : super(key: key); 27 | 28 | @override 29 | Widget build(BuildContext context) { 30 | return Scaffold( 31 | body: ListView( 32 | children: [ 33 | MyButton( 34 | text: "完整例子(剧集、播放速度)", 35 | cb: () { 36 | Navigator.of(context).push( 37 | MaterialPageRoute( 38 | builder: (context) => Demo1(), 39 | ), 40 | ); 41 | }, 42 | ), 43 | MyButton( 44 | text: "精简例子", 45 | cb: () { 46 | Navigator.of(context).push( 47 | MaterialPageRoute( 48 | builder: (context) => Demo2(), 49 | ), 50 | ); 51 | }, 52 | ), 53 | ], 54 | ), 55 | ); 56 | } 57 | } 58 | 59 | class MyButton extends StatelessWidget { 60 | Function cb; 61 | String text; 62 | MyButton({ 63 | Key? key, 64 | required this.cb, 65 | required this.text, 66 | }) : super(key: key); 67 | 68 | @override 69 | Widget build(BuildContext context) { 70 | return Padding( 71 | padding: EdgeInsets.only( 72 | left: 10, 73 | right: 10, 74 | ), 75 | child: ElevatedButton( 76 | style: ButtonStyle( 77 | elevation: MaterialStateProperty.all(0), 78 | backgroundColor: MaterialStateProperty.all(Colors.blue), 79 | ), 80 | onPressed: () => cb(), 81 | child: Text( 82 | text, 83 | style: TextStyle( 84 | color: Colors.white, 85 | ), 86 | ), 87 | ), 88 | ); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /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/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 8 | 12 | 19 | 23 | 27 | 32 | 36 | 37 | 38 | 39 | 40 | 41 | 43 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /lib/schema.dart: -------------------------------------------------------------------------------- 1 | /// 2 | /// Code generated by jsonToDartModel https://ashamp.github.io/jsonToDartModel/ 3 | /// 4 | class VideoSourceFormatVideoList { 5 | /* 6 | { 7 | "url": "https://n1.szjal.cn/20210428/lsNZ6QAL/index.m3u8", 8 | "name": "综艺" 9 | } 10 | */ 11 | 12 | String? url; 13 | String? name; 14 | 15 | VideoSourceFormatVideoList({ 16 | this.url, 17 | this.name, 18 | }); 19 | VideoSourceFormatVideoList.fromJson(Map json) { 20 | url = json["url"]?.toString(); 21 | name = json["name"]?.toString(); 22 | } 23 | Map toJson() { 24 | final Map data = Map(); 25 | data["url"] = url; 26 | data["name"] = name; 27 | return data; 28 | } 29 | } 30 | 31 | class VideoSourceFormatVideo { 32 | /* 33 | { 34 | "name": "天空资源", 35 | "list": [ 36 | { 37 | "url": "https://n1.szjal.cn/20210428/lsNZ6QAL/index.m3u8", 38 | "name": "综艺" 39 | } 40 | ] 41 | } 42 | */ 43 | 44 | String? name; 45 | List? list; 46 | 47 | VideoSourceFormatVideo({ 48 | this.name, 49 | this.list, 50 | }); 51 | VideoSourceFormatVideo.fromJson(Map json) { 52 | name = json["name"]?.toString(); 53 | if (json["list"] != null) { 54 | final v = json["list"]; 55 | final arr0 = []; 56 | v.forEach((v) { 57 | arr0.add(VideoSourceFormatVideoList.fromJson(v)); 58 | }); 59 | list = arr0; 60 | } 61 | } 62 | Map toJson() { 63 | final Map data = Map(); 64 | data["name"] = name; 65 | if (list != null) { 66 | final v = list; 67 | final arr0 = []; 68 | v!.forEach((v) { 69 | arr0.add(v!.toJson()); 70 | }); 71 | data["list"] = arr0; 72 | } 73 | return data; 74 | } 75 | } 76 | 77 | class VideoSourceFormat { 78 | /* 79 | { 80 | "video": [ 81 | { 82 | "name": "天空资源", 83 | "list": [ 84 | { 85 | "url": "https://n1.szjal.cn/20210428/lsNZ6QAL/index.m3u8", 86 | "name": "综艺" 87 | } 88 | ] 89 | } 90 | ] 91 | } 92 | */ 93 | 94 | List? video; 95 | 96 | VideoSourceFormat({ 97 | this.video, 98 | }); 99 | VideoSourceFormat.fromJson(Map json) { 100 | if (json["video"] != null) { 101 | final v = json["video"]; 102 | final arr0 = []; 103 | v.forEach((v) { 104 | arr0.add(VideoSourceFormatVideo.fromJson(v)); 105 | }); 106 | video = arr0; 107 | } 108 | } 109 | Map toJson() { 110 | final Map data = Map(); 111 | if (video != null) { 112 | final v = video; 113 | final arr0 = []; 114 | v!.forEach((v) { 115 | arr0.add(v!.toJson()); 116 | }); 117 | data["video"] = arr0; 118 | } 119 | return data; 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /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/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: example 2 | description: A new Flutter project. 3 | 4 | # The following line prevents the package from being accidentally published to 5 | # pub.dev using `pub publish`. This is preferred for private packages. 6 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev 7 | 8 | # The following defines the version and build number for your application. 9 | # A version number is three numbers separated by dots, like 1.2.43 10 | # followed by an optional build number separated by a +. 11 | # Both the version and the builder number may be overridden in flutter 12 | # build by specifying --build-name and --build-number, respectively. 13 | # In Android, build-name is used as versionName while build-number used as versionCode. 14 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 15 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. 16 | # Read more about iOS versioning at 17 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 18 | version: 2.2.8 19 | 20 | environment: 21 | sdk: ">=2.12.0 <3.0.0" 22 | 23 | dependencies: 24 | flutter: 25 | sdk: flutter 26 | 27 | 28 | # The following adds the Cupertino Icons font to your application. 29 | # Use with the CupertinoIcons class for iOS style icons. 30 | cupertino_icons: ^0.1.3 31 | 32 | dev_dependencies: 33 | flutter_test: 34 | sdk: flutter 35 | 36 | fijkplayer: ^0.10.0 37 | fijkplayer_skin: 38 | path: ../ 39 | 40 | # For information on the generic Dart part of this file, see the 41 | # following page: https://dart.dev/tools/pub/pubspec 42 | 43 | # The following section is specific to Flutter. 44 | flutter: 45 | 46 | # The following line ensures that the Material Icons font is 47 | # included with your application, so that you can use the icons in 48 | # the material Icons class. 49 | uses-material-design: true 50 | 51 | # To add assets to your application, add an assets section, like this: 52 | # assets: 53 | # - images/a_dot_burr.jpeg 54 | # - images/a_dot_ham.jpeg 55 | 56 | # An image asset can refer to one or more resolution-specific "variants", see 57 | # https://flutter.dev/assets-and-images/#resolution-aware. 58 | 59 | # For details regarding adding assets from package dependencies, see 60 | # https://flutter.dev/assets-and-images/#from-packages 61 | 62 | # To add custom fonts to your application, add a fonts section here, 63 | # in this "flutter" section. Each entry in this list should have a 64 | # "family" key with the font family name, and a "fonts" key with a 65 | # list giving the asset and other descriptors for the font. For 66 | # example: 67 | # fonts: 68 | # - family: Schyler 69 | # fonts: 70 | # - asset: fonts/Schyler-Regular.ttf 71 | # - asset: fonts/Schyler-Italic.ttf 72 | # style: italic 73 | # - family: Trajan Pro 74 | # fonts: 75 | # - asset: fonts/TrajanPro.ttf 76 | # - asset: fonts/TrajanPro_Bold.ttf 77 | # weight: 700 78 | # 79 | # For details regarding fonts from package dependencies, 80 | # see https://flutter.dev/custom-fonts/#from-packages 81 | -------------------------------------------------------------------------------- /example/lib/pages/demo2.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:fijkplayer/fijkplayer.dart'; 3 | import 'package:fijkplayer_skin/fijkplayer_skin.dart'; 4 | import 'package:fijkplayer_skin/schema.dart' show VideoSourceFormat; 5 | 6 | class Demo2 extends StatefulWidget { 7 | @override 8 | Demo2State createState() => Demo2State(); 9 | } 10 | 11 | class Demo2State extends State { 12 | @override 13 | Widget build(BuildContext context) { 14 | // return VideoDetailPage(); 15 | return Scaffold( 16 | body: SingleChildScrollView( 17 | scrollDirection: Axis.vertical, 18 | child: VideoDetailPage(), 19 | ), 20 | ); 21 | } 22 | } 23 | 24 | // 定制UI配置项 25 | class PlayerShowConfig implements ShowConfigAbs { 26 | @override 27 | bool drawerBtn = false; 28 | @override 29 | bool nextBtn = false; 30 | @override 31 | bool speedBtn = true; 32 | @override 33 | bool topBar = true; 34 | @override 35 | bool lockBtn = true; 36 | @override 37 | bool autoNext = false; 38 | @override 39 | bool bottomPro = true; 40 | @override 41 | bool stateAuto = true; 42 | @override 43 | bool isAutoPlay = true; 44 | } 45 | 46 | class VideoDetailPage extends StatefulWidget { 47 | @override 48 | _VideoDetailPageState createState() => _VideoDetailPageState(); 49 | } 50 | 51 | class _VideoDetailPageState extends State 52 | with TickerProviderStateMixin { 53 | final FijkPlayer player = FijkPlayer(); 54 | Map>> videoList = { 55 | "video": [ 56 | { 57 | "name": "天空资源", 58 | "list": [ 59 | { 60 | "url": "https://v10.dious.cc/20211009/nONG14sk/index.m3u8", 61 | "name": "一级指控", 62 | }, 63 | ] 64 | }, 65 | ] 66 | }; 67 | 68 | VideoSourceFormat? _videoSourceTabs; 69 | 70 | int _curTabIdx = 0; 71 | int _curActiveIdx = 0; 72 | 73 | ShowConfigAbs vCfg = PlayerShowConfig(); 74 | 75 | @override 76 | void dispose() { 77 | player.dispose(); 78 | super.dispose(); 79 | } 80 | 81 | @override 82 | void initState() { 83 | super.initState(); 84 | // 格式化json转对象 85 | _videoSourceTabs = VideoSourceFormat.fromJson(videoList); 86 | // 这句不能省,必须有 87 | speed = 1.0; 88 | } 89 | 90 | @override 91 | Widget build(BuildContext context) { 92 | return Column( 93 | children: [ 94 | FijkView( 95 | height: 260, 96 | color: Colors.black, 97 | fit: FijkFit.cover, 98 | player: player, 99 | panelBuilder: ( 100 | FijkPlayer player, 101 | FijkData data, 102 | BuildContext context, 103 | Size viewSize, 104 | Rect texturePos, 105 | ) { 106 | /// 使用自定义的布局 107 | /// 精简模式,可不传递onChangeVideo 108 | return CustomFijkPanel( 109 | player: player, 110 | viewSize: viewSize, 111 | texturePos: texturePos, 112 | pageContent: context, 113 | // 标题 当前页面顶部的标题部分 114 | playerTitle: "标题", 115 | // 当前视频源tabIndex 116 | curTabIdx: _curTabIdx, 117 | // 当前视频源activeIndex 118 | curActiveIdx: _curActiveIdx, 119 | // 显示的配置 120 | showConfig: vCfg, 121 | // json格式化后的视频数据 122 | videoFormat: _videoSourceTabs, 123 | ); 124 | }, 125 | ), 126 | ], 127 | ); 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | url: "https://pub.flutter-io.cn" 9 | source: hosted 10 | version: "2.8.1" 11 | boolean_selector: 12 | dependency: transitive 13 | description: 14 | name: boolean_selector 15 | url: "https://pub.flutter-io.cn" 16 | source: hosted 17 | version: "2.1.0" 18 | characters: 19 | dependency: transitive 20 | description: 21 | name: characters 22 | url: "https://pub.flutter-io.cn" 23 | source: hosted 24 | version: "1.1.0" 25 | charcode: 26 | dependency: transitive 27 | description: 28 | name: charcode 29 | url: "https://pub.flutter-io.cn" 30 | source: hosted 31 | version: "1.3.1" 32 | clock: 33 | dependency: transitive 34 | description: 35 | name: clock 36 | url: "https://pub.flutter-io.cn" 37 | source: hosted 38 | version: "1.1.0" 39 | collection: 40 | dependency: transitive 41 | description: 42 | name: collection 43 | url: "https://pub.flutter-io.cn" 44 | source: hosted 45 | version: "1.15.0" 46 | fake_async: 47 | dependency: transitive 48 | description: 49 | name: fake_async 50 | url: "https://pub.flutter-io.cn" 51 | source: hosted 52 | version: "1.2.0" 53 | ffi: 54 | dependency: transitive 55 | description: 56 | name: ffi 57 | url: "https://pub.flutter-io.cn" 58 | source: hosted 59 | version: "1.1.2" 60 | fijkplayer: 61 | dependency: "direct main" 62 | description: 63 | name: fijkplayer 64 | url: "https://pub.flutter-io.cn" 65 | source: hosted 66 | version: "0.10.0" 67 | flutter: 68 | dependency: "direct main" 69 | description: flutter 70 | source: sdk 71 | version: "0.0.0" 72 | flutter_test: 73 | dependency: "direct dev" 74 | description: flutter 75 | source: sdk 76 | version: "0.0.0" 77 | flutter_web_plugins: 78 | dependency: transitive 79 | description: flutter 80 | source: sdk 81 | version: "0.0.0" 82 | js: 83 | dependency: transitive 84 | description: 85 | name: js 86 | url: "https://pub.flutter-io.cn" 87 | source: hosted 88 | version: "0.6.3" 89 | matcher: 90 | dependency: transitive 91 | description: 92 | name: matcher 93 | url: "https://pub.flutter-io.cn" 94 | source: hosted 95 | version: "0.12.10" 96 | meta: 97 | dependency: transitive 98 | description: 99 | name: meta 100 | url: "https://pub.flutter-io.cn" 101 | source: hosted 102 | version: "1.7.0" 103 | path: 104 | dependency: transitive 105 | description: 106 | name: path 107 | url: "https://pub.flutter-io.cn" 108 | source: hosted 109 | version: "1.8.0" 110 | sky_engine: 111 | dependency: transitive 112 | description: flutter 113 | source: sdk 114 | version: "0.0.99" 115 | source_span: 116 | dependency: transitive 117 | description: 118 | name: source_span 119 | url: "https://pub.flutter-io.cn" 120 | source: hosted 121 | version: "1.8.1" 122 | stack_trace: 123 | dependency: transitive 124 | description: 125 | name: stack_trace 126 | url: "https://pub.flutter-io.cn" 127 | source: hosted 128 | version: "1.10.0" 129 | stream_channel: 130 | dependency: transitive 131 | description: 132 | name: stream_channel 133 | url: "https://pub.flutter-io.cn" 134 | source: hosted 135 | version: "2.1.0" 136 | string_scanner: 137 | dependency: transitive 138 | description: 139 | name: string_scanner 140 | url: "https://pub.flutter-io.cn" 141 | source: hosted 142 | version: "1.1.0" 143 | term_glyph: 144 | dependency: transitive 145 | description: 146 | name: term_glyph 147 | url: "https://pub.flutter-io.cn" 148 | source: hosted 149 | version: "1.2.0" 150 | test_api: 151 | dependency: transitive 152 | description: 153 | name: test_api 154 | url: "https://pub.flutter-io.cn" 155 | source: hosted 156 | version: "0.4.2" 157 | typed_data: 158 | dependency: transitive 159 | description: 160 | name: typed_data 161 | url: "https://pub.flutter-io.cn" 162 | source: hosted 163 | version: "1.3.0" 164 | vector_math: 165 | dependency: transitive 166 | description: 167 | name: vector_math 168 | url: "https://pub.flutter-io.cn" 169 | source: hosted 170 | version: "2.1.0" 171 | wakelock: 172 | dependency: "direct main" 173 | description: 174 | name: wakelock 175 | url: "https://pub.flutter-io.cn" 176 | source: hosted 177 | version: "0.5.6" 178 | wakelock_macos: 179 | dependency: transitive 180 | description: 181 | name: wakelock_macos 182 | url: "https://pub.flutter-io.cn" 183 | source: hosted 184 | version: "0.4.0" 185 | wakelock_platform_interface: 186 | dependency: transitive 187 | description: 188 | name: wakelock_platform_interface 189 | url: "https://pub.flutter-io.cn" 190 | source: hosted 191 | version: "0.3.0" 192 | wakelock_web: 193 | dependency: transitive 194 | description: 195 | name: wakelock_web 196 | url: "https://pub.flutter-io.cn" 197 | source: hosted 198 | version: "0.4.0" 199 | wakelock_windows: 200 | dependency: transitive 201 | description: 202 | name: wakelock_windows 203 | url: "https://pub.flutter-io.cn" 204 | source: hosted 205 | version: "0.2.0" 206 | win32: 207 | dependency: transitive 208 | description: 209 | name: win32 210 | url: "https://pub.flutter-io.cn" 211 | source: hosted 212 | version: "2.2.9" 213 | sdks: 214 | dart: ">=2.13.0 <3.0.0" 215 | flutter: ">=2.0.0" 216 | -------------------------------------------------------------------------------- /example/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | url: "https://pub.flutter-io.cn" 9 | source: hosted 10 | version: "2.8.1" 11 | boolean_selector: 12 | dependency: transitive 13 | description: 14 | name: boolean_selector 15 | url: "https://pub.flutter-io.cn" 16 | source: hosted 17 | version: "2.1.0" 18 | characters: 19 | dependency: transitive 20 | description: 21 | name: characters 22 | url: "https://pub.flutter-io.cn" 23 | source: hosted 24 | version: "1.1.0" 25 | charcode: 26 | dependency: transitive 27 | description: 28 | name: charcode 29 | url: "https://pub.flutter-io.cn" 30 | source: hosted 31 | version: "1.3.1" 32 | clock: 33 | dependency: transitive 34 | description: 35 | name: clock 36 | url: "https://pub.flutter-io.cn" 37 | source: hosted 38 | version: "1.1.0" 39 | collection: 40 | dependency: transitive 41 | description: 42 | name: collection 43 | url: "https://pub.flutter-io.cn" 44 | source: hosted 45 | version: "1.15.0" 46 | cupertino_icons: 47 | dependency: "direct main" 48 | description: 49 | name: cupertino_icons 50 | url: "https://pub.flutter-io.cn" 51 | source: hosted 52 | version: "0.1.3" 53 | fake_async: 54 | dependency: transitive 55 | description: 56 | name: fake_async 57 | url: "https://pub.flutter-io.cn" 58 | source: hosted 59 | version: "1.2.0" 60 | ffi: 61 | dependency: transitive 62 | description: 63 | name: ffi 64 | url: "https://pub.flutter-io.cn" 65 | source: hosted 66 | version: "1.1.2" 67 | fijkplayer: 68 | dependency: "direct dev" 69 | description: 70 | name: fijkplayer 71 | url: "https://pub.flutter-io.cn" 72 | source: hosted 73 | version: "0.10.0" 74 | fijkplayer_skin: 75 | dependency: "direct dev" 76 | description: 77 | path: ".." 78 | relative: true 79 | source: path 80 | version: "2.2.8" 81 | flutter: 82 | dependency: "direct main" 83 | description: flutter 84 | source: sdk 85 | version: "0.0.0" 86 | flutter_test: 87 | dependency: "direct dev" 88 | description: flutter 89 | source: sdk 90 | version: "0.0.0" 91 | flutter_web_plugins: 92 | dependency: transitive 93 | description: flutter 94 | source: sdk 95 | version: "0.0.0" 96 | js: 97 | dependency: transitive 98 | description: 99 | name: js 100 | url: "https://pub.flutter-io.cn" 101 | source: hosted 102 | version: "0.6.3" 103 | matcher: 104 | dependency: transitive 105 | description: 106 | name: matcher 107 | url: "https://pub.flutter-io.cn" 108 | source: hosted 109 | version: "0.12.10" 110 | meta: 111 | dependency: transitive 112 | description: 113 | name: meta 114 | url: "https://pub.flutter-io.cn" 115 | source: hosted 116 | version: "1.7.0" 117 | path: 118 | dependency: transitive 119 | description: 120 | name: path 121 | url: "https://pub.flutter-io.cn" 122 | source: hosted 123 | version: "1.8.0" 124 | sky_engine: 125 | dependency: transitive 126 | description: flutter 127 | source: sdk 128 | version: "0.0.99" 129 | source_span: 130 | dependency: transitive 131 | description: 132 | name: source_span 133 | url: "https://pub.flutter-io.cn" 134 | source: hosted 135 | version: "1.8.1" 136 | stack_trace: 137 | dependency: transitive 138 | description: 139 | name: stack_trace 140 | url: "https://pub.flutter-io.cn" 141 | source: hosted 142 | version: "1.10.0" 143 | stream_channel: 144 | dependency: transitive 145 | description: 146 | name: stream_channel 147 | url: "https://pub.flutter-io.cn" 148 | source: hosted 149 | version: "2.1.0" 150 | string_scanner: 151 | dependency: transitive 152 | description: 153 | name: string_scanner 154 | url: "https://pub.flutter-io.cn" 155 | source: hosted 156 | version: "1.1.0" 157 | term_glyph: 158 | dependency: transitive 159 | description: 160 | name: term_glyph 161 | url: "https://pub.flutter-io.cn" 162 | source: hosted 163 | version: "1.2.0" 164 | test_api: 165 | dependency: transitive 166 | description: 167 | name: test_api 168 | url: "https://pub.flutter-io.cn" 169 | source: hosted 170 | version: "0.4.2" 171 | typed_data: 172 | dependency: transitive 173 | description: 174 | name: typed_data 175 | url: "https://pub.flutter-io.cn" 176 | source: hosted 177 | version: "1.3.0" 178 | vector_math: 179 | dependency: transitive 180 | description: 181 | name: vector_math 182 | url: "https://pub.flutter-io.cn" 183 | source: hosted 184 | version: "2.1.0" 185 | wakelock: 186 | dependency: transitive 187 | description: 188 | name: wakelock 189 | url: "https://pub.flutter-io.cn" 190 | source: hosted 191 | version: "0.5.6" 192 | wakelock_macos: 193 | dependency: transitive 194 | description: 195 | name: wakelock_macos 196 | url: "https://pub.flutter-io.cn" 197 | source: hosted 198 | version: "0.4.0" 199 | wakelock_platform_interface: 200 | dependency: transitive 201 | description: 202 | name: wakelock_platform_interface 203 | url: "https://pub.flutter-io.cn" 204 | source: hosted 205 | version: "0.3.0" 206 | wakelock_web: 207 | dependency: transitive 208 | description: 209 | name: wakelock_web 210 | url: "https://pub.flutter-io.cn" 211 | source: hosted 212 | version: "0.4.0" 213 | wakelock_windows: 214 | dependency: transitive 215 | description: 216 | name: wakelock_windows 217 | url: "https://pub.flutter-io.cn" 218 | source: hosted 219 | version: "0.2.0" 220 | win32: 221 | dependency: transitive 222 | description: 223 | name: win32 224 | url: "https://pub.flutter-io.cn" 225 | source: hosted 226 | version: "2.2.9" 227 | sdks: 228 | dart: ">=2.13.0 <3.0.0" 229 | flutter: ">=2.0.0" 230 | -------------------------------------------------------------------------------- /lib/slider.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | 3 | import 'package:flutter/material.dart'; 4 | 5 | /// FijkSlider is like Slider in Flutter SDK. 6 | /// FijkSlider support [cacheValue] which can be used 7 | /// to show the player's cached buffer. 8 | /// The [colors] is used to make colorful painter to draw the line and circle. 9 | class NewFijkSlider extends StatefulWidget { 10 | final double value; 11 | final double cacheValue; 12 | 13 | final ValueChanged onChanged; 14 | final ValueChanged? onChangeStart; 15 | final ValueChanged onChangeEnd; 16 | 17 | final double min; 18 | final double max; 19 | 20 | final NewFijkSliderColors colors; 21 | 22 | const NewFijkSlider({ 23 | Key? key, 24 | required this.value, 25 | required this.onChanged, 26 | this.cacheValue = 0.0, 27 | this.onChangeStart, 28 | required this.onChangeEnd, 29 | this.min = 0.0, 30 | this.max = 1.0, 31 | this.colors = const NewFijkSliderColors(), 32 | }); 33 | 34 | @override 35 | State createState() { 36 | return _NewFijkSliderState(); 37 | } 38 | } 39 | 40 | class _NewFijkSliderState extends State { 41 | bool dragging = false; 42 | 43 | late double dragValue; 44 | 45 | static const double margin = 2.0; 46 | 47 | @override 48 | Widget build(BuildContext context) { 49 | double v = widget.value / (widget.max - widget.min); 50 | double cv = widget.cacheValue / (widget.max - widget.min); 51 | 52 | return GestureDetector( 53 | child: Container( 54 | margin: EdgeInsets.only(left: margin, right: margin), 55 | height: double.infinity, 56 | width: double.infinity, 57 | color: Colors.transparent, 58 | child: CustomPaint( 59 | painter: _SliderPainter(v, cv, dragging, colors: widget.colors), 60 | ), 61 | ), 62 | onHorizontalDragStart: (DragStartDetails details) { 63 | setState(() { 64 | dragging = true; 65 | }); 66 | dragValue = widget.value; 67 | if (widget.onChangeStart != null) { 68 | widget.onChangeStart!(dragValue); 69 | } 70 | }, 71 | onHorizontalDragUpdate: (DragUpdateDetails details) { 72 | final box = context.findRenderObject() as RenderBox; 73 | final dx = details.localPosition.dx; 74 | dragValue = (dx - margin) / (box.size.width - 2 * margin); 75 | dragValue = max(0, min(1, dragValue)); 76 | dragValue = dragValue * (widget.max - widget.min) + widget.min; 77 | // ignore: unnecessary_null_comparison 78 | if (widget.onChanged != null) { 79 | widget.onChanged(dragValue); 80 | } 81 | }, 82 | onHorizontalDragEnd: (DragEndDetails details) { 83 | setState(() { 84 | dragging = false; 85 | }); 86 | // ignore: unnecessary_null_comparison 87 | if (widget.onChangeEnd != null) { 88 | widget.onChangeEnd(dragValue); 89 | } 90 | }, 91 | ); 92 | } 93 | } 94 | 95 | /// Colors for the FijkSlider 96 | class NewFijkSliderColors { 97 | const NewFijkSliderColors({ 98 | this.playedColor = const Color.fromRGBO(255, 0, 0, 0.6), 99 | this.bufferedColor = const Color.fromRGBO(50, 50, 100, 0.4), 100 | this.cursorColor = const Color.fromRGBO(255, 0, 0, 0.8), 101 | this.baselineColor = const Color.fromRGBO(200, 200, 200, 0.5), 102 | }); 103 | 104 | final Color playedColor; 105 | final Color bufferedColor; 106 | final Color cursorColor; 107 | final Color baselineColor; 108 | 109 | @override 110 | bool operator ==(Object other) => 111 | identical(this, other) || 112 | other is NewFijkSliderColors && 113 | runtimeType == other.runtimeType && 114 | hashCode == other.hashCode; 115 | 116 | @override 117 | int get hashCode => 118 | hashValues(playedColor, bufferedColor, cursorColor, baselineColor); 119 | } 120 | 121 | class _SliderPainter extends CustomPainter { 122 | final double v; 123 | final double cv; 124 | 125 | final bool dragging; 126 | final Paint pt = Paint(); 127 | 128 | final NewFijkSliderColors colors; 129 | 130 | _SliderPainter(this.v, this.cv, this.dragging, 131 | {this.colors = const NewFijkSliderColors()}); 132 | 133 | @override 134 | void paint(Canvas canvas, Size size) { 135 | double lineHeight = min(size.height / 2, 2); 136 | pt.color = colors.baselineColor; 137 | 138 | double radius = min(size.height / 2, 20); 139 | // draw background 140 | canvas.drawRRect( 141 | RRect.fromRectAndRadius( 142 | Rect.fromPoints( 143 | Offset(0, size.height / 2 - lineHeight), 144 | Offset(size.width, size.height / 2 + lineHeight), 145 | ), 146 | Radius.circular(radius), 147 | ), 148 | pt, 149 | ); 150 | 151 | final double value = v * size.width; 152 | 153 | // draw played part 154 | pt.color = colors.playedColor; 155 | canvas.drawRRect( 156 | RRect.fromRectAndRadius( 157 | Rect.fromPoints( 158 | Offset(0, size.height / 2 - lineHeight), 159 | Offset(value, size.height / 2 + lineHeight), 160 | ), 161 | Radius.circular(radius), 162 | ), 163 | pt, 164 | ); 165 | 166 | // draw cached part 167 | final double cacheValue = cv * size.width; 168 | if (cacheValue > value && cacheValue > 0) { 169 | pt.color = colors.bufferedColor; 170 | canvas.drawRRect( 171 | RRect.fromRectAndRadius( 172 | Rect.fromPoints( 173 | Offset(value, size.height / 2 - lineHeight), 174 | Offset(cacheValue, size.height / 2 + lineHeight), 175 | ), 176 | Radius.circular(radius), 177 | ), 178 | pt, 179 | ); 180 | } 181 | 182 | // draw circle cursor 183 | pt.color = colors.cursorColor; 184 | pt.color = pt.color.withAlpha(max(0, pt.color.alpha - 50)); 185 | radius = min(size.height / 2, dragging ? 12 : 8); 186 | canvas.drawCircle(Offset(value, size.height / 2), radius, pt); 187 | pt.color = colors.cursorColor; 188 | radius = min(size.height / 2, dragging ? 12 : 6); 189 | canvas.drawCircle(Offset(value, size.height / 2), radius, pt); 190 | } 191 | 192 | @override 193 | bool operator ==(Object other) => 194 | identical(this, other) || 195 | other is _SliderPainter && hashCode == other.hashCode; 196 | 197 | @override 198 | int get hashCode => hashValues(v, cv, dragging, colors); 199 | 200 | @override 201 | bool shouldRepaint(_SliderPainter oldDelegate) { 202 | return hashCode != oldDelegate.hashCode; 203 | } 204 | } 205 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # fijkplayer_skin 3 | [![pub package](https://img.shields.io/pub/v/fijkplayer_skin.svg)](https://pub.dev/packages/fijkplayer_skin) 4 | 5 | 这是一款 fijkplayer 播放器的普通皮肤,主要解决 fijkplayer 自带的皮肤不好看,没有手势拖动快进,快退 6 | fijkplayer_skin只是一款皮肤,并不是播放器,所以 fijkplayer 存在的问题,这里 fijkplayer_skin 一样存在 7 | 8 | ## Flutter SDK要求 9 | sdk >= 2.12.0 支持空安全 10 | 11 | ## 功能如下 12 | 13 | * 手势滑动,快进快退 14 | * 上下滑动(左:屏幕亮度 右:系统音量) 15 | * 视频内剧集切换 (全屏模式下,视频内部切换播放剧集) 16 | * 倍数切换,(全屏模式下,切换倍数) 17 | * 锁定,(锁定UI,防误触) 18 | * 设置视频顶部返回,标题 19 | * 支持部分UI配置显示隐藏 20 | 21 | 22 | ## 使用说明 23 | 24 | 在使用皮肤之前,你需要查看 fijkplayer 的文档说明,了解如何 fijkplayer [自定义UI](https://fijkplayer.befovy.com/docs/zh/custom-ui.html#gsc.tab=0) 25 | 26 | ## 预览 27 |

28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 |

37 | 38 | 39 | ## 安装 40 | > 如果 pub 安装失败或者不能使用,请更换git方式引入 41 | 42 | pubspec.yaml 43 | ```yaml 44 | dependencies: 45 | fijkplayer: ${lastes_version} 46 | fijkplayer_skin: ${lastes_version} 47 | ``` 48 | 或者 49 | ```yaml 50 | fijkplayer_skin: 51 | git: 52 | url: git@github.com:war1644/fijkplayer_skin.git 53 | ``` 54 | 55 | ## 参数说明 56 | 57 | _curTabIdx 当前选中的tab索引,_curActiveIdx 当前选中的剧集索引。如果你使用过 react 你一定知道状态提升,父组件托管数据,子组件只负责渲染,这里的 _curTabIdx 和 _curActiveIdx 也是同理,在父组件中可以给多个需要该数据的组件传递。(包括皮肤内部也使用该数据) 58 | 59 | videoList 存放视频列表,请参考我的格式,使用 fijkplayer_skin/schema.dart 中的 VideoSourceFormat 格式化数据 60 | 61 | onChangeVideo(int curTabIdx, int curActiveIdx) 钩子函数,在播放器内切换剧集会触发该函数,回调参数是最新的 TabIdx 和 ActiveIdx ,用于更新托管在父组件中的 _curTabIdx 和 _curActiveIdx 62 | 63 | pageContent 传递的就是当前组件的 context,这里注意,你当前的根组件不要使用 MaterialApp 否则会报错,请使用 Scaffold 64 | 65 | showConfig 传递一个接口实例,抽象类 ShowConfigAbs,实现之后传递给皮肤,定制你需要显示的按键(参数如下) 66 | 67 | ```code 68 | bool drawerBtn // 是否显示剧集按钮 69 | bool nextBtn // 是否显示下一集按钮 70 | bool speedBtn // 是否显示速度按钮 71 | bool topBar // 是否显示播放器状态栏(顶部),非系统 72 | bool lockBtn // 是否显示锁按钮 73 | bool autoNext // 播放完成后是否自动播放下一集,false 播放完成即暂停 74 | bool bottomPro // 底部吸底进度条,贴底部,类似开眼视频 75 | bool stateAuto // 是否自适应系统状态栏,true 会计算系统状态栏,从而加大 topBar 的高度,避免挡住播放器状态栏 76 | bool isAutoPlay // 是否自动开始播放 77 | ``` 78 | 79 | videoFormat json 格式化后的视频数据,使用 VideoSourceFormat 格式化json数据 80 | 81 | ## 具体例子 82 | 完整例子查看example 83 | 84 | ## 基本示例 85 | 86 | ```dart 87 | 88 | import 'package:flutter/material.dart'; 89 | import 'package:fijkplayer/fijkplayer.dart'; 90 | import 'package:fijkplayer_skin/fijkplayer_skin.dart'; 91 | import 'package:fijkplayer_skin/schema.dart' show VideoSourceFormat; 92 | 93 | // 这里实现一个皮肤显示配置项 94 | class PlayerShowConfig implements ShowConfigAbs { 95 | @override 96 | bool drawerBtn = true; 97 | @override 98 | bool nextBtn = true; 99 | @override 100 | bool speedBtn = true; 101 | @override 102 | bool topBar = true; 103 | @override 104 | bool lockBtn = true; 105 | @override 106 | bool autoNext = true; 107 | @override 108 | bool bottomPro = true; 109 | @override 110 | bool stateAuto = true; 111 | @override 112 | bool isAutoPlay = true; 113 | } 114 | 115 | class VideoScreen extends StatefulWidget { 116 | VideoScreen(); 117 | 118 | @override 119 | _VideoScreenState createState() => _VideoScreenState(); 120 | } 121 | 122 | class _VideoScreenState extends State { 123 | // FijkPlayer实例 124 | final FijkPlayer player = FijkPlayer(); 125 | // 当前tab的index,默认0 126 | int _curTabIdx = 0; 127 | // 当前选中的tablist index,默认0 128 | int _curActiveIdx = 0; 129 | ShowConfigAbs vCfg = PlayerShowConfig(); 130 | // 视频源列表,请参考当前videoList完整例子 131 | Map>> videoList = { 132 | "video": [ 133 | { 134 | "name": "天空资源", 135 | "list": [ 136 | { 137 | "url": "https://n1.szjal.cn/20210428/lsNZ6QAL/index.m3u8", 138 | "name": "综艺" 139 | }, 140 | { 141 | "url": "https://static.smartisanos.cn/common/video/t1-ui.mp4", 142 | "name": "锤子1" 143 | }, 144 | { 145 | "url": "https://static.smartisanos.cn/common/video/video-jgpro.mp4", 146 | "name": "锤子2" 147 | } 148 | ] 149 | }, 150 | { 151 | "name": "天空资源", 152 | "list": [ 153 | { 154 | "url": "https://n1.szjal.cn/20210428/lsNZ6QAL/index.m3u8", 155 | "name": "综艺" 156 | }, 157 | { 158 | "url": "https://static.smartisanos.cn/common/video/t1-ui.mp4", 159 | "name": "锤子1" 160 | }, 161 | { 162 | "url": "https://static.smartisanos.cn/common/video/video-jgpro.mp4", 163 | "name": "锤子2" 164 | } 165 | ] 166 | }, 167 | ] 168 | }; 169 | 170 | VideoSourceFormat? _videoSourceTabs; 171 | 172 | @override 173 | void initState() { 174 | super.initState(); 175 | // 格式化json转对象 176 | _videoSourceTabs = VideoSourceFormat.fromJson(videoList); 177 | // 这句不能省,必须有 178 | speed = 1.0; 179 | } 180 | 181 | @override 182 | void dispose() { 183 | player.dispose(); 184 | super.dispose(); 185 | } 186 | 187 | // 播放器内部切换视频钩子,回调,tabIdx 和 activeIdx 188 | void onChangeVideo(int curTabIdx, int curActiveIdx) { 189 | this.setState(() { 190 | _curTabIdx = curTabIdx; 191 | _curActiveIdx = curActiveIdx; 192 | }); 193 | } 194 | 195 | @override 196 | Widget build(BuildContext context) { 197 | return Scaffold( 198 | appBar: AppBar(title: Text("Fijkplayer Example")), 199 | body: Container( 200 | alignment: Alignment.center, 201 | // 这里 FijkView 开始为自定义 UI 部分 202 | child: FijkView( 203 | height: 260, 204 | color: Colors.black, 205 | fit: FijkFit.cover, 206 | player: player, 207 | panelBuilder: ( 208 | FijkPlayer player, 209 | FijkData data, 210 | BuildContext context, 211 | Size viewSize, 212 | Rect texturePos, 213 | ) { 214 | /// 使用自定义的布局 215 | return CustomFijkPanel( 216 | player: player, 217 | // 传递 context 用于左上角返回箭头关闭当前页面,不要传递错误 context, 218 | // 如果要点击箭头关闭当前的页面,那必须传递当前组件的根 context 219 | pageContent: context, 220 | viewSize: viewSize, 221 | texturePos: texturePos, 222 | // 标题 当前页面顶部的标题部分,可以不传,默认空字符串 223 | playerTitle: "标题", 224 | // 当前视频改变钩子,简单模式,单个视频播放,可以不传 225 | onChangeVideo: onChangeVideo, 226 | // 当前视频源tabIndex 227 | curTabIdx: _curTabIdx, 228 | // 当前视频源activeIndex 229 | curActiveIdx: _curActiveIdx, 230 | // 显示的配置 231 | showConfig: vCfg, 232 | // json格式化后的视频数据 233 | videoFormat: _videoSourceTabs, 234 | ); 235 | }, 236 | ); 237 | ), 238 | ); 239 | } 240 | 241 | } 242 | 243 | ``` 244 | 245 | ## LICENSE 246 | MIT 247 | -------------------------------------------------------------------------------- /example/lib/pages/demo1.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:fijkplayer/fijkplayer.dart'; 3 | import 'package:fijkplayer_skin/fijkplayer_skin.dart'; 4 | import 'package:fijkplayer_skin/schema.dart' show VideoSourceFormat; 5 | 6 | class Demo1 extends StatefulWidget { 7 | @override 8 | Demo1State createState() => Demo1State(); 9 | } 10 | 11 | class Demo1State extends State { 12 | @override 13 | Widget build(BuildContext context) { 14 | // return VideoDetailPage(); 15 | return Scaffold( 16 | body: SingleChildScrollView( 17 | scrollDirection: Axis.vertical, 18 | child: VideoDetailPage(), 19 | ), 20 | ); 21 | } 22 | } 23 | 24 | // 定制UI配置项 25 | class PlayerShowConfig implements ShowConfigAbs { 26 | @override 27 | bool drawerBtn = true; 28 | @override 29 | bool nextBtn = true; 30 | @override 31 | bool speedBtn = true; 32 | @override 33 | bool topBar = true; 34 | @override 35 | bool lockBtn = true; 36 | @override 37 | bool autoNext = true; 38 | @override 39 | bool bottomPro = true; 40 | @override 41 | bool stateAuto = true; 42 | @override 43 | bool isAutoPlay = false; 44 | } 45 | 46 | class VideoDetailPage extends StatefulWidget { 47 | @override 48 | _VideoDetailPageState createState() => _VideoDetailPageState(); 49 | } 50 | 51 | class _VideoDetailPageState extends State 52 | with TickerProviderStateMixin { 53 | final FijkPlayer player = FijkPlayer(); 54 | Map>> videoList = { 55 | "video": [ 56 | { 57 | "name": "天空资源", 58 | "list": [ 59 | { 60 | "url": "https://static.smartisanos.cn/common/video/t1-ui.mp4", 61 | "name": "锤子UI-1", 62 | }, 63 | { 64 | "url": "https://static.smartisanos.cn/common/video/video-jgpro.mp4", 65 | "name": "锤子UI-2", 66 | }, 67 | { 68 | "url": "https://v-cdn.zjol.com.cn/280443.mp4", 69 | "name": "其他", 70 | }, 71 | ] 72 | }, 73 | { 74 | "name": "天空资源", 75 | "list": [ 76 | { 77 | "url": "https://n1.szjal.cn/20210428/lsNZ6QAL/index.m3u8", 78 | "name": "综艺", 79 | }, 80 | { 81 | "url": "https://static.smartisanos.cn/common/video/t1-ui.mp4", 82 | "name": "锤子1", 83 | }, 84 | { 85 | "url": "https://static.smartisanos.cn/common/video/video-jgpro.mp4", 86 | "name": "锤子2", 87 | } 88 | ] 89 | }, 90 | ] 91 | }; 92 | 93 | VideoSourceFormat? _videoSourceTabs; 94 | late TabController _tabController; 95 | 96 | int _curTabIdx = 0; 97 | int _curActiveIdx = 0; 98 | 99 | ShowConfigAbs vCfg = PlayerShowConfig(); 100 | 101 | @override 102 | void dispose() { 103 | player.dispose(); 104 | _tabController.dispose(); 105 | super.dispose(); 106 | } 107 | 108 | // 钩子函数,用于更新状态 109 | void onChangeVideo(int curTabIdx, int curActiveIdx) { 110 | this.setState(() { 111 | _curTabIdx = curTabIdx; 112 | _curActiveIdx = curActiveIdx; 113 | }); 114 | } 115 | 116 | @override 117 | void initState() { 118 | super.initState(); 119 | // 格式化json转对象 120 | _videoSourceTabs = VideoSourceFormat.fromJson(videoList); 121 | // tabbar初始化 122 | _tabController = TabController( 123 | length: _videoSourceTabs!.video!.length, 124 | vsync: this, 125 | ); 126 | // 这句不能省,必须有 127 | speed = 1.0; 128 | } 129 | 130 | // build 剧集 131 | Widget buildPlayDrawer() { 132 | return Scaffold( 133 | appBar: PreferredSize( 134 | preferredSize: Size.fromHeight(24), 135 | child: AppBar( 136 | backgroundColor: Colors.black, 137 | automaticallyImplyLeading: false, 138 | primary: false, 139 | elevation: 0, 140 | title: TabBar( 141 | tabs: _videoSourceTabs!.video! 142 | .map((e) => Tab(text: e!.name!)) 143 | .toList(), 144 | isScrollable: true, 145 | controller: _tabController, 146 | ), 147 | ), 148 | ), 149 | body: Container( 150 | color: Colors.black87, 151 | child: TabBarView( 152 | controller: _tabController, 153 | children: createTabConList(), 154 | ), 155 | ), 156 | ); 157 | } 158 | 159 | // 剧集 tabCon 160 | List createTabConList() { 161 | List list = []; 162 | _videoSourceTabs!.video!.asMap().keys.forEach((int tabIdx) { 163 | List playListBtns = _videoSourceTabs!.video![tabIdx]!.list! 164 | .asMap() 165 | .keys 166 | .map((int activeIdx) { 167 | return Padding( 168 | padding: EdgeInsets.only(left: 5, right: 5), 169 | child: ElevatedButton( 170 | style: ButtonStyle( 171 | shape: MaterialStateProperty.all( 172 | RoundedRectangleBorder( 173 | borderRadius: BorderRadius.circular(5), 174 | ), 175 | ), 176 | elevation: MaterialStateProperty.all(0), 177 | backgroundColor: MaterialStateProperty.all( 178 | tabIdx == _curTabIdx && activeIdx == _curActiveIdx 179 | ? Colors.red 180 | : Colors.blue), 181 | ), 182 | onPressed: () async { 183 | setState(() { 184 | _curTabIdx = tabIdx; 185 | _curActiveIdx = activeIdx; 186 | }); 187 | String nextVideoUrl = 188 | _videoSourceTabs!.video![tabIdx]!.list![activeIdx]!.url!; 189 | // 切换播放源 190 | // 如果不是自动开始播放,那么先执行stop 191 | if (player.value.state == FijkState.completed) { 192 | await player.stop(); 193 | } 194 | await player.reset().then((_) async { 195 | player.setDataSource(nextVideoUrl, autoPlay: true); 196 | }); 197 | }, 198 | child: Text( 199 | _videoSourceTabs!.video![tabIdx]!.list![activeIdx]!.name!, 200 | style: TextStyle( 201 | color: Colors.white, 202 | ), 203 | ), 204 | ), 205 | ); 206 | }).toList(); 207 | // 208 | list.add( 209 | SingleChildScrollView( 210 | child: Padding( 211 | padding: EdgeInsets.only(left: 5, right: 5), 212 | child: Wrap( 213 | direction: Axis.horizontal, 214 | children: playListBtns, 215 | ), 216 | ), 217 | ), 218 | ); 219 | }); 220 | return list; 221 | } 222 | 223 | @override 224 | Widget build(BuildContext context) { 225 | return Column( 226 | children: [ 227 | FijkView( 228 | height: 260, 229 | color: Colors.black, 230 | fit: FijkFit.cover, 231 | player: player, 232 | panelBuilder: ( 233 | FijkPlayer player, 234 | FijkData data, 235 | BuildContext context, 236 | Size viewSize, 237 | Rect texturePos, 238 | ) { 239 | /// 使用自定义的布局 240 | return CustomFijkPanel( 241 | player: player, 242 | viewSize: viewSize, 243 | texturePos: texturePos, 244 | pageContent: context, 245 | // 标题 当前页面顶部的标题部分 246 | playerTitle: "标题", 247 | // 当前视频改变钩子 248 | onChangeVideo: onChangeVideo, 249 | // 当前视频源tabIndex 250 | curTabIdx: _curTabIdx, 251 | // 当前视频源activeIndex 252 | curActiveIdx: _curActiveIdx, 253 | // 显示的配置 254 | showConfig: vCfg, 255 | // json格式化后的视频数据 256 | videoFormat: _videoSourceTabs, 257 | ); 258 | }, 259 | ), 260 | Container( 261 | height: 300, 262 | child: buildPlayDrawer(), 263 | ), 264 | Container( 265 | child: Text( 266 | '当前tabIdx : ${_curTabIdx.toString()} 当前activeIdx : ${_curActiveIdx.toString()}'), 267 | ) 268 | ], 269 | ); 270 | } 271 | } 272 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # 具体例子 2 | 3 | ## 完整例子(剧集,播放速度,锁) 4 | 5 | ```dart 6 | 7 | import 'package:flutter/material.dart'; 8 | import 'package:fijkplayer/fijkplayer.dart'; 9 | import 'package:fijkplayer_skin/fijkplayer_skin.dart'; 10 | import 'package:fijkplayer_skin/schema.dart' show VideoSourceFormat; 11 | 12 | class Demo1 extends StatefulWidget { 13 | @override 14 | Demo1State createState() => Demo1State(); 15 | } 16 | 17 | class Demo1State extends State { 18 | @override 19 | Widget build(BuildContext context) { 20 | // return VideoDetailPage(); 21 | return Scaffold( 22 | body: SingleChildScrollView( 23 | scrollDirection: Axis.vertical, 24 | child: Column( 25 | children: [ 26 | VideoDetailPage(), 27 | ], 28 | ), 29 | ), 30 | ); 31 | } 32 | } 33 | 34 | // 定制UI配置项 35 | class PlayerShowConfig implements ShowConfigAbs { 36 | @override 37 | bool drawerBtn = true; 38 | @override 39 | bool nextBtn = true; 40 | @override 41 | bool speedBtn = true; 42 | @override 43 | bool topBar = true; 44 | @override 45 | bool lockBtn = true; 46 | @override 47 | bool autoNext = true; 48 | @override 49 | bool bottomPro = true; 50 | @override 51 | bool stateAuto = true; 52 | @override 53 | bool isAutoPlay = false; 54 | } 55 | 56 | class VideoDetailPage extends StatefulWidget { 57 | @override 58 | _VideoDetailPageState createState() => _VideoDetailPageState(); 59 | } 60 | 61 | class _VideoDetailPageState extends State 62 | with TickerProviderStateMixin { 63 | final FijkPlayer player = FijkPlayer(); 64 | Map>> videoList = { 65 | "video": [ 66 | { 67 | "name": "天空资源", 68 | "list": [ 69 | { 70 | "url": "https://n1.szjal.cn/20210428/lsNZ6QAL/index.m3u8", 71 | "name": "综艺" 72 | }, 73 | { 74 | "url": "https://static.smartisanos.cn/common/video/t1-ui.mp4", 75 | "name": "锤子1" 76 | }, 77 | { 78 | "url": "https://static.smartisanos.cn/common/video/video-jgpro.mp4", 79 | "name": "锤子2" 80 | } 81 | ] 82 | }, 83 | { 84 | "name": "天空资源", 85 | "list": [ 86 | { 87 | "url": "https://n1.szjal.cn/20210428/lsNZ6QAL/index.m3u8", 88 | "name": "综艺" 89 | }, 90 | { 91 | "url": "https://static.smartisanos.cn/common/video/t1-ui.mp4", 92 | "name": "锤子1" 93 | }, 94 | { 95 | "url": "https://static.smartisanos.cn/common/video/video-jgpro.mp4", 96 | "name": "锤子2" 97 | } 98 | ] 99 | }, 100 | ] 101 | }; 102 | 103 | VideoSourceFormat? _videoSourceTabs; 104 | late TabController _tabController; 105 | 106 | int _curTabIdx = 0; 107 | int _curActiveIdx = 0; 108 | 109 | ShowConfigAbs vCfg = PlayerShowConfig(); 110 | 111 | @override 112 | void dispose() { 113 | player.dispose(); 114 | _tabController.dispose(); 115 | super.dispose(); 116 | } 117 | 118 | // 钩子函数,用于更新状态 119 | void onChangeVideo(int curTabIdx, int curActiveIdx) { 120 | this.setState(() { 121 | _curTabIdx = curTabIdx; 122 | _curActiveIdx = curActiveIdx; 123 | }); 124 | } 125 | 126 | @override 127 | void initState() { 128 | super.initState(); 129 | // 格式化json转对象 130 | _videoSourceTabs = VideoSourceFormat.fromJson(videoList); 131 | // tabbar初始化 132 | _tabController = TabController( 133 | length: _videoSourceTabs!.video!.length, 134 | vsync: this, 135 | ); 136 | // 这句不能省,必须有 137 | speed = 1.0; 138 | } 139 | 140 | // build 剧集 141 | Widget buildPlayDrawer() { 142 | return Scaffold( 143 | appBar: PreferredSize( 144 | preferredSize: Size.fromHeight(24), 145 | child: AppBar( 146 | backgroundColor: Colors.black, 147 | automaticallyImplyLeading: false, 148 | primary: false, 149 | elevation: 0, 150 | title: TabBar( 151 | tabs: _videoSourceTabs!.video! 152 | .map((e) => Tab(text: e!.name!)) 153 | .toList(), 154 | isScrollable: true, 155 | controller: _tabController, 156 | ), 157 | ), 158 | ), 159 | body: Container( 160 | color: Colors.black87, 161 | child: TabBarView( 162 | controller: _tabController, 163 | children: createTabConList(), 164 | ), 165 | ), 166 | ); 167 | } 168 | 169 | // 剧集 tabCon 170 | List createTabConList() { 171 | List list = []; 172 | _videoSourceTabs!.video!.asMap().keys.forEach((int tabIdx) { 173 | List playListBtns = _videoSourceTabs!.video![tabIdx]!.list! 174 | .asMap() 175 | .keys 176 | .map((int activeIdx) { 177 | return Padding( 178 | padding: EdgeInsets.only(left: 5, right: 5), 179 | child: ElevatedButton( 180 | style: ButtonStyle( 181 | shape: MaterialStateProperty.all( 182 | RoundedRectangleBorder( 183 | borderRadius: BorderRadius.circular(5), 184 | ), 185 | ), 186 | elevation: MaterialStateProperty.all(0), 187 | backgroundColor: MaterialStateProperty.all( 188 | tabIdx == _curTabIdx && activeIdx == _curActiveIdx 189 | ? Colors.red 190 | : Colors.blue), 191 | ), 192 | onPressed: () async { 193 | setState(() { 194 | _curTabIdx = tabIdx; 195 | _curActiveIdx = activeIdx; 196 | }); 197 | String nextVideoUrl = 198 | _videoSourceTabs!.video![tabIdx]!.list![activeIdx]!.url!; 199 | // 切换播放源 200 | // 如果不是自动开始播放,那么先执行stop 201 | if (player.value.state == FijkState.completed) { 202 | await player.stop(); 203 | } 204 | await player.reset().then((_) async { 205 | player.setDataSource(nextVideoUrl, autoPlay: true); 206 | }); 207 | }, 208 | child: Text( 209 | _videoSourceTabs!.video![tabIdx]!.list![activeIdx]!.name!, 210 | style: TextStyle( 211 | color: Colors.white, 212 | ), 213 | ), 214 | ), 215 | ); 216 | }).toList(); 217 | // 218 | list.add( 219 | SingleChildScrollView( 220 | child: Padding( 221 | padding: EdgeInsets.only(left: 5, right: 5), 222 | child: Wrap( 223 | direction: Axis.horizontal, 224 | children: playListBtns, 225 | ), 226 | ), 227 | ), 228 | ); 229 | }); 230 | return list; 231 | } 232 | 233 | @override 234 | Widget build(BuildContext context) { 235 | return Column( 236 | children: [ 237 | FijkView( 238 | height: 260, 239 | color: Colors.black, 240 | fit: FijkFit.cover, 241 | player: player, 242 | panelBuilder: ( 243 | FijkPlayer player, 244 | FijkData data, 245 | BuildContext context, 246 | Size viewSize, 247 | Rect texturePos, 248 | ) { 249 | /// 使用自定义的布局 250 | return CustomFijkPanel( 251 | player: player, 252 | viewSize: viewSize, 253 | texturePos: texturePos, 254 | pageContent: context, 255 | // 标题 当前页面顶部的标题部分 256 | playerTitle: "标题", 257 | // 当前视频改变钩子 258 | onChangeVideo: onChangeVideo, 259 | // 当前视频源tabIndex 260 | curTabIdx: _curTabIdx, 261 | // 当前视频源activeIndex 262 | curActiveIdx: _curActiveIdx, 263 | // 显示的配置 264 | showConfig: vCfg, 265 | // json格式化后的视频数据 266 | videoFormat: _videoSourceTabs, 267 | ); 268 | }, 269 | ), 270 | Container( 271 | height: 300, 272 | child: buildPlayDrawer(), 273 | ), 274 | Container( 275 | child: Text( 276 | '当前tabIdx : ${_curTabIdx.toString()} 当前activeIdx : ${_curActiveIdx.toString()}'), 277 | ) 278 | ], 279 | ); 280 | } 281 | } 282 | 283 | ``` 284 | 285 | ## 精简模式 286 | 287 | ```dart 288 | 289 | import 'package:flutter/material.dart'; 290 | import 'package:fijkplayer/fijkplayer.dart'; 291 | import 'package:fijkplayer_skin/fijkplayer_skin.dart'; 292 | import 'package:fijkplayer_skin/schema.dart' show VideoSourceFormat; 293 | 294 | class Demo2 extends StatefulWidget { 295 | @override 296 | Demo2State createState() => Demo2State(); 297 | } 298 | 299 | class Demo2State extends State { 300 | @override 301 | Widget build(BuildContext context) { 302 | // return VideoDetailPage(); 303 | return Scaffold( 304 | body: SingleChildScrollView( 305 | scrollDirection: Axis.vertical, 306 | child: Column( 307 | children: [ 308 | VideoDetailPage(), 309 | ], 310 | ), 311 | ), 312 | ); 313 | } 314 | } 315 | 316 | // 定制UI配置项 317 | class PlayerShowConfig implements ShowConfigAbs { 318 | @override 319 | bool drawerBtn = false; 320 | @override 321 | bool nextBtn = false; 322 | @override 323 | bool speedBtn = true; 324 | @override 325 | bool topBar = true; 326 | @override 327 | bool lockBtn = true; 328 | @override 329 | bool autoNext = false; 330 | @override 331 | bool bottomPro = true; 332 | @override 333 | bool stateAuto = true; 334 | @override 335 | bool isAutoPlay = true; 336 | } 337 | 338 | class VideoDetailPage extends StatefulWidget { 339 | @override 340 | _VideoDetailPageState createState() => _VideoDetailPageState(); 341 | } 342 | 343 | class _VideoDetailPageState extends State 344 | with TickerProviderStateMixin { 345 | final FijkPlayer player = FijkPlayer(); 346 | Map>> videoList = { 347 | "video": [ 348 | { 349 | "name": "天空资源", 350 | "list": [ 351 | { 352 | "url": "https://n1.szjal.cn/20210428/lsNZ6QAL/index.m3u8", 353 | "name": "综艺" 354 | }, 355 | ] 356 | }, 357 | ] 358 | }; 359 | 360 | VideoSourceFormat? _videoSourceTabs; 361 | 362 | int _curTabIdx = 0; 363 | int _curActiveIdx = 0; 364 | 365 | ShowConfigAbs vCfg = PlayerShowConfig(); 366 | 367 | @override 368 | void dispose() { 369 | player.dispose(); 370 | super.dispose(); 371 | } 372 | 373 | @override 374 | void initState() { 375 | super.initState(); 376 | // 格式化json转对象 377 | _videoSourceTabs = VideoSourceFormat.fromJson(videoList); 378 | // 这句不能省,必须有 379 | speed = 1.0; 380 | } 381 | 382 | @override 383 | Widget build(BuildContext context) { 384 | return Column( 385 | children: [ 386 | FijkView( 387 | height: 260, 388 | color: Colors.black, 389 | fit: FijkFit.cover, 390 | player: player, 391 | panelBuilder: ( 392 | FijkPlayer player, 393 | FijkData data, 394 | BuildContext context, 395 | Size viewSize, 396 | Rect texturePos, 397 | ) { 398 | /// 使用自定义的布局 399 | /// 精简模式,可不传递onChangeVideo 400 | return CustomFijkPanel( 401 | player: player, 402 | viewSize: viewSize, 403 | texturePos: texturePos, 404 | pageContent: context, 405 | // 标题 当前页面顶部的标题部分 406 | playerTitle: "标题", 407 | // 当前视频源tabIndex 408 | curTabIdx: _curTabIdx, 409 | // 当前视频源activeIndex 410 | curActiveIdx: _curActiveIdx, 411 | // 显示的配置 412 | showConfig: vCfg, 413 | // json格式化后的视频数据 414 | videoFormat: _videoSourceTabs, 415 | ); 416 | }, 417 | ), 418 | ], 419 | ); 420 | } 421 | } 422 | 423 | ``` -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 13 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 14 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 15 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXCopyFilesBuildPhase section */ 19 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 20 | isa = PBXCopyFilesBuildPhase; 21 | buildActionMask = 2147483647; 22 | dstPath = ""; 23 | dstSubfolderSpec = 10; 24 | files = ( 25 | ); 26 | name = "Embed Frameworks"; 27 | runOnlyForDeploymentPostprocessing = 0; 28 | }; 29 | /* End PBXCopyFilesBuildPhase section */ 30 | 31 | /* Begin PBXFileReference section */ 32 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 33 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 34 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 35 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 36 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 37 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 38 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 39 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 40 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 42 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 43 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 44 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | /* End PBXFileReference section */ 46 | 47 | /* Begin PBXFrameworksBuildPhase section */ 48 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 49 | isa = PBXFrameworksBuildPhase; 50 | buildActionMask = 2147483647; 51 | files = ( 52 | ); 53 | runOnlyForDeploymentPostprocessing = 0; 54 | }; 55 | /* End PBXFrameworksBuildPhase section */ 56 | 57 | /* Begin PBXGroup section */ 58 | 9740EEB11CF90186004384FC /* Flutter */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 62 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 63 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 64 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 65 | ); 66 | name = Flutter; 67 | sourceTree = ""; 68 | }; 69 | 97C146E51CF9000F007C117D = { 70 | isa = PBXGroup; 71 | children = ( 72 | 9740EEB11CF90186004384FC /* Flutter */, 73 | 97C146F01CF9000F007C117D /* Runner */, 74 | 97C146EF1CF9000F007C117D /* Products */, 75 | ); 76 | sourceTree = ""; 77 | }; 78 | 97C146EF1CF9000F007C117D /* Products */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | 97C146EE1CF9000F007C117D /* Runner.app */, 82 | ); 83 | name = Products; 84 | sourceTree = ""; 85 | }; 86 | 97C146F01CF9000F007C117D /* Runner */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 90 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 91 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 92 | 97C147021CF9000F007C117D /* Info.plist */, 93 | 97C146F11CF9000F007C117D /* Supporting Files */, 94 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 95 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 96 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 97 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 98 | ); 99 | path = Runner; 100 | sourceTree = ""; 101 | }; 102 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | ); 106 | name = "Supporting Files"; 107 | sourceTree = ""; 108 | }; 109 | /* End PBXGroup section */ 110 | 111 | /* Begin PBXNativeTarget section */ 112 | 97C146ED1CF9000F007C117D /* Runner */ = { 113 | isa = PBXNativeTarget; 114 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 115 | buildPhases = ( 116 | 9740EEB61CF901F6004384FC /* Run Script */, 117 | 97C146EA1CF9000F007C117D /* Sources */, 118 | 97C146EB1CF9000F007C117D /* Frameworks */, 119 | 97C146EC1CF9000F007C117D /* Resources */, 120 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 121 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 122 | ); 123 | buildRules = ( 124 | ); 125 | dependencies = ( 126 | ); 127 | name = Runner; 128 | productName = Runner; 129 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 130 | productType = "com.apple.product-type.application"; 131 | }; 132 | /* End PBXNativeTarget section */ 133 | 134 | /* Begin PBXProject section */ 135 | 97C146E61CF9000F007C117D /* Project object */ = { 136 | isa = PBXProject; 137 | attributes = { 138 | LastUpgradeCheck = 1020; 139 | ORGANIZATIONNAME = ""; 140 | TargetAttributes = { 141 | 97C146ED1CF9000F007C117D = { 142 | CreatedOnToolsVersion = 7.3.1; 143 | LastSwiftMigration = 1100; 144 | }; 145 | }; 146 | }; 147 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 148 | compatibilityVersion = "Xcode 9.3"; 149 | developmentRegion = en; 150 | hasScannedForEncodings = 0; 151 | knownRegions = ( 152 | en, 153 | Base, 154 | ); 155 | mainGroup = 97C146E51CF9000F007C117D; 156 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 157 | projectDirPath = ""; 158 | projectRoot = ""; 159 | targets = ( 160 | 97C146ED1CF9000F007C117D /* Runner */, 161 | ); 162 | }; 163 | /* End PBXProject section */ 164 | 165 | /* Begin PBXResourcesBuildPhase section */ 166 | 97C146EC1CF9000F007C117D /* Resources */ = { 167 | isa = PBXResourcesBuildPhase; 168 | buildActionMask = 2147483647; 169 | files = ( 170 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 171 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 172 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 173 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 174 | ); 175 | runOnlyForDeploymentPostprocessing = 0; 176 | }; 177 | /* End PBXResourcesBuildPhase section */ 178 | 179 | /* Begin PBXShellScriptBuildPhase section */ 180 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 181 | isa = PBXShellScriptBuildPhase; 182 | buildActionMask = 2147483647; 183 | files = ( 184 | ); 185 | inputPaths = ( 186 | ); 187 | name = "Thin Binary"; 188 | outputPaths = ( 189 | ); 190 | runOnlyForDeploymentPostprocessing = 0; 191 | shellPath = /bin/sh; 192 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; 193 | }; 194 | 9740EEB61CF901F6004384FC /* Run Script */ = { 195 | isa = PBXShellScriptBuildPhase; 196 | buildActionMask = 2147483647; 197 | files = ( 198 | ); 199 | inputPaths = ( 200 | ); 201 | name = "Run Script"; 202 | outputPaths = ( 203 | ); 204 | runOnlyForDeploymentPostprocessing = 0; 205 | shellPath = /bin/sh; 206 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 207 | }; 208 | /* End PBXShellScriptBuildPhase section */ 209 | 210 | /* Begin PBXSourcesBuildPhase section */ 211 | 97C146EA1CF9000F007C117D /* Sources */ = { 212 | isa = PBXSourcesBuildPhase; 213 | buildActionMask = 2147483647; 214 | files = ( 215 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 216 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 217 | ); 218 | runOnlyForDeploymentPostprocessing = 0; 219 | }; 220 | /* End PBXSourcesBuildPhase section */ 221 | 222 | /* Begin PBXVariantGroup section */ 223 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 224 | isa = PBXVariantGroup; 225 | children = ( 226 | 97C146FB1CF9000F007C117D /* Base */, 227 | ); 228 | name = Main.storyboard; 229 | sourceTree = ""; 230 | }; 231 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 232 | isa = PBXVariantGroup; 233 | children = ( 234 | 97C147001CF9000F007C117D /* Base */, 235 | ); 236 | name = LaunchScreen.storyboard; 237 | sourceTree = ""; 238 | }; 239 | /* End PBXVariantGroup section */ 240 | 241 | /* Begin XCBuildConfiguration section */ 242 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 243 | isa = XCBuildConfiguration; 244 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 245 | buildSettings = { 246 | ALWAYS_SEARCH_USER_PATHS = NO; 247 | CLANG_ANALYZER_NONNULL = YES; 248 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 249 | CLANG_CXX_LIBRARY = "libc++"; 250 | CLANG_ENABLE_MODULES = YES; 251 | CLANG_ENABLE_OBJC_ARC = YES; 252 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 253 | CLANG_WARN_BOOL_CONVERSION = YES; 254 | CLANG_WARN_COMMA = YES; 255 | CLANG_WARN_CONSTANT_CONVERSION = YES; 256 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 257 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 258 | CLANG_WARN_EMPTY_BODY = YES; 259 | CLANG_WARN_ENUM_CONVERSION = YES; 260 | CLANG_WARN_INFINITE_RECURSION = YES; 261 | CLANG_WARN_INT_CONVERSION = YES; 262 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 263 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 264 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 265 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 266 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 267 | CLANG_WARN_STRICT_PROTOTYPES = YES; 268 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 269 | CLANG_WARN_UNREACHABLE_CODE = YES; 270 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 271 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 272 | COPY_PHASE_STRIP = NO; 273 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 274 | ENABLE_NS_ASSERTIONS = NO; 275 | ENABLE_STRICT_OBJC_MSGSEND = YES; 276 | GCC_C_LANGUAGE_STANDARD = gnu99; 277 | GCC_NO_COMMON_BLOCKS = YES; 278 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 279 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 280 | GCC_WARN_UNDECLARED_SELECTOR = YES; 281 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 282 | GCC_WARN_UNUSED_FUNCTION = YES; 283 | GCC_WARN_UNUSED_VARIABLE = YES; 284 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 285 | MTL_ENABLE_DEBUG_INFO = NO; 286 | SDKROOT = iphoneos; 287 | SUPPORTED_PLATFORMS = iphoneos; 288 | TARGETED_DEVICE_FAMILY = "1,2"; 289 | VALIDATE_PRODUCT = YES; 290 | }; 291 | name = Profile; 292 | }; 293 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 294 | isa = XCBuildConfiguration; 295 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 296 | buildSettings = { 297 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 298 | CLANG_ENABLE_MODULES = YES; 299 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 300 | ENABLE_BITCODE = NO; 301 | FRAMEWORK_SEARCH_PATHS = ( 302 | "$(inherited)", 303 | "$(PROJECT_DIR)/Flutter", 304 | ); 305 | INFOPLIST_FILE = Runner/Info.plist; 306 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 307 | LIBRARY_SEARCH_PATHS = ( 308 | "$(inherited)", 309 | "$(PROJECT_DIR)/Flutter", 310 | ); 311 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example; 312 | PRODUCT_NAME = "$(TARGET_NAME)"; 313 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 314 | SWIFT_VERSION = 5.0; 315 | VERSIONING_SYSTEM = "apple-generic"; 316 | }; 317 | name = Profile; 318 | }; 319 | 97C147031CF9000F007C117D /* Debug */ = { 320 | isa = XCBuildConfiguration; 321 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 322 | buildSettings = { 323 | ALWAYS_SEARCH_USER_PATHS = NO; 324 | CLANG_ANALYZER_NONNULL = YES; 325 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 326 | CLANG_CXX_LIBRARY = "libc++"; 327 | CLANG_ENABLE_MODULES = YES; 328 | CLANG_ENABLE_OBJC_ARC = YES; 329 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 330 | CLANG_WARN_BOOL_CONVERSION = YES; 331 | CLANG_WARN_COMMA = YES; 332 | CLANG_WARN_CONSTANT_CONVERSION = YES; 333 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 334 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 335 | CLANG_WARN_EMPTY_BODY = YES; 336 | CLANG_WARN_ENUM_CONVERSION = YES; 337 | CLANG_WARN_INFINITE_RECURSION = YES; 338 | CLANG_WARN_INT_CONVERSION = YES; 339 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 340 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 341 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 342 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 343 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 344 | CLANG_WARN_STRICT_PROTOTYPES = YES; 345 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 346 | CLANG_WARN_UNREACHABLE_CODE = YES; 347 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 348 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 349 | COPY_PHASE_STRIP = NO; 350 | DEBUG_INFORMATION_FORMAT = dwarf; 351 | ENABLE_STRICT_OBJC_MSGSEND = YES; 352 | ENABLE_TESTABILITY = YES; 353 | GCC_C_LANGUAGE_STANDARD = gnu99; 354 | GCC_DYNAMIC_NO_PIC = NO; 355 | GCC_NO_COMMON_BLOCKS = YES; 356 | GCC_OPTIMIZATION_LEVEL = 0; 357 | GCC_PREPROCESSOR_DEFINITIONS = ( 358 | "DEBUG=1", 359 | "$(inherited)", 360 | ); 361 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 362 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 363 | GCC_WARN_UNDECLARED_SELECTOR = YES; 364 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 365 | GCC_WARN_UNUSED_FUNCTION = YES; 366 | GCC_WARN_UNUSED_VARIABLE = YES; 367 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 368 | MTL_ENABLE_DEBUG_INFO = YES; 369 | ONLY_ACTIVE_ARCH = YES; 370 | SDKROOT = iphoneos; 371 | TARGETED_DEVICE_FAMILY = "1,2"; 372 | }; 373 | name = Debug; 374 | }; 375 | 97C147041CF9000F007C117D /* Release */ = { 376 | isa = XCBuildConfiguration; 377 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 378 | buildSettings = { 379 | ALWAYS_SEARCH_USER_PATHS = NO; 380 | CLANG_ANALYZER_NONNULL = YES; 381 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 382 | CLANG_CXX_LIBRARY = "libc++"; 383 | CLANG_ENABLE_MODULES = YES; 384 | CLANG_ENABLE_OBJC_ARC = YES; 385 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 386 | CLANG_WARN_BOOL_CONVERSION = YES; 387 | CLANG_WARN_COMMA = YES; 388 | CLANG_WARN_CONSTANT_CONVERSION = YES; 389 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 390 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 391 | CLANG_WARN_EMPTY_BODY = YES; 392 | CLANG_WARN_ENUM_CONVERSION = YES; 393 | CLANG_WARN_INFINITE_RECURSION = YES; 394 | CLANG_WARN_INT_CONVERSION = YES; 395 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 396 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 397 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 398 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 399 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 400 | CLANG_WARN_STRICT_PROTOTYPES = YES; 401 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 402 | CLANG_WARN_UNREACHABLE_CODE = YES; 403 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 404 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 405 | COPY_PHASE_STRIP = NO; 406 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 407 | ENABLE_NS_ASSERTIONS = NO; 408 | ENABLE_STRICT_OBJC_MSGSEND = YES; 409 | GCC_C_LANGUAGE_STANDARD = gnu99; 410 | GCC_NO_COMMON_BLOCKS = YES; 411 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 412 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 413 | GCC_WARN_UNDECLARED_SELECTOR = YES; 414 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 415 | GCC_WARN_UNUSED_FUNCTION = YES; 416 | GCC_WARN_UNUSED_VARIABLE = YES; 417 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 418 | MTL_ENABLE_DEBUG_INFO = NO; 419 | SDKROOT = iphoneos; 420 | SUPPORTED_PLATFORMS = iphoneos; 421 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 422 | TARGETED_DEVICE_FAMILY = "1,2"; 423 | VALIDATE_PRODUCT = YES; 424 | }; 425 | name = Release; 426 | }; 427 | 97C147061CF9000F007C117D /* Debug */ = { 428 | isa = XCBuildConfiguration; 429 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 430 | buildSettings = { 431 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 432 | CLANG_ENABLE_MODULES = YES; 433 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 434 | ENABLE_BITCODE = NO; 435 | FRAMEWORK_SEARCH_PATHS = ( 436 | "$(inherited)", 437 | "$(PROJECT_DIR)/Flutter", 438 | ); 439 | INFOPLIST_FILE = Runner/Info.plist; 440 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 441 | LIBRARY_SEARCH_PATHS = ( 442 | "$(inherited)", 443 | "$(PROJECT_DIR)/Flutter", 444 | ); 445 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example; 446 | PRODUCT_NAME = "$(TARGET_NAME)"; 447 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 448 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 449 | SWIFT_VERSION = 5.0; 450 | VERSIONING_SYSTEM = "apple-generic"; 451 | }; 452 | name = Debug; 453 | }; 454 | 97C147071CF9000F007C117D /* Release */ = { 455 | isa = XCBuildConfiguration; 456 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 457 | buildSettings = { 458 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 459 | CLANG_ENABLE_MODULES = YES; 460 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 461 | ENABLE_BITCODE = NO; 462 | FRAMEWORK_SEARCH_PATHS = ( 463 | "$(inherited)", 464 | "$(PROJECT_DIR)/Flutter", 465 | ); 466 | INFOPLIST_FILE = Runner/Info.plist; 467 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 468 | LIBRARY_SEARCH_PATHS = ( 469 | "$(inherited)", 470 | "$(PROJECT_DIR)/Flutter", 471 | ); 472 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example; 473 | PRODUCT_NAME = "$(TARGET_NAME)"; 474 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 475 | SWIFT_VERSION = 5.0; 476 | VERSIONING_SYSTEM = "apple-generic"; 477 | }; 478 | name = Release; 479 | }; 480 | /* End XCBuildConfiguration section */ 481 | 482 | /* Begin XCConfigurationList section */ 483 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 484 | isa = XCConfigurationList; 485 | buildConfigurations = ( 486 | 97C147031CF9000F007C117D /* Debug */, 487 | 97C147041CF9000F007C117D /* Release */, 488 | 249021D3217E4FDB00AE95B9 /* Profile */, 489 | ); 490 | defaultConfigurationIsVisible = 0; 491 | defaultConfigurationName = Release; 492 | }; 493 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 494 | isa = XCConfigurationList; 495 | buildConfigurations = ( 496 | 97C147061CF9000F007C117D /* Debug */, 497 | 97C147071CF9000F007C117D /* Release */, 498 | 249021D4217E4FDB00AE95B9 /* Profile */, 499 | ); 500 | defaultConfigurationIsVisible = 0; 501 | defaultConfigurationName = Release; 502 | }; 503 | /* End XCConfigurationList section */ 504 | }; 505 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 506 | } 507 | -------------------------------------------------------------------------------- /lib/fijkplayer_skin.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: must_call_super, camel_case_types 2 | import 'dart:async'; 3 | import 'dart:math'; 4 | import 'dart:ui'; 5 | 6 | import 'package:fijkplayer/fijkplayer.dart'; 7 | import 'package:flutter/material.dart'; 8 | import 'package:wakelock/wakelock.dart'; 9 | 10 | import './schema.dart' show VideoSourceFormat; 11 | import './slider.dart' show NewFijkSliderColors, NewFijkSlider; 12 | 13 | double speed = 1.0; 14 | bool lockStuff = false; 15 | bool hideLockStuff = false; 16 | final double barHeight = 50.0; 17 | final double barFillingHeight = 18 | MediaQueryData.fromWindow(window).padding.top + barHeight; 19 | final double barGap = barFillingHeight - barHeight; 20 | 21 | abstract class ShowConfigAbs { 22 | late bool nextBtn; 23 | late bool speedBtn; 24 | late bool drawerBtn; 25 | late bool lockBtn; 26 | late bool topBar; 27 | late bool autoNext; 28 | late bool bottomPro; 29 | late bool stateAuto; 30 | late bool isAutoPlay; 31 | } 32 | 33 | class WithPlayerChangeSource {} 34 | 35 | String _duration2String(Duration duration) { 36 | if (duration.inMilliseconds < 0) return "-: negtive"; 37 | 38 | String twoDigits(int n) { 39 | if (n >= 10) return "$n"; 40 | return "0$n"; 41 | } 42 | 43 | String twoDigitMinutes = twoDigits(duration.inMinutes.remainder(60)); 44 | String twoDigitSeconds = twoDigits(duration.inSeconds.remainder(60)); 45 | int inHours = duration.inHours; 46 | return inHours > 0 47 | ? "$inHours:$twoDigitMinutes:$twoDigitSeconds" 48 | : "$twoDigitMinutes:$twoDigitSeconds"; 49 | } 50 | 51 | class CustomFijkPanel extends StatefulWidget { 52 | final FijkPlayer player; 53 | final Size viewSize; 54 | final Rect texturePos; 55 | final BuildContext? pageContent; 56 | final String playerTitle; 57 | final Function? onChangeVideo; 58 | final int curTabIdx; 59 | final int curActiveIdx; 60 | final ShowConfigAbs showConfig; 61 | final VideoSourceFormat? videoFormat; 62 | 63 | CustomFijkPanel({ 64 | required this.player, 65 | required this.viewSize, 66 | required this.texturePos, 67 | this.pageContent, 68 | this.playerTitle = "", 69 | required this.showConfig, 70 | this.onChangeVideo, 71 | required this.videoFormat, 72 | required this.curTabIdx, 73 | required this.curActiveIdx, 74 | }); 75 | 76 | @override 77 | _CustomFijkPanelState createState() => _CustomFijkPanelState(); 78 | } 79 | 80 | class _CustomFijkPanelState extends State 81 | with TickerProviderStateMixin, AutomaticKeepAliveClientMixin { 82 | FijkPlayer get player => widget.player; 83 | ShowConfigAbs get showConfig => widget.showConfig; 84 | VideoSourceFormat get _videoSourceTabs => widget.videoFormat!; 85 | 86 | bool _lockStuff = lockStuff; 87 | bool _hideLockStuff = hideLockStuff; 88 | bool _drawerState = false; 89 | Timer? _hideLockTimer; 90 | 91 | FijkState? _playerState; 92 | bool _isPlaying = false; 93 | 94 | StreamSubscription? _currentPosSubs; 95 | 96 | AnimationController? _animationController; 97 | Animation? _animation; 98 | late TabController _tabController; 99 | 100 | void initEvent() { 101 | _tabController = TabController( 102 | length: _videoSourceTabs.video!.length, 103 | vsync: this, 104 | ); 105 | _animationController = AnimationController( 106 | duration: const Duration(milliseconds: 280), 107 | vsync: this, 108 | ); 109 | // init animation 110 | _animation = Tween( 111 | begin: Offset(1, 0), 112 | end: Offset.zero, 113 | ).animate(_animationController!); 114 | // is not null 115 | if (_videoSourceTabs.video!.length < 1) return null; 116 | // init plater state 117 | setState(() { 118 | _playerState = player.value.state; 119 | }); 120 | if (player.value.duration.inMilliseconds > 0 && !_isPlaying) { 121 | setState(() { 122 | _isPlaying = true; 123 | }); 124 | } 125 | // is not null 126 | if (_videoSourceTabs.video!.length < 1) return null; 127 | // autoplay and existurl 128 | if (showConfig.isAutoPlay && !_isPlaying) { 129 | int curTabIdx = widget.curTabIdx; 130 | int curActiveIdx = widget.curActiveIdx; 131 | changeCurPlayVideo(curTabIdx, curActiveIdx); 132 | } 133 | player.addListener(_playerValueChanged); 134 | Wakelock.enable(); 135 | } 136 | 137 | @override 138 | void initState() { 139 | super.initState(); 140 | initEvent(); 141 | } 142 | 143 | @override 144 | void dispose() { 145 | _currentPosSubs?.cancel(); 146 | _hideLockTimer?.cancel(); 147 | player.removeListener(_playerValueChanged); 148 | _tabController.dispose(); 149 | _animationController!.dispose(); 150 | Wakelock.disable(); 151 | super.dispose(); 152 | } 153 | 154 | // 获得播放器状态 155 | void _playerValueChanged() { 156 | if (player.value.duration.inMilliseconds > 0 && !_isPlaying) { 157 | setState(() { 158 | _isPlaying = true; 159 | }); 160 | } 161 | setState(() { 162 | _playerState = player.value.state; 163 | }); 164 | } 165 | 166 | // 切换UI 播放列表显示状态 167 | void changeDrawerState(bool state) { 168 | if (state) { 169 | setState(() { 170 | _drawerState = state; 171 | }); 172 | } 173 | Future.delayed(Duration(milliseconds: 100), () { 174 | _animationController!.forward(); 175 | }); 176 | } 177 | 178 | // 切换UI lock显示状态 179 | void changeLockState(bool state) { 180 | setState(() { 181 | _lockStuff = state; 182 | if (state == true) { 183 | _hideLockStuff = true; 184 | _cancelAndRestartLockTimer(); 185 | } 186 | }); 187 | } 188 | 189 | // 切换播放源 190 | Future changeCurPlayVideo(int tabIdx, int activeIdx) async { 191 | // await player.stop(); 192 | await player.reset().then((_) { 193 | String curTabActiveUrl = 194 | _videoSourceTabs.video![tabIdx]!.list![activeIdx]!.url!; 195 | player.setDataSource( 196 | curTabActiveUrl, 197 | autoPlay: true, 198 | ); 199 | // 回调 200 | widget.onChangeVideo!(tabIdx, activeIdx); 201 | }); 202 | } 203 | 204 | void _cancelAndRestartLockTimer() { 205 | if (_hideLockStuff == true) { 206 | _startHideLockTimer(); 207 | } 208 | setState(() { 209 | _hideLockStuff = !_hideLockStuff; 210 | }); 211 | } 212 | 213 | void _startHideLockTimer() { 214 | _hideLockTimer?.cancel(); 215 | _hideLockTimer = Timer(const Duration(seconds: 5), () { 216 | setState(() { 217 | _hideLockStuff = true; 218 | }); 219 | }); 220 | } 221 | 222 | // 锁 组件 223 | Widget _buidLockStateDetctor() { 224 | return GestureDetector( 225 | behavior: HitTestBehavior.opaque, 226 | onTap: _cancelAndRestartLockTimer, 227 | child: Container( 228 | child: AnimatedOpacity( 229 | opacity: _hideLockStuff ? 0.0 : 0.7, 230 | duration: Duration(milliseconds: 400), 231 | child: Align( 232 | alignment: Alignment.centerLeft, 233 | child: Padding( 234 | padding: EdgeInsets.only( 235 | left: 20, 236 | top: showConfig.stateAuto && !player.value.fullScreen 237 | ? barGap 238 | : 0, 239 | ), 240 | child: IconButton( 241 | iconSize: 30, 242 | onPressed: () { 243 | setState(() { 244 | _lockStuff = false; 245 | _hideLockStuff = true; 246 | }); 247 | }, 248 | icon: Icon(Icons.lock_open), 249 | color: Colors.white, 250 | ), 251 | ), 252 | ), 253 | ), 254 | ), 255 | ); 256 | } 257 | 258 | // 返回按钮 259 | Widget _buildTopBackBtn() { 260 | return Container( 261 | height: barHeight, 262 | alignment: Alignment.centerLeft, 263 | child: IconButton( 264 | icon: Icon(Icons.arrow_back), 265 | padding: EdgeInsets.only( 266 | left: 10.0, 267 | right: 10.0, 268 | ), 269 | splashColor: Colors.transparent, 270 | highlightColor: Colors.transparent, 271 | color: Colors.white, 272 | onPressed: () { 273 | // 判断当前是否全屏,如果全屏,退出 274 | if (widget.player.value.fullScreen) { 275 | player.exitFullScreen(); 276 | } else { 277 | if (widget.pageContent == null) return null; 278 | player.stop(); 279 | Navigator.pop(widget.pageContent!); 280 | } 281 | }, 282 | ), 283 | ); 284 | } 285 | 286 | // 抽屉组件 - 播放列表 287 | Widget _buildPlayerListDrawer() { 288 | return Container( 289 | alignment: Alignment.centerRight, 290 | child: Row( 291 | children: [ 292 | Expanded( 293 | child: GestureDetector( 294 | onTap: () async { 295 | await _animationController!.reverse(); 296 | setState(() { 297 | _drawerState = false; 298 | }); 299 | }, 300 | ), 301 | ), 302 | Container( 303 | child: SlideTransition( 304 | position: _animation!, 305 | child: Container( 306 | height: window.physicalSize.height, 307 | width: 320, 308 | child: _buildPlayDrawer(), 309 | ), 310 | ), 311 | ), 312 | ], 313 | ), 314 | ); 315 | } 316 | 317 | // build 剧集 318 | Widget _buildPlayDrawer() { 319 | return Scaffold( 320 | backgroundColor: Color.fromRGBO(0, 0, 0, 0.4), 321 | appBar: AppBar( 322 | backgroundColor: Color.fromRGBO(0, 0, 0, 0.5), 323 | automaticallyImplyLeading: false, 324 | elevation: 0.1, 325 | title: TabBar( 326 | labelColor: Colors.white, 327 | labelStyle: TextStyle( 328 | color: Colors.white, 329 | fontSize: 14, 330 | ), 331 | unselectedLabelColor: Colors.white, 332 | unselectedLabelStyle: TextStyle( 333 | color: Colors.white, 334 | fontSize: 14, 335 | ), 336 | indicator: BoxDecoration( 337 | color: Colors.purple[700], 338 | borderRadius: BorderRadius.all(Radius.circular(10)), 339 | ), 340 | tabs: 341 | _videoSourceTabs.video!.map((e) => Tab(text: e!.name!)).toList(), 342 | isScrollable: true, 343 | controller: _tabController, 344 | ), 345 | ), 346 | body: Container( 347 | color: Color.fromRGBO(0, 0, 0, 0.5), 348 | child: TabBarView( 349 | controller: _tabController, 350 | children: _createTabConList(), 351 | ), 352 | ), 353 | ); 354 | } 355 | 356 | // 剧集 tabCon 357 | List _createTabConList() { 358 | List list = []; 359 | _videoSourceTabs.video!.asMap().keys.forEach((int tabIdx) { 360 | List playListBtns = _videoSourceTabs.video![tabIdx]!.list! 361 | .asMap() 362 | .keys 363 | .map((int activeIdx) { 364 | return Padding( 365 | padding: EdgeInsets.only(left: 5, right: 5), 366 | child: ElevatedButton( 367 | style: ButtonStyle( 368 | shape: MaterialStateProperty.all( 369 | RoundedRectangleBorder( 370 | borderRadius: BorderRadius.circular(8), 371 | ), 372 | ), 373 | elevation: MaterialStateProperty.all(0), 374 | backgroundColor: MaterialStateProperty.all( 375 | tabIdx == widget.curTabIdx && activeIdx == widget.curActiveIdx 376 | ? Colors.red 377 | : Colors.blue), 378 | ), 379 | onPressed: () { 380 | int newTabIdx = tabIdx; 381 | int newActiveIdx = activeIdx; 382 | // 切换播放源 383 | changeCurPlayVideo(newTabIdx, newActiveIdx); 384 | }, 385 | child: Text( 386 | _videoSourceTabs.video![tabIdx]!.list![activeIdx]!.name!, 387 | style: TextStyle( 388 | color: Colors.white, 389 | ), 390 | ), 391 | ), 392 | ); 393 | }).toList(); 394 | // 395 | list.add( 396 | SingleChildScrollView( 397 | child: Padding( 398 | padding: EdgeInsets.only(left: 5, right: 5), 399 | child: Wrap( 400 | direction: Axis.horizontal, 401 | children: playListBtns, 402 | ), 403 | ), 404 | ), 405 | ); 406 | }); 407 | return list; 408 | } 409 | 410 | // 可以共用的架子 411 | Widget _buildPublicFrameWidget({ 412 | required Widget slot, 413 | Color? bgColor, 414 | }) { 415 | return Container( 416 | color: bgColor, 417 | child: Stack( 418 | children: [ 419 | showConfig.topBar 420 | ? Positioned( 421 | left: 0, 422 | top: 0, 423 | right: 0, 424 | child: Container( 425 | height: 426 | showConfig.stateAuto && !widget.player.value.fullScreen 427 | ? barFillingHeight 428 | : barHeight, 429 | alignment: Alignment.bottomLeft, 430 | child: Container( 431 | height: barHeight, 432 | child: Row( 433 | mainAxisAlignment: MainAxisAlignment.start, 434 | children: [ 435 | _buildTopBackBtn(), 436 | Expanded( 437 | child: Container( 438 | child: Text( 439 | widget.playerTitle, 440 | overflow: TextOverflow.ellipsis, 441 | maxLines: 1, 442 | textAlign: TextAlign.left, 443 | style: TextStyle( 444 | color: Colors.white, 445 | ), 446 | ), 447 | ), 448 | ), 449 | ], 450 | ), 451 | ), 452 | ), 453 | ) 454 | : Container(), 455 | Positioned( 456 | left: 0, 457 | right: 0, 458 | bottom: 0, 459 | top: 0, 460 | child: Center( 461 | child: Padding( 462 | padding: EdgeInsets.only( 463 | top: showConfig.stateAuto && !widget.player.value.fullScreen 464 | ? barGap 465 | : 0), 466 | child: slot, 467 | ), 468 | ), 469 | ), 470 | ], 471 | ), 472 | ); 473 | } 474 | 475 | // 错误slot 476 | Widget _buildErrorStateSlotWidget() { 477 | return Center( 478 | child: Column( 479 | crossAxisAlignment: CrossAxisAlignment.center, 480 | mainAxisAlignment: MainAxisAlignment.center, 481 | children: [ 482 | SizedBox( 483 | height: showConfig.stateAuto && !widget.player.value.fullScreen 484 | ? barGap 485 | : 0, 486 | ), 487 | // 失败图标 488 | Icon( 489 | Icons.error, 490 | size: 50, 491 | color: Colors.white, 492 | ), 493 | // 错误信息 494 | Text( 495 | "播放失败,您可以点击重试!", 496 | style: TextStyle( 497 | color: Colors.white, 498 | fontSize: 15, 499 | fontWeight: FontWeight.bold, 500 | ), 501 | ), 502 | SizedBox(height: 5), 503 | // 重试 504 | ElevatedButton( 505 | style: ButtonStyle( 506 | shape: MaterialStateProperty.all( 507 | RoundedRectangleBorder( 508 | borderRadius: BorderRadius.circular(20), 509 | ), 510 | ), 511 | elevation: MaterialStateProperty.all(0), 512 | backgroundColor: MaterialStateProperty.all(Colors.white), 513 | ), 514 | onPressed: () { 515 | // 切换视频 516 | changeCurPlayVideo(widget.curTabIdx, widget.curActiveIdx); 517 | }, 518 | child: Text( 519 | "点击重试", 520 | style: TextStyle(color: Colors.black), 521 | ), 522 | ), 523 | ], 524 | ), 525 | ); 526 | } 527 | 528 | // 加载中slot 529 | Widget _buildLoadingStateSlotWidget() { 530 | return SizedBox( 531 | width: barHeight * 0.8, 532 | height: barHeight * 0.8, 533 | child: const CircularProgressIndicator( 534 | valueColor: AlwaysStoppedAnimation(Colors.white), 535 | ), 536 | ); 537 | } 538 | 539 | // 未开始slot 540 | Widget _buildIdleStateSlotWidget() { 541 | return IconButton( 542 | iconSize: barHeight * 1.2, 543 | icon: Icon(Icons.play_arrow, color: Colors.white), 544 | padding: EdgeInsets.only(left: 10.0, right: 10.0), 545 | onPressed: () async { 546 | int newTabIdx = widget.curTabIdx; 547 | int newActiveIdx = widget.curActiveIdx; 548 | await changeCurPlayVideo(newTabIdx, newActiveIdx); 549 | }, 550 | ); 551 | } 552 | 553 | @override 554 | Widget build(BuildContext context) { 555 | Rect rect = player.value.fullScreen 556 | ? Rect.fromLTWH( 557 | 0, 558 | 0, 559 | widget.viewSize.width, 560 | widget.viewSize.height, 561 | ) 562 | : Rect.fromLTRB( 563 | max(0.0, widget.texturePos.left), 564 | max(0.0, widget.texturePos.top), 565 | min(widget.viewSize.width, widget.texturePos.right), 566 | min(widget.viewSize.height, widget.texturePos.bottom), 567 | ); 568 | 569 | List ws = []; 570 | 571 | if (_playerState == FijkState.error) { 572 | ws.add( 573 | _buildPublicFrameWidget( 574 | slot: _buildErrorStateSlotWidget(), 575 | bgColor: Colors.black, 576 | ), 577 | ); 578 | } else if ((_playerState == FijkState.asyncPreparing || 579 | _playerState == FijkState.initialized) && 580 | !_isPlaying) { 581 | ws.add( 582 | _buildPublicFrameWidget( 583 | slot: _buildLoadingStateSlotWidget(), 584 | bgColor: Colors.black, 585 | ), 586 | ); 587 | } else if (_playerState == FijkState.idle && !_isPlaying) { 588 | ws.add( 589 | _buildPublicFrameWidget( 590 | slot: _buildIdleStateSlotWidget(), 591 | bgColor: Colors.black, 592 | ), 593 | ); 594 | } else { 595 | if (_lockStuff == true && 596 | showConfig.lockBtn && 597 | widget.player.value.fullScreen) { 598 | ws.add( 599 | _buidLockStateDetctor(), 600 | ); 601 | } else if (_drawerState == true && widget.player.value.fullScreen) { 602 | ws.add( 603 | _buildPlayerListDrawer(), 604 | ); 605 | } else { 606 | ws.add( 607 | _buildGestureDetector( 608 | curActiveIdx: widget.curActiveIdx, 609 | curTabIdx: widget.curTabIdx, 610 | onChangeVideo: widget.onChangeVideo, 611 | player: widget.player, 612 | texturePos: widget.texturePos, 613 | showConfig: widget.showConfig, 614 | pageContent: widget.pageContent, 615 | playerTitle: widget.playerTitle, 616 | viewSize: widget.viewSize, 617 | videoFormat: widget.videoFormat, 618 | changeDrawerState: changeDrawerState, 619 | changeLockState: changeLockState, 620 | ), 621 | ); 622 | } 623 | } 624 | 625 | return WillPopScope( 626 | child: Positioned.fromRect( 627 | rect: rect, 628 | child: Stack( 629 | children: ws, 630 | ), 631 | ), 632 | onWillPop: () async { 633 | if (!widget.player.value.fullScreen) widget.player.stop(); 634 | return true; 635 | }, 636 | ); 637 | } 638 | 639 | @override 640 | bool get wantKeepAlive => true; 641 | } 642 | 643 | class _buildGestureDetector extends StatefulWidget { 644 | final FijkPlayer player; 645 | final Size viewSize; 646 | final Rect texturePos; 647 | final BuildContext? pageContent; 648 | final String playerTitle; 649 | final Function? onChangeVideo; 650 | final int curTabIdx; 651 | final int curActiveIdx; 652 | final Function changeDrawerState; 653 | final Function changeLockState; 654 | final ShowConfigAbs showConfig; 655 | final VideoSourceFormat? videoFormat; 656 | _buildGestureDetector({ 657 | Key? key, 658 | required this.player, 659 | required this.viewSize, 660 | required this.texturePos, 661 | this.pageContent, 662 | this.playerTitle = "", 663 | required this.showConfig, 664 | this.onChangeVideo, 665 | required this.curTabIdx, 666 | required this.curActiveIdx, 667 | required this.videoFormat, 668 | required this.changeDrawerState, 669 | required this.changeLockState, 670 | }) : super(key: key); 671 | 672 | @override 673 | _buildGestureDetectorState createState() => _buildGestureDetectorState(); 674 | } 675 | 676 | class _buildGestureDetectorState extends State<_buildGestureDetector> { 677 | FijkPlayer get player => widget.player; 678 | ShowConfigAbs get showConfig => widget.showConfig; 679 | VideoSourceFormat get _videoSourceTabs => widget.videoFormat!; 680 | 681 | Duration _duration = Duration(); 682 | Duration _currentPos = Duration(); 683 | Duration _bufferPos = Duration(); 684 | 685 | // 滑动后值 686 | Duration _dargPos = Duration(); 687 | 688 | bool _isTouch = false; 689 | 690 | bool _playing = false; 691 | bool _prepared = false; 692 | String? _exception; 693 | 694 | double? updatePrevDx; 695 | double? updatePrevDy; 696 | int? updatePosX; 697 | 698 | bool? isDargVerLeft; 699 | 700 | double? updateDargVarVal; 701 | 702 | bool varTouchInitSuc = false; 703 | 704 | bool _buffering = false; 705 | 706 | double _seekPos = -1.0; 707 | 708 | StreamSubscription? _currentPosSubs; 709 | StreamSubscription? _bufferPosSubs; 710 | StreamSubscription? _bufferingSubs; 711 | 712 | Timer? _hideTimer; 713 | bool _hideStuff = true; 714 | 715 | bool _hideSpeedStu = true; 716 | double _speed = speed; 717 | 718 | bool _isHorizontalMove = false; 719 | 720 | Map speedList = { 721 | "2.0": 2.0, 722 | "1.8": 1.8, 723 | "1.5": 1.5, 724 | "1.2": 1.2, 725 | "1.0": 1.0, 726 | }; 727 | 728 | // 初始化构造函数 729 | _buildGestureDetectorState(); 730 | 731 | void initEvent() { 732 | // 设置初始化的值,全屏与半屏切换后,重设 733 | setState(() { 734 | _speed = speed; 735 | // 每次重绘的时候,判断是否已经开始播放 736 | _hideStuff = !_playing ? false : true; 737 | }); 738 | // 延时隐藏 739 | _startHideTimer(); 740 | } 741 | 742 | @override 743 | void dispose() { 744 | super.dispose(); 745 | _hideTimer?.cancel(); 746 | 747 | player.removeListener(_playerValueChanged); 748 | _currentPosSubs?.cancel(); 749 | _bufferPosSubs?.cancel(); 750 | _bufferingSubs?.cancel(); 751 | } 752 | 753 | @override 754 | void initState() { 755 | super.initState(); 756 | 757 | initEvent(); 758 | 759 | _duration = player.value.duration; 760 | _currentPos = player.currentPos; 761 | _bufferPos = player.bufferPos; 762 | _prepared = player.state.index >= FijkState.prepared.index; 763 | _playing = player.state == FijkState.started; 764 | _exception = player.value.exception.message; 765 | _buffering = player.isBuffering; 766 | 767 | player.addListener(_playerValueChanged); 768 | 769 | _currentPosSubs = player.onCurrentPosUpdate.listen((v) { 770 | setState(() { 771 | _currentPos = v; 772 | // 后加入,处理fijkplay reset后状态对不上的bug, 773 | _playing = true; 774 | _prepared = true; 775 | }); 776 | }); 777 | 778 | _bufferPosSubs = player.onBufferPosUpdate.listen((v) { 779 | setState(() { 780 | _bufferPos = v; 781 | }); 782 | }); 783 | 784 | _bufferingSubs = player.onBufferStateUpdate.listen((v) { 785 | setState(() { 786 | _buffering = v; 787 | }); 788 | }); 789 | } 790 | 791 | void _playerValueChanged() async { 792 | FijkValue value = player.value; 793 | if (value.duration != _duration) { 794 | setState(() { 795 | _duration = value.duration; 796 | }); 797 | } 798 | print('++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++'); 799 | print('++++++++ 是否开始播放 => ${value.state == FijkState.started} ++++++++'); 800 | print('+++++++++++++++++++ 播放器状态 => ${value.state} ++++++++++++++++++++'); 801 | print('++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++'); 802 | // 新状态 803 | bool playing = value.state == FijkState.started; 804 | bool prepared = value.prepared; 805 | String? exception = value.exception.message; 806 | // 状态不一致,修改 807 | if (playing != _playing || 808 | prepared != _prepared || 809 | exception != _exception) { 810 | setState(() { 811 | _playing = playing; 812 | _prepared = prepared; 813 | _exception = exception; 814 | }); 815 | } 816 | // 播放完成 817 | bool playend = (value.state == FijkState.completed); 818 | bool isOverFlow = widget.curActiveIdx + 1 >= 819 | _videoSourceTabs.video![widget.curTabIdx]!.list!.length; 820 | // 播放完成 && tablen没有溢出 && curActive没有溢出 821 | if (playend && !isOverFlow && showConfig.autoNext) { 822 | int newTabIdx = widget.curTabIdx; 823 | int newActiveIdx = widget.curActiveIdx + 1; 824 | widget.onChangeVideo!(newTabIdx, newActiveIdx); 825 | // 切换播放源 826 | changeCurPlayVideo(newTabIdx, newActiveIdx); 827 | } 828 | } 829 | 830 | _onHorizontalDragStart(detills) { 831 | setState(() { 832 | updatePrevDx = detills.globalPosition.dx; 833 | updatePosX = _currentPos.inMilliseconds; 834 | }); 835 | } 836 | 837 | _onHorizontalDragUpdate(detills) { 838 | double curDragDx = detills.globalPosition.dx; 839 | // 确定当前是前进或者后退 840 | int cdx = curDragDx.toInt(); 841 | int pdx = updatePrevDx!.toInt(); 842 | bool isBefore = cdx > pdx; 843 | 844 | // 计算手指滑动的比例 845 | int newInterval = pdx - cdx; 846 | double playerW = MediaQuery.of(context).size.width; 847 | int curIntervalAbs = newInterval.abs(); 848 | double movePropCheck = (curIntervalAbs / playerW) * 100; 849 | 850 | // 计算进度条的比例 851 | double durProgCheck = _duration.inMilliseconds.toDouble() / 100; 852 | int checkTransfrom = (movePropCheck * durProgCheck).toInt(); 853 | int dragRange = 854 | isBefore ? updatePosX! + checkTransfrom : updatePosX! - checkTransfrom; 855 | 856 | // 是否溢出 最大 857 | int lastSecond = _duration.inMilliseconds; 858 | if (dragRange >= _duration.inMilliseconds) { 859 | dragRange = lastSecond; 860 | } 861 | // 是否溢出 最小 862 | if (dragRange <= 0) { 863 | dragRange = 0; 864 | } 865 | // 866 | this.setState(() { 867 | _isHorizontalMove = true; 868 | _hideStuff = false; 869 | _isTouch = true; 870 | // 更新下上一次存的滑动位置 871 | updatePrevDx = curDragDx; 872 | // 更新时间 873 | updatePosX = dragRange.toInt(); 874 | _dargPos = Duration(milliseconds: updatePosX!.toInt()); 875 | }); 876 | } 877 | 878 | _onHorizontalDragEnd(detills) { 879 | player.seekTo(_dargPos.inMilliseconds); 880 | this.setState(() { 881 | _isHorizontalMove = false; 882 | _isTouch = false; 883 | _hideStuff = true; 884 | _currentPos = _dargPos; 885 | }); 886 | } 887 | 888 | _onVerticalDragStart(detills) async { 889 | double clientW = widget.viewSize.width; 890 | double curTouchPosX = detills.globalPosition.dx; 891 | 892 | setState(() { 893 | // 更新位置 894 | updatePrevDy = detills.globalPosition.dy; 895 | // 是否左边 896 | isDargVerLeft = (curTouchPosX > (clientW / 2)) ? false : true; 897 | }); 898 | // 大于 右边 音量 , 小于 左边 亮度 899 | if (!isDargVerLeft!) { 900 | // 音量 901 | await FijkVolume.getVol().then((double v) { 902 | varTouchInitSuc = true; 903 | setState(() { 904 | updateDargVarVal = v; 905 | }); 906 | }); 907 | } else { 908 | // 亮度 909 | await FijkPlugin.screenBrightness().then((double v) { 910 | varTouchInitSuc = true; 911 | setState(() { 912 | updateDargVarVal = v; 913 | }); 914 | }); 915 | } 916 | } 917 | 918 | _onVerticalDragUpdate(detills) { 919 | if (!varTouchInitSuc) return null; 920 | double curDragDy = detills.globalPosition.dy; 921 | // 确定当前是前进或者后退 922 | int cdy = curDragDy.toInt(); 923 | int pdy = updatePrevDy!.toInt(); 924 | bool isBefore = cdy < pdy; 925 | // + -, 不满足, 上下滑动合法滑动值,> 3 926 | if (isBefore && pdy - cdy < 3 || !isBefore && cdy - pdy < 3) return null; 927 | // 区间 928 | double dragRange = 929 | isBefore ? updateDargVarVal! + 0.03 : updateDargVarVal! - 0.03; 930 | // 是否溢出 931 | if (dragRange > 1) { 932 | dragRange = 1.0; 933 | } 934 | if (dragRange < 0) { 935 | dragRange = 0.0; 936 | } 937 | setState(() { 938 | updatePrevDy = curDragDy; 939 | varTouchInitSuc = true; 940 | updateDargVarVal = dragRange; 941 | // 音量 942 | if (!isDargVerLeft!) { 943 | FijkVolume.setVol(dragRange); 944 | } else { 945 | FijkPlugin.setScreenBrightness(dragRange); 946 | } 947 | }); 948 | } 949 | 950 | _onVerticalDragEnd(detills) { 951 | setState(() { 952 | varTouchInitSuc = false; 953 | }); 954 | } 955 | 956 | // 切换播放源 957 | Future changeCurPlayVideo(int tabIdx, int activeIdx) async { 958 | // await player.seekTo(0); 959 | await player.stop(); 960 | setState(() { 961 | _buffering = false; 962 | }); 963 | player.reset().then((_) { 964 | _speed = speed = 1.0; 965 | String curTabActiveUrl = 966 | _videoSourceTabs.video![tabIdx]!.list![activeIdx]!.url!; 967 | player.setDataSource( 968 | curTabActiveUrl, 969 | autoPlay: true, 970 | ); 971 | // 回调 972 | widget.onChangeVideo!(tabIdx, activeIdx); 973 | }); 974 | } 975 | 976 | void _playOrPause() { 977 | if (_playing == true) { 978 | player.pause(); 979 | } else { 980 | player.start(); 981 | } 982 | } 983 | 984 | void _cancelAndRestartTimer() { 985 | if (_hideStuff == true) { 986 | _startHideTimer(); 987 | } 988 | 989 | setState(() { 990 | _hideStuff = !_hideStuff; 991 | if (_hideStuff == true) { 992 | _hideSpeedStu = true; 993 | } 994 | }); 995 | } 996 | 997 | void _startHideTimer() { 998 | _hideTimer?.cancel(); 999 | _hideTimer = Timer(const Duration(seconds: 5), () { 1000 | setState(() { 1001 | _hideStuff = true; 1002 | _hideSpeedStu = true; 1003 | }); 1004 | }); 1005 | } 1006 | 1007 | // 底部控制栏 - 播放按钮 1008 | Widget _buildPlayStateBtn(IconData iconData, Function cb) { 1009 | return Ink( 1010 | child: InkWell( 1011 | onTap: () => cb(), 1012 | child: Container( 1013 | height: 30, 1014 | child: Padding( 1015 | padding: EdgeInsets.only(left: 5, right: 5), 1016 | child: Icon( 1017 | iconData, 1018 | color: Colors.white, 1019 | ), 1020 | ), 1021 | ), 1022 | ), 1023 | ); 1024 | } 1025 | 1026 | // 控制器ui 底部 1027 | Widget _buildBottomBar(BuildContext context) { 1028 | // 计算进度时间 1029 | double duration = _duration.inMilliseconds.toDouble(); 1030 | double currentValue = _seekPos > 0 1031 | ? _seekPos 1032 | : (_isHorizontalMove 1033 | ? _dargPos.inMilliseconds.toDouble() 1034 | : _currentPos.inMilliseconds.toDouble()); 1035 | currentValue = min(currentValue, duration); 1036 | currentValue = max(currentValue, 0); 1037 | 1038 | // 计算底部吸底进度 1039 | double curConWidth = MediaQuery.of(context).size.width; 1040 | double curTimePro = (currentValue / duration) * 100; 1041 | double curBottomProW = (curConWidth / 100) * curTimePro; 1042 | 1043 | return Container( 1044 | height: barHeight, 1045 | child: Stack( 1046 | children: [ 1047 | // 底部UI控制器 1048 | Positioned( 1049 | left: 0, 1050 | right: 0, 1051 | bottom: 0, 1052 | child: AnimatedOpacity( 1053 | opacity: _hideStuff ? 0.0 : 0.8, 1054 | duration: Duration(milliseconds: 400), 1055 | child: Container( 1056 | height: barHeight, 1057 | decoration: BoxDecoration( 1058 | gradient: const LinearGradient( 1059 | begin: Alignment.topLeft, 1060 | end: Alignment.bottomLeft, 1061 | colors: [ 1062 | Color.fromRGBO(0, 0, 0, 0), 1063 | Color.fromRGBO(0, 0, 0, 0.4), 1064 | ], 1065 | ), 1066 | ), 1067 | child: Row( 1068 | children: [ 1069 | SizedBox(width: 7), 1070 | // 按钮 - 播放/暂停 1071 | _buildPlayStateBtn( 1072 | _playing ? Icons.pause : Icons.play_arrow, 1073 | _playOrPause, 1074 | ), 1075 | // 下一集 1076 | showConfig.nextBtn 1077 | ? _buildPlayStateBtn( 1078 | Icons.skip_next, 1079 | () { 1080 | bool isOverFlow = widget.curActiveIdx + 1 >= 1081 | _videoSourceTabs 1082 | .video![widget.curTabIdx]!.list!.length; 1083 | // 没有溢出的情况下 1084 | if (!isOverFlow) { 1085 | int newTabIdx = widget.curTabIdx; 1086 | int newActiveIdx = widget.curActiveIdx + 1; 1087 | // 切换播放源 1088 | changeCurPlayVideo(newTabIdx, newActiveIdx); 1089 | } 1090 | }, 1091 | ) 1092 | : Container(), 1093 | // 已播放时间 1094 | Padding( 1095 | padding: EdgeInsets.only(right: 5.0, left: 5), 1096 | child: Text( 1097 | '${_duration2String(_currentPos)}', 1098 | style: TextStyle( 1099 | fontSize: 14.0, 1100 | color: Colors.white, 1101 | ), 1102 | ), 1103 | ), 1104 | // 播放进度 if 没有开始播放 占满,空ui, else fijkSlider widget 1105 | _duration.inMilliseconds == 0 1106 | ? Expanded( 1107 | child: Padding( 1108 | padding: EdgeInsets.only(right: 5, left: 5), 1109 | child: NewFijkSlider( 1110 | colors: NewFijkSliderColors( 1111 | cursorColor: Colors.blue, 1112 | playedColor: Colors.blue, 1113 | ), 1114 | onChangeEnd: (double value) {}, 1115 | value: 0, 1116 | onChanged: (double value) {}, 1117 | ), 1118 | ), 1119 | ) 1120 | : Expanded( 1121 | child: Padding( 1122 | padding: EdgeInsets.only(right: 5, left: 5), 1123 | child: NewFijkSlider( 1124 | colors: NewFijkSliderColors( 1125 | cursorColor: Colors.blue, 1126 | playedColor: Colors.blue, 1127 | ), 1128 | value: currentValue, 1129 | cacheValue: 1130 | _bufferPos.inMilliseconds.toDouble(), 1131 | min: 0.0, 1132 | max: duration, 1133 | onChanged: (v) { 1134 | _startHideTimer(); 1135 | setState(() { 1136 | _seekPos = v; 1137 | }); 1138 | }, 1139 | onChangeEnd: (v) { 1140 | setState(() { 1141 | player.seekTo(v.toInt()); 1142 | print("seek to $v"); 1143 | _currentPos = Duration( 1144 | milliseconds: _seekPos.toInt()); 1145 | _seekPos = -1; 1146 | }); 1147 | }, 1148 | ), 1149 | ), 1150 | ), 1151 | 1152 | // 总播放时间 1153 | _duration.inMilliseconds == 0 1154 | ? Container( 1155 | child: const Text( 1156 | "00:00", 1157 | style: TextStyle(color: Colors.white), 1158 | ), 1159 | ) 1160 | : Padding( 1161 | padding: EdgeInsets.only(right: 5.0, left: 5), 1162 | child: Text( 1163 | '${_duration2String(_duration)}', 1164 | style: TextStyle( 1165 | fontSize: 14.0, 1166 | color: Colors.white, 1167 | ), 1168 | ), 1169 | ), 1170 | // 剧集按钮 1171 | widget.player.value.fullScreen && showConfig.drawerBtn 1172 | ? Ink( 1173 | padding: EdgeInsets.all(5), 1174 | child: InkWell( 1175 | onTap: () { 1176 | // 调用父组件的回调 1177 | widget.changeDrawerState(true); 1178 | }, 1179 | child: Container( 1180 | alignment: Alignment.center, 1181 | width: 40, 1182 | height: 30, 1183 | child: Text( 1184 | "剧集", 1185 | style: TextStyle(color: Colors.white), 1186 | ), 1187 | ), 1188 | ), 1189 | ) 1190 | : Container(), 1191 | // 倍数按钮 1192 | widget.player.value.fullScreen && showConfig.speedBtn 1193 | ? Ink( 1194 | padding: EdgeInsets.all(5), 1195 | child: InkWell( 1196 | onTap: () { 1197 | setState(() { 1198 | _hideSpeedStu = !_hideSpeedStu; 1199 | }); 1200 | }, 1201 | child: Container( 1202 | alignment: Alignment.center, 1203 | width: 40, 1204 | height: 30, 1205 | child: Text( 1206 | _speed.toString() + " X", 1207 | style: TextStyle(color: Colors.white), 1208 | ), 1209 | ), 1210 | ), 1211 | ) 1212 | : Container(), 1213 | // 按钮 - 全屏/退出全屏 1214 | _buildPlayStateBtn( 1215 | widget.player.value.fullScreen 1216 | ? Icons.fullscreen_exit 1217 | : Icons.fullscreen, 1218 | () { 1219 | if (widget.player.value.fullScreen) { 1220 | player.exitFullScreen(); 1221 | } else { 1222 | player.enterFullScreen(); 1223 | // 掉父组件回调 1224 | widget.changeDrawerState(false); 1225 | } 1226 | }, 1227 | ), 1228 | SizedBox(width: 7), 1229 | // 1230 | ], 1231 | ), 1232 | ), 1233 | ), 1234 | ), 1235 | // 隐藏进度条,ui隐藏时出现 1236 | Positioned( 1237 | bottom: 0, 1238 | left: 0, 1239 | right: 0, 1240 | child: showConfig.bottomPro && 1241 | _hideStuff && 1242 | _duration.inMilliseconds != 0 1243 | ? Container( 1244 | alignment: Alignment.bottomLeft, 1245 | height: 4, 1246 | color: Colors.white70, 1247 | child: Container( 1248 | color: Colors.blue, 1249 | width: curBottomProW is double ? curBottomProW : 0, 1250 | height: 4, 1251 | ), 1252 | ) 1253 | : Container(), 1254 | ) 1255 | ], 1256 | ), 1257 | ); 1258 | } 1259 | 1260 | // 返回按钮 1261 | Widget _buildTopBackBtn() { 1262 | return IconButton( 1263 | icon: Icon(Icons.arrow_back), 1264 | padding: EdgeInsets.only( 1265 | left: 10.0, 1266 | right: 10.0, 1267 | ), 1268 | splashColor: Colors.transparent, 1269 | highlightColor: Colors.transparent, 1270 | color: Colors.white, 1271 | onPressed: () { 1272 | // 判断当前是否全屏,如果全屏,退出 1273 | if (widget.player.value.fullScreen) { 1274 | player.exitFullScreen(); 1275 | } else { 1276 | if (widget.pageContent == null) return null; 1277 | player.stop(); 1278 | Navigator.pop(widget.pageContent!); 1279 | } 1280 | }, 1281 | ); 1282 | } 1283 | 1284 | // 播放器顶部 返回 + 标题 1285 | Widget _buildTopBar() { 1286 | return AnimatedOpacity( 1287 | opacity: _hideStuff ? 0.0 : 0.8, 1288 | duration: Duration(milliseconds: 400), 1289 | child: Container( 1290 | height: showConfig.stateAuto && !widget.player.value.fullScreen 1291 | ? barFillingHeight 1292 | : barHeight, 1293 | alignment: Alignment.bottomLeft, 1294 | decoration: BoxDecoration( 1295 | gradient: const LinearGradient( 1296 | begin: Alignment.topLeft, 1297 | end: Alignment.bottomLeft, 1298 | colors: [ 1299 | Color.fromRGBO(0, 0, 0, 0.5), 1300 | Color.fromRGBO(0, 0, 0, 0), 1301 | ], 1302 | ), 1303 | ), 1304 | child: Container( 1305 | height: barHeight, 1306 | child: Row( 1307 | children: [ 1308 | _buildTopBackBtn(), 1309 | Expanded( 1310 | child: Container( 1311 | child: Text( 1312 | widget.playerTitle, 1313 | overflow: TextOverflow.ellipsis, 1314 | maxLines: 1, 1315 | textAlign: TextAlign.left, 1316 | style: TextStyle( 1317 | color: Colors.white, 1318 | ), 1319 | ), 1320 | ), 1321 | ) 1322 | ], 1323 | ), 1324 | ), 1325 | ), 1326 | ); 1327 | } 1328 | 1329 | // 居中播放按钮 1330 | Widget _buildCenterPlayBtn() { 1331 | return Container( 1332 | color: Colors.transparent, 1333 | height: double.infinity, 1334 | width: double.infinity, 1335 | child: Center( 1336 | child: (_prepared && !_buffering) 1337 | ? AnimatedOpacity( 1338 | opacity: _hideStuff ? 0.0 : 0.7, 1339 | duration: Duration(milliseconds: 400), 1340 | child: IconButton( 1341 | iconSize: barHeight * 1.2, 1342 | icon: Icon(_playing ? Icons.pause : Icons.play_arrow, 1343 | color: Colors.white), 1344 | padding: EdgeInsets.only(left: 10.0, right: 10.0), 1345 | onPressed: _playOrPause, 1346 | ), 1347 | ) 1348 | : SizedBox( 1349 | width: barHeight * 0.8, 1350 | height: barHeight * 0.8, 1351 | child: const CircularProgressIndicator( 1352 | valueColor: AlwaysStoppedAnimation(Colors.white), 1353 | ), 1354 | ), 1355 | ), 1356 | ); 1357 | } 1358 | 1359 | // build 滑动进度时间显示 1360 | Widget _buildDargProgressTime() { 1361 | return _isTouch 1362 | ? Container( 1363 | height: 40, 1364 | alignment: Alignment.center, 1365 | decoration: BoxDecoration( 1366 | borderRadius: BorderRadius.all( 1367 | Radius.circular(5), 1368 | ), 1369 | color: Color.fromRGBO(0, 0, 0, 0.8), 1370 | ), 1371 | child: Padding( 1372 | padding: EdgeInsets.only(left: 10, right: 10), 1373 | child: Text( 1374 | '${_duration2String(_dargPos)} / ${_duration2String(_duration)}', 1375 | style: TextStyle( 1376 | color: Colors.white, 1377 | fontSize: 18, 1378 | ), 1379 | ), 1380 | ), 1381 | ) 1382 | : Container(); 1383 | } 1384 | 1385 | // build 显示垂直亮度,音量 1386 | Widget _buildDargVolumeAndBrightness() { 1387 | // 不显示 1388 | if (!varTouchInitSuc) return Container(); 1389 | 1390 | IconData iconData; 1391 | // 判断当前值范围,显示的图标 1392 | if (updateDargVarVal! <= 0) { 1393 | iconData = !isDargVerLeft! ? Icons.volume_mute : Icons.brightness_low; 1394 | } else if (updateDargVarVal! < 0.5) { 1395 | iconData = !isDargVerLeft! ? Icons.volume_down : Icons.brightness_medium; 1396 | } else { 1397 | iconData = !isDargVerLeft! ? Icons.volume_up : Icons.brightness_high; 1398 | } 1399 | // 显示,亮度 || 音量 1400 | return Card( 1401 | color: Color.fromRGBO(0, 0, 0, 0.8), 1402 | child: Container( 1403 | padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 10), 1404 | child: Row( 1405 | mainAxisSize: MainAxisSize.min, 1406 | children: [ 1407 | Icon( 1408 | iconData, 1409 | color: Colors.white, 1410 | ), 1411 | Container( 1412 | width: 100, 1413 | height: 3, 1414 | margin: EdgeInsets.only(left: 8), 1415 | child: LinearProgressIndicator( 1416 | value: updateDargVarVal, 1417 | backgroundColor: Colors.white54, 1418 | valueColor: AlwaysStoppedAnimation(Colors.lightBlue), 1419 | ), 1420 | ), 1421 | ], 1422 | ), 1423 | ), 1424 | ); 1425 | } 1426 | 1427 | // build 倍数列表 1428 | List _buildSpeedListWidget() { 1429 | List columnChild = []; 1430 | speedList.forEach((String mapKey, double speedVals) { 1431 | columnChild.add( 1432 | Ink( 1433 | child: InkWell( 1434 | onTap: () { 1435 | if (_speed == speedVals) return null; 1436 | setState(() { 1437 | _speed = speed = speedVals; 1438 | _hideSpeedStu = true; 1439 | player.setSpeed(speedVals); 1440 | }); 1441 | }, 1442 | child: Container( 1443 | alignment: Alignment.center, 1444 | width: 50, 1445 | height: 30, 1446 | child: Text( 1447 | mapKey + " X", 1448 | style: TextStyle( 1449 | color: _speed == speedVals ? Colors.blue : Colors.white, 1450 | fontSize: 16, 1451 | ), 1452 | ), 1453 | ), 1454 | ), 1455 | ), 1456 | ); 1457 | columnChild.add( 1458 | Padding( 1459 | padding: EdgeInsets.only(top: 5, bottom: 5), 1460 | child: Container( 1461 | width: 50, 1462 | height: 1, 1463 | color: Colors.white54, 1464 | ), 1465 | ), 1466 | ); 1467 | }); 1468 | columnChild.removeAt(columnChild.length - 1); 1469 | return columnChild; 1470 | } 1471 | 1472 | // 播放器控制器 ui 1473 | Widget _buildGestureDetector() { 1474 | return GestureDetector( 1475 | onTap: _cancelAndRestartTimer, 1476 | behavior: HitTestBehavior.opaque, 1477 | onHorizontalDragStart: _onHorizontalDragStart, 1478 | onHorizontalDragUpdate: _onHorizontalDragUpdate, 1479 | onHorizontalDragEnd: _onHorizontalDragEnd, 1480 | onVerticalDragStart: _onVerticalDragStart, 1481 | onVerticalDragUpdate: _onVerticalDragUpdate, 1482 | onVerticalDragEnd: _onVerticalDragEnd, 1483 | child: AbsorbPointer( 1484 | absorbing: _hideStuff, 1485 | child: Column( 1486 | children: [ 1487 | // 播放器顶部控制器 1488 | showConfig.topBar 1489 | ? _buildTopBar() 1490 | : Container( 1491 | height: 1492 | showConfig.stateAuto && !widget.player.value.fullScreen 1493 | ? barFillingHeight 1494 | : barHeight, 1495 | ), 1496 | // 中间按钮 1497 | Expanded( 1498 | child: Stack( 1499 | children: [ 1500 | // 顶部显示 1501 | Positioned( 1502 | top: widget.player.value.fullScreen ? 20 : 0, 1503 | left: 0, 1504 | right: 0, 1505 | child: Row( 1506 | mainAxisAlignment: MainAxisAlignment.center, 1507 | children: [ 1508 | // 显示左右滑动快进时间的块 1509 | _buildDargProgressTime(), 1510 | // 显示上下滑动音量亮度 1511 | _buildDargVolumeAndBrightness() 1512 | ], 1513 | ), 1514 | ), 1515 | // 中间按钮 1516 | Align( 1517 | alignment: Alignment.center, 1518 | child: _buildCenterPlayBtn(), 1519 | ), 1520 | // 倍数选择 1521 | Positioned( 1522 | right: 35, 1523 | bottom: 0, 1524 | child: !_hideSpeedStu 1525 | ? Container( 1526 | child: Padding( 1527 | padding: EdgeInsets.all(10), 1528 | child: Column( 1529 | children: _buildSpeedListWidget(), 1530 | ), 1531 | ), 1532 | decoration: BoxDecoration( 1533 | color: Colors.black45, 1534 | borderRadius: BorderRadius.circular(10), 1535 | ), 1536 | ) 1537 | : Container(), 1538 | ), 1539 | // 锁按钮 1540 | showConfig.lockBtn && widget.player.value.fullScreen 1541 | ? Align( 1542 | alignment: Alignment.centerLeft, 1543 | child: AnimatedOpacity( 1544 | opacity: _hideStuff ? 0.0 : 0.7, 1545 | duration: Duration(milliseconds: 400), 1546 | child: Padding( 1547 | padding: EdgeInsets.only(left: 20), 1548 | child: IconButton( 1549 | iconSize: 30, 1550 | onPressed: () { 1551 | // 更改 ui显示状态 1552 | widget.changeLockState(true); 1553 | }, 1554 | icon: Icon(Icons.lock_outline), 1555 | color: Colors.white, 1556 | ), 1557 | ), 1558 | ), 1559 | ) 1560 | : Container(), 1561 | ], 1562 | ), 1563 | ), 1564 | // 播放器底部控制器 1565 | _buildBottomBar(context), 1566 | ], 1567 | ), 1568 | ), 1569 | ); 1570 | } 1571 | 1572 | @override 1573 | Widget build(BuildContext context) { 1574 | return _buildGestureDetector(); 1575 | } 1576 | } 1577 | --------------------------------------------------------------------------------