提交 b444cbae authored 作者: jungleiOS's avatar jungleiOS

初始化播放仓库

上级
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/
# IntelliJ related
*.iml
*.ipr
*.iws
.idea/
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/
# Flutter/Dart/Pub related
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
/pubspec.lock
**/doc/api/
.dart_tool/
.packages
build/
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled.
version:
revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf
channel: stable
project_type: plugin
# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf
base_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf
- platform: android
create_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf
base_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf
- platform: ios
create_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf
base_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf
# User provided section
# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
## 0.0.1
* TODO: Describe initial release.
TODO: Add your license here.
# gz_video_player
A new Flutter project.
## Getting Started
This project is a starting point for a Flutter
[plug-in package](https://flutter.dev/developing-packages/),
a specialized package that includes platform-specific implementation code for
Android and/or iOS.
For help getting started with Flutter development, view the
[online documentation](https://flutter.dev/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
include: package:flutter_lints/flutter.yaml
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
.cxx
group 'com.example.gz_video_player'
version '1.0'
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.0'
}
}
rootProject.allprojects {
repositories {
google()
mavenCentral()
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 31
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
minSdkVersion 16
}
}
rootProject.name = 'gz_video_player'
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.gz_video_player">
</manifest>
package com.example.gz_video_player;
import androidx.annotation.NonNull;
import io.flutter.embedding.engine.plugins.FlutterPlugin;
import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
import io.flutter.plugin.common.MethodChannel.Result;
/** GzVideoPlayerPlugin */
public class GzVideoPlayerPlugin implements FlutterPlugin, MethodCallHandler {
/// The MethodChannel that will the communication between Flutter and native Android
///
/// This local reference serves to register the plugin with the Flutter Engine and unregister it
/// when the Flutter Engine is detached from the Activity
private MethodChannel channel;
@Override
public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) {
channel = new MethodChannel(flutterPluginBinding.getBinaryMessenger(), "gz_video_player");
channel.setMethodCallHandler(this);
}
@Override
public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
if (call.method.equals("getPlatformVersion")) {
result.success("Android " + android.os.Build.VERSION.RELEASE);
} else {
result.notImplemented();
}
}
@Override
public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) {
channel.setMethodCallHandler(null);
}
}
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/
# IntelliJ related
*.iml
*.ipr
*.iws
.idea/
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/
# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/
# Symbolication related
app.*.symbols
# Obfuscation related
app.*.map.json
# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release
# gz_video_player_example
Demonstrates how to use the gz_video_player plugin.
## Getting Started
This project is a starting point for a Flutter application.
A few resources to get you started if this is your first Flutter project:
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
For help getting started with Flutter development, view the
[online documentation](https://docs.flutter.dev/), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.
# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml
linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
gradle-wrapper.jar
/.gradle
/captures/
/gradlew
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java
# Remember to never publicly share your keystore.
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
key.properties
**/*.keystore
**/*.jks
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.gz_video_player_example"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.gz_video_player_example">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.gz_video_player_example">
<application
android:label="gz_video_player_example"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>
package com.example.gz_video_player_example;
import io.flutter.embedding.android.FlutterActivity;
public class MainActivity extends FlutterActivity {
}
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="?android:colorBackground" />
<!-- You can insert your own image assets here -->
<!-- <item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
</layer-list>
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/white" />
<!-- You can insert your own image assets here -->
<!-- <item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
</layer-list>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
the Flutter engine draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
the Flutter engine draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.gz_video_player_example">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
buildscript {
ext.kotlin_version = '1.7.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
include ':app'
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
def properties = new Properties()
assert localPropertiesFile.exists()
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
**/dgph
*.mode1v3
*.mode2v3
*.moved-aside
*.pbxuser
*.perspectivev3
**/*sync/
.sconsign.dblite
.tags*
**/.vagrant/
**/DerivedData/
Icon?
**/Pods/
**/.symlinks/
profile
xcuserdata
**/.generated/
Flutter/App.framework
Flutter/Flutter.framework
Flutter/Flutter.podspec
Flutter/Generated.xcconfig
Flutter/ephemeral/
Flutter/app.flx
Flutter/app.zip
Flutter/flutter_assets/
Flutter/flutter_export_environment.sh
ServiceDefinitions.json
Runner/GeneratedPluginRegistrant.*
# Exceptions to above rules.
!default.mode1v3
!default.mode2v3
!default.pbxuser
!default.perspectivev3
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>App</string>
<key>CFBundleIdentifier</key>
<string>io.flutter.flutter.app</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>App</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>11.0</string>
</dict>
</plist>
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"
# Uncomment this line to define a global platform for your project
# platform :ios, '11.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_ios_podfile_setup
target 'Runner' do
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
PODS:
- connectivity (0.0.1):
- Flutter
- Reachability
- Flutter (1.0.0)
- gz_video_player (0.0.1):
- Flutter
- orientation (0.0.1):
- Flutter
- Reachability (3.2)
- screen_brightness_ios (0.1.0):
- Flutter
- video_player_avfoundation (0.0.1):
- Flutter
- wakelock (0.0.1):
- Flutter
DEPENDENCIES:
- connectivity (from `.symlinks/plugins/connectivity/ios`)
- Flutter (from `Flutter`)
- gz_video_player (from `.symlinks/plugins/gz_video_player/ios`)
- orientation (from `.symlinks/plugins/orientation/ios`)
- screen_brightness_ios (from `.symlinks/plugins/screen_brightness_ios/ios`)
- video_player_avfoundation (from `.symlinks/plugins/video_player_avfoundation/ios`)
- wakelock (from `.symlinks/plugins/wakelock/ios`)
SPEC REPOS:
trunk:
- Reachability
EXTERNAL SOURCES:
connectivity:
:path: ".symlinks/plugins/connectivity/ios"
Flutter:
:path: Flutter
gz_video_player:
:path: ".symlinks/plugins/gz_video_player/ios"
orientation:
:path: ".symlinks/plugins/orientation/ios"
screen_brightness_ios:
:path: ".symlinks/plugins/screen_brightness_ios/ios"
video_player_avfoundation:
:path: ".symlinks/plugins/video_player_avfoundation/ios"
wakelock:
:path: ".symlinks/plugins/wakelock/ios"
SPEC CHECKSUMS:
connectivity: c4130b2985d4ef6fd26f9702e886bd5260681467
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
gz_video_player: ebc14497d390b6c08d115ab4f3aa27f282401a28
orientation: 6c9203efe86ce4cff379756910f18b2d745628c3
Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96
screen_brightness_ios: 715ca807df953bf676d339f11464e438143ee625
video_player_avfoundation: 81e49bb3d9fb63dccf9fa0f6d877dc3ddbeac126
wakelock: d0fc7c864128eac40eba1617cb5264d9c940b46f
PODFILE CHECKSUM: 663715e941f9adb426e33bf9376914006f9ea95b
COCOAPODS: 1.12.1
差异被折叠。
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreviewsEnabled</key>
<false/>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Profile"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:Runner.xcodeproj">
</FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
</Workspace>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreviewsEnabled</key>
<false/>
</dict>
</plist>
#import <Flutter/Flutter.h>
#import <UIKit/UIKit.h>
@interface AppDelegate : FlutterAppDelegate
@end
#import "AppDelegate.h"
#import "GeneratedPluginRegistrant.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[GeneratedPluginRegistrant registerWithRegistry:self];
// Override point for customization after application launch.
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
@end
{
"images" : [
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-App-20x20@2x.png",
"scale" : "2x"
},
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-App-20x20@3x.png",
"scale" : "3x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@1x.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@3x.png",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-App-40x40@2x.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-App-40x40@3x.png",
"scale" : "3x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-App-60x60@2x.png",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-App-60x60@3x.png",
"scale" : "3x"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "Icon-App-20x20@1x.png",
"scale" : "1x"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "Icon-App-20x20@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-App-29x29@1x.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-App-29x29@2x.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-App-40x40@1x.png",
"scale" : "1x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-App-40x40@2x.png",
"scale" : "2x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-App-76x76@1x.png",
"scale" : "1x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-App-76x76@2x.png",
"scale" : "2x"
},
{
"size" : "83.5x83.5",
"idiom" : "ipad",
"filename" : "Icon-App-83.5x83.5@2x.png",
"scale" : "2x"
},
{
"size" : "1024x1024",
"idiom" : "ios-marketing",
"filename" : "Icon-App-1024x1024@1x.png",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
{
"images" : [
{
"idiom" : "universal",
"filename" : "LaunchImage.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "LaunchImage@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "LaunchImage@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
# Launch Screen Assets
You can customize the launch screen with your own desired assets by replacing the image files in this directory.
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.
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Ydg-fD-yQy"/>
<viewControllerLayoutGuide type="bottom" id="xbc-2k-c8Z"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4">
</imageView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1a2-6s-vTC"/>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="4X2-HB-R7a"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
<resources>
<image name="LaunchImage" width="168" height="185"/>
</resources>
</document>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies>
<scenes>
<!--Flutter View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="FlutterViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
</scene>
</scenes>
</document>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>Gz Video Player</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>gz_video_player_example</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
</dict>
</plist>
#import <Flutter/Flutter.h>
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
int main(int argc, char* argv[]) {
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
差异被折叠。
差异被折叠。
name: gz_video_player_example
description: Demonstrates how to use the gz_video_player plugin.
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
environment:
sdk: '>=2.19.6 <3.0.0'
# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
flutter:
sdk: flutter
gz_video_player:
# When depending on this package from a real application you should use:
# gz_video_player: ^x.y.z
# See https://dart.dev/tools/pub/dependencies#version-constraints
# The example app is bundled with the plugin so we use a path dependency on
# the parent directory to use the current plugin's version.
path: ../
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
dev_dependencies:
flutter_test:
sdk: flutter
# The "flutter_lints" package below contains a set of recommended lints to
# encourage good coding practices. The lint set provided by the package is
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^2.0.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter packages.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:gz_video_player_example/main.dart';
void main() {
testWidgets('Verify Platform version', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(const MyApp());
// Verify that platform version is retrieved.
expect(
find.byWidgetPredicate(
(Widget widget) => widget is Text &&
widget.data!.startsWith('Running on:'),
),
findsOneWidget,
);
});
}
.idea/
.vagrant/
.sconsign.dblite
.svn/
.DS_Store
*.swp
profile
DerivedData/
build/
GeneratedPluginRegistrant.h
GeneratedPluginRegistrant.m
.generated/
*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
!default.pbxuser
!default.mode1v3
!default.mode2v3
!default.perspectivev3
xcuserdata
*.moved-aside
*.pyc
*sync/
Icon?
.tags*
/Flutter/Generated.xcconfig
/Flutter/ephemeral/
/Flutter/flutter_export_environment.sh
\ No newline at end of file
#import <Flutter/Flutter.h>
@interface GzVideoPlayerPlugin : NSObject<FlutterPlugin>
@end
#import "GzVideoPlayerPlugin.h"
@implementation GzVideoPlayerPlugin
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
FlutterMethodChannel* channel = [FlutterMethodChannel
methodChannelWithName:@"gz_video_player"
binaryMessenger:[registrar messenger]];
GzVideoPlayerPlugin* instance = [[GzVideoPlayerPlugin alloc] init];
[registrar addMethodCallDelegate:instance channel:channel];
}
- (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
if ([@"getPlatformVersion" isEqualToString:call.method]) {
result([@"iOS " stringByAppendingString:[[UIDevice currentDevice] systemVersion]]);
} else {
result(FlutterMethodNotImplemented);
}
}
@end
#
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
# Run `pod lib lint gz_video_player.podspec` to validate before publishing.
#
Pod::Spec.new do |s|
s.name = 'gz_video_player'
s.version = '0.0.1'
s.summary = 'A new Flutter project.'
s.description = <<-DESC
A new Flutter project.
DESC
s.homepage = 'http://example.com'
s.license = { :file => '../LICENSE' }
s.author = { 'Your Company' => 'email@example.com' }
s.source = { :path => '.' }
s.source_files = 'Classes/**/*'
s.public_header_files = 'Classes/**/*.h'
s.dependency 'Flutter'
s.platform = :ios, '9.0'
# Flutter.framework does not contain a i386 slice.
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }
end
import 'gz_video_player_platform_interface.dart';
class GzVideoPlayer {
Future<String?> getPlatformVersion() {
return GzVideoPlayerPlatform.instance.getPlatformVersion();
}
}
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'gz_video_player_platform_interface.dart';
/// An implementation of [GzVideoPlayerPlatform] that uses method channels.
class MethodChannelGzVideoPlayer extends GzVideoPlayerPlatform {
/// The method channel used to interact with the native platform.
@visibleForTesting
final methodChannel = const MethodChannel('gz_video_player');
@override
Future<String?> getPlatformVersion() async {
final version = await methodChannel.invokeMethod<String>('getPlatformVersion');
return version;
}
}
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
import 'gz_video_player_method_channel.dart';
abstract class GzVideoPlayerPlatform extends PlatformInterface {
/// Constructs a GzVideoPlayerPlatform.
GzVideoPlayerPlatform() : super(token: _token);
static final Object _token = Object();
static GzVideoPlayerPlatform _instance = MethodChannelGzVideoPlayer();
/// The default instance of [GzVideoPlayerPlatform] to use.
///
/// Defaults to [MethodChannelGzVideoPlayer].
static GzVideoPlayerPlatform get instance => _instance;
/// Platform-specific implementations should set this with their own
/// platform-specific class that extends [GzVideoPlayerPlatform] when
/// they register themselves.
static set instance(GzVideoPlayerPlatform instance) {
PlatformInterface.verifyToken(instance, _token);
_instance = instance;
}
Future<String?> getPlatformVersion() {
throw UnimplementedError('platformVersion() has not been implemented.');
}
}
差异被折叠。
import 'package:flutter/material.dart';
class VideoBrightnessStyle {
Icon brightnessIcon;
Size size;
BorderRadius borderRadius;
Color backgroundColor;
TextStyle textStyle;
VideoBrightnessStyle({
this.brightnessIcon = const Icon(
Icons.sunny,
size: 40.0,
color: Colors.white,
),
this.size = const Size(80.0, 80.0),
this.borderRadius = const BorderRadius.all(Radius.circular(6.0)),
Color? backgroundColor,
this.textStyle = const TextStyle(fontWeight: FontWeight.normal, fontSize: 12.0, color: Colors.white),
}) : backgroundColor = backgroundColor ?? Colors.black.withOpacity(0.5);
}
import 'package:flutter/material.dart';
import 'package:gz_video_player/video_progress_style.dart';
const double iconSize = 18;
/// 底部控制拦样式
class VideoControlBarStyle {
VideoControlBarStyle({
this.height = 36,
this.margin = const EdgeInsets.all(0),
this.padding = const EdgeInsets.symmetric(vertical: 8, horizontal: 10),
VideoProgressStyle? progressStyle, //进度条样式
this.playedColor = const Color.fromRGBO(255, 0, 0, 0.7), //几个版本后移除
this.bufferedColor = const Color.fromRGBO(50, 50, 200, 0.2), //几个版本后移除
this.backgroundColor = const Color.fromRGBO(200, 200, 200, 0.5), //几个版本后移除
this.barBackgroundColor = const Color.fromRGBO(0, 0, 0, 0.5),
this.timePadding = const EdgeInsets.symmetric(horizontal: 4),
this.timeTextStyle = const TextStyle(
fontWeight: FontWeight.normal,
color: Colors.white,
fontSize: 11.0,
),
this.playIcon = const Icon(
Icons.play_circle_outline,
size: iconSize,
color: Color(0xFFFFFFFF),
semanticLabel: "播放",
),
this.pauseIcon = const Icon(
Icons.pause_circle_outline,
size: iconSize,
color: Color(0xFFFFFFFF),
semanticLabel: "暂停",
),
this.rewindIcon = const Icon(
Icons.fast_rewind,
size: iconSize,
color: Color(0xFFFFFFFF),
semanticLabel: "快退",
),
this.forwardIcon = const Icon(
Icons.fast_forward,
size: iconSize,
color: Color(0xFFFFFFFF),
semanticLabel: "快进",
),
this.fullscreenIcon = const Icon(
Icons.fullscreen,
size: iconSize,
color: Color(0xFFFFFFFF),
semanticLabel: "全屏",
),
this.fullscreenExitIcon = const Icon(
Icons.fullscreen_exit,
size: iconSize,
color: Color(0xFFFFFFFF),
semanticLabel: "退出全屏",
),
this.itemList = const [
"rewind",
"play",
"forward",
"progress",
"time",
"fullscreen"
],
}) : progressStyle = progressStyle ?? VideoProgressStyle();
final double height;
final EdgeInsets padding;
EdgeInsets margin;
final VideoProgressStyle progressStyle;
final Color playedColor;
final Color bufferedColor;
final Color backgroundColor;
final Color barBackgroundColor;
final EdgeInsets timePadding;
final TextStyle timeTextStyle;
// final double iconSize;
final Widget playIcon;
final Widget pauseIcon;
final Widget rewindIcon;
final Widget forwardIcon;
final Widget fullscreenIcon;
final Widget fullscreenExitIcon;
final List<String> itemList;
}
import 'package:flutter/material.dart';
/// 字幕样式
class VideoLoadingStyle {
VideoLoadingStyle({
this.customLoadingIcon = const CircularProgressIndicator(strokeWidth: 2.0),
this.customLoadingText,
this.loadingText = "Loading...",
this.loadingTextFontColor = Colors.white,
this.loadingTextFontSize = 20,
});
final Widget customLoadingIcon;
final Widget? customLoadingText;
final String loadingText;
final Color loadingTextFontColor;
final double loadingTextFontSize;
}
import 'package:gz_video_player/video_speed.dart';
/// 自定义播放参数
class VideoPlayOptions {
VideoPlayOptions({
this.aspectRatio = 16 / 9,
this.startPosition = const Duration(seconds: 0),
this.loop = false,
this.seekSeconds = 15,
this.progressGestureUnit = 1000,
this.volumeGestureUnit = 0.001,
this.brightnessGestureUnit = 0.005,
this.autoplay = true,
this.allowScrubbing = true,
List<VideoSpeedItem>? speedList,
}) : speedList = speedList ??
[
VideoSpeedItem(speed: 0.5, title: '0.5X'),
VideoSpeedItem(speed: 0.75, title: '0.75X'),
VideoSpeedItem(speed: 1.0, title: '1X'),
VideoSpeedItem(speed: 1.25, title: '1.25X'),
VideoSpeedItem(speed: 1.5, title: '1.5X'),
VideoSpeedItem(speed: 1.75, title: '1.75X'),
VideoSpeedItem(speed: 2.0, title: '2X'),
];
/// 开始播放节点
final Duration startPosition;
/// 是否循环播放
final bool loop;
/// 视频快进秒数
final int seekSeconds;
/// 设置(横向)手势调节视频进度的秒数单位,默认为`1s`
final int progressGestureUnit;
/// 设置(右侧垂直)手势调节视频音量的单位,必须为0~1之间(不能小于0,不能大于1),默认为`0.01`
final double volumeGestureUnit;
/// 设置(左侧垂直)手势调节视频亮度的单位,必须为0~1之间(不能小于0,不能大于1),默认为`0.01`
final double brightnessGestureUnit;
/// 是否自动播放
final bool autoplay;
/// 视频播放比例
final double aspectRatio;
/// 是否运行进度条拖拽
final bool allowScrubbing;
/// 倍数列表
final List<VideoSpeedItem> speedList;
}
import 'package:flutter/material.dart';
class VideoProgressStyle {
VideoProgressStyle({
this.padding = const EdgeInsets.symmetric(vertical: 8, horizontal: 10),
this.playedColor = const Color.fromRGBO(255, 0, 0, 0.7),
this.bufferedColor = const Color.fromRGBO(50, 50, 200, 0.2),
this.backgroundColor = const Color.fromRGBO(200, 200, 200, 0.5),
this.dragBarColor = const Color.fromRGBO(255, 255, 255, 1),
this.progressRadius = 4,
this.height = 4,
this.dragHeight = 5,
// this.dargBarIcon = const ,
});
final EdgeInsets padding;
final Color playedColor;
final Color bufferedColor;
final Color backgroundColor;
final Color dragBarColor;
final double progressRadius;
final double height;
final double dragHeight;
// final Widget dargBarIcon;
}
import 'package:flutter/material.dart';
class VideoSpeedItem {
final double speed;
final String title;
VideoSpeedItem({this.speed = 1.0, this.title = '1.0X'});
}
class VideoSpeedItemStyle {
final Color backgroundColor;
final Size itemSize;
final TextStyle textStyle;
final EdgeInsets padding;
final EdgeInsets margin;
final BorderRadius radius;
VideoSpeedItemStyle({
Color? backgroundColor,
this.itemSize = const Size(45, 30),
this.padding = const EdgeInsets.symmetric(vertical: 2.0, horizontal: 2.0),
this.margin = EdgeInsets.zero,
this.radius = const BorderRadius.all(Radius.circular(8.0)),
this.textStyle = const TextStyle(
fontSize: 14.0,
fontWeight: FontWeight.normal,
color: Colors.white,
),
}) : backgroundColor = backgroundColor ?? Colors.black.withOpacity(0.5);
}
class VideoSpeedButtonStyle {
final TextStyle textStyle;
final String title;
VideoSpeedButtonStyle({
this.title = '倍数',
this.textStyle = const TextStyle(
fontSize: 14.0,
fontWeight: FontWeight.normal,
color: Colors.white,
),
});
}
import 'package:flutter/material.dart';
import 'package:gz_video_player/video_brightness_style.dart';
import 'package:gz_video_player/video_control_bar_style.dart';
import 'package:gz_video_player/video_loading_style.dart';
import 'package:gz_video_player/video_speed.dart';
import 'package:gz_video_player/video_subtitles.dart';
import 'package:gz_video_player/video_top_bar_style.dart';
import 'package:gz_video_player/video_volume_style.dart';
/// 播放器样式
class VideoStyle {
VideoStyle({
VideoTopBarStyle? videoTopBarStyle,
VideoControlBarStyle? videoControlBarStyle,
VideoSubtitles? videoSubtitlesStyle,
VideoLoadingStyle? videoLoadingStyle,
VideoSpeedButtonStyle? videoSpeedButtonStyle,
VideoSpeedItemStyle? videoSpeedItemStyle,
VideoBrightnessStyle? videoBrightnessStyle,
VideoVolumeStyle? videoVolumeStyle,
// this.videoCover = "",
this.playIcon = const Icon(
Icons.play_circle_outline,
color: Color(0xFFA4A3A3),
size: 80,
semanticLabel: "开始播放",
),
this.replayIcon = const Icon(
Icons.replay,
color: Color(0xFFA4A3A3),
size: 50,
semanticLabel: "开始播放",
),
this.showPlayIcon = true,
this.showReplayIcon = true,
}) : videoTopBarStyle = videoTopBarStyle ?? VideoTopBarStyle(),
videoControlBarStyle = videoControlBarStyle ?? VideoControlBarStyle(),
videoSubtitlesStyle = videoSubtitlesStyle ?? VideoSubtitles(),
videoLoadingStyle = videoLoadingStyle ?? VideoLoadingStyle(),
videoSpeedButtonStyle =
videoSpeedButtonStyle ?? VideoSpeedButtonStyle(),
videoSpeedItemStyle = videoSpeedItemStyle ?? VideoSpeedItemStyle(),
videoBrightnessStyle = videoBrightnessStyle ?? VideoBrightnessStyle(),
videoVolumeStyle = videoVolumeStyle ?? VideoVolumeStyle();
final VideoTopBarStyle videoTopBarStyle; //视频顶部样式
final VideoControlBarStyle videoControlBarStyle; //进度条样式
final VideoSubtitles videoSubtitlesStyle; //字幕样式
final VideoLoadingStyle videoLoadingStyle; //loading样式
final VideoSpeedButtonStyle videoSpeedButtonStyle;
final VideoSpeedItemStyle videoSpeedItemStyle;
final VideoBrightnessStyle videoBrightnessStyle;
final VideoVolumeStyle videoVolumeStyle;
// final String videoCover; //视频封面
final Widget playIcon; //暂停时显示
final Widget replayIcon; //暂停时显示
final bool showPlayIcon; //暂停时是否显示播放按钮
final bool showReplayIcon; //暂停时是否显示播放按钮
}
import 'package:flutter/material.dart';
/// 字幕样式
class VideoSubtitles {
VideoSubtitles({
this.mainTitleFontSize = 14,
this.mainTitleColor = const Color.fromRGBO(255, 255, 255, 1),
this.subTitleFontSize = 12,
this.subTitleColor = const Color.fromRGBO(255, 255, 255, 1),
this.mainTitle,
this.subTitle,
Align? mainTitleWidget,
});
final double mainTitleFontSize;
final Color mainTitleColor;
final double subTitleFontSize;
final Color subTitleColor;
final Widget? mainTitle; //主字幕
final Widget? subTitle; //副字幕
}
import 'package:flutter/material.dart';
/// 进度条样式
class VideoTopBarStyle {
VideoTopBarStyle({
this.show = true,
this.height = 36,
this.margin = const EdgeInsets.all(0),
this.padding = const EdgeInsets.symmetric(vertical: 8, horizontal: 10),
this.barBackgroundColor = const Color.fromRGBO(0, 0, 0, 0.5),
this.popIcon = const Icon(
Icons.arrow_back,
size: 18,
color: Colors.white,
),
this.contents = const [],
this.actions = const [],
this.customBar,
});
final bool show;
final double height;
EdgeInsets margin;
final EdgeInsets padding;
final Color barBackgroundColor;
final Widget popIcon;
final List<Widget> contents;
final List<Widget> actions;
final Widget? customBar;
}
import 'package:flutter/material.dart';
class VideoVolumeStyle {
Size size;
Color backgroundColor;
Color fillColor;
Color iconColor;
double iconSize;
TextStyle textStyle;
BorderRadius borderRadius;
VideoVolumeStyle({
this.size = const Size(30.0, 100.0),
Color? backgroundColor,
this.fillColor = Colors.white,
this.iconColor = Colors.black,
this.iconSize = 20.0,
this.textStyle = const TextStyle(fontSize: 11.0),
this.borderRadius = const BorderRadius.all(Radius.circular(6.0)),
}) : backgroundColor = backgroundColor ?? Colors.black.withOpacity(0.5);
}
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:gz_video_player/video_brightness_style.dart';
class BrightnessWidget extends StatefulWidget {
final ValueListenable<double> brightness;
final VideoBrightnessStyle videoBrightnessStyle;
BrightnessWidget({
super.key,
required this.brightness,
VideoBrightnessStyle? videoBrightnessStyle,
}) : videoBrightnessStyle = videoBrightnessStyle ?? VideoBrightnessStyle();
@override
State<BrightnessWidget> createState() => _BrightnessWidgetState();
}
class _BrightnessWidgetState extends State<BrightnessWidget> {
ValueListenable<double> get brightness => widget.brightness;
VideoBrightnessStyle get videoBrightnessStyle => widget.videoBrightnessStyle;
Timer? timer;
bool hidden = true;
@override
void initState() {
super.initState();
brightness.addListener(listener);
}
@override
Widget build(BuildContext context) {
return Align(
child: ValueListenableBuilder(
valueListenable: brightness,
builder: (BuildContext context, double value, Widget? child) {
int brightness = (value * 100).toInt();
return Offstage(
offstage: hidden,
child: Container(
width: videoBrightnessStyle.size.width,
height: videoBrightnessStyle.size.height,
decoration: BoxDecoration(
color: videoBrightnessStyle.backgroundColor,
borderRadius: videoBrightnessStyle.borderRadius,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
videoBrightnessStyle.brightnessIcon,
Text(
'${brightness.toString()}%',
style: videoBrightnessStyle.textStyle,
)
],
),
),
);
},
),
);
}
@override
void dispose() {
brightness.removeListener(listener);
timer?.cancel();
super.dispose();
}
void listener() {
if (hidden) {
hidden = false;
setState(() {});
}
timer?.cancel();
timer = Timer(const Duration(milliseconds: 250), () {
hidden = true;
setState(() {});
timer?.cancel();
});
}
}
import 'package:flutter/material.dart';
import 'package:gz_video_player/video_progress_style.dart';
import 'package:video_player/video_player.dart';
class VideoDefaultProgressBar extends StatelessWidget {
final VideoPlayerController controller;
final bool allowScrubbing;
final VideoProgressStyle progressStyle;
VideoDefaultProgressBar({
super.key,
required this.controller,
this.allowScrubbing = true,
VideoProgressStyle? progressStyle,
}) : progressStyle = progressStyle ?? VideoProgressStyle();
@override
Widget build(BuildContext context) {
return VideoProgressIndicator(
controller,
allowScrubbing: allowScrubbing,
colors: VideoProgressColors(
playedColor: progressStyle.playedColor,
bufferedColor: progressStyle.bufferedColor,
backgroundColor: progressStyle.backgroundColor,
),
padding: progressStyle.padding,
);
}
}
import 'package:flutter/material.dart';
import 'package:gz_video_player/video_progress_style.dart';
import 'package:video_player/video_player.dart';
typedef VideoProgressDragHandle = void Function(
Duration position, Duration duration);
/// 自定义线性进度条
class VideoLinearProgressBar extends StatefulWidget {
VideoLinearProgressBar(
this.controller, {
super.key,
VideoProgressStyle? progressStyle,
this.allowScrubbing,
this.padding = const EdgeInsets.only(top: 5.0),
this.onProgressDrag,
}) : progressStyle = progressStyle ?? VideoProgressStyle();
final VideoPlayerController controller;
final VideoProgressStyle progressStyle;
final bool? allowScrubbing;
final EdgeInsets padding;
final VideoProgressDragHandle? onProgressDrag;
@override
State<StatefulWidget> createState() => _VideoLinearProgressBarState();
}
class _VideoLinearProgressBarState extends State<VideoLinearProgressBar> {
late VoidCallback listener;
VideoPlayerController get controller => widget.controller;
VideoProgressStyle get style => widget.progressStyle;
@override
void initState() {
super.initState();
listener = () {
if (!mounted) {
return;
}
setState(() {});
};
controller.addListener(listener);
}
@override
void deactivate() {
controller.removeListener(listener);
super.deactivate();
}
@override
Widget build(BuildContext context) {
return _VideoScrubber(
controller: controller,
handleDrag: widget.onProgressDrag,
child: CustomPaint(
painter: _ProgressBarPainter(controller.value, style),
child: Container(),
),
);
}
}
/// 处理进度条手势
class _VideoScrubber extends StatefulWidget {
const _VideoScrubber({
required this.child,
required this.controller,
this.handleDrag,
});
final Widget child;
final VideoPlayerController controller;
final VideoProgressDragHandle? handleDrag;
@override
_VideoScrubberState createState() => _VideoScrubberState();
}
class _VideoScrubberState extends State<_VideoScrubber> {
bool _controllerWasPlaying = false;
VideoPlayerController get controller => widget.controller;
@override
Widget build(BuildContext context) {
void seekToRelativePosition(Offset globalPosition) {
final RenderBox box = context.findRenderObject() as RenderBox;
final Offset tapPos = box.globalToLocal(globalPosition);
final double relative = tapPos.dx / box.size.width;
final Duration position = controller.value.duration * relative;
controller.seekTo(position);
}
void emitDragUpdate(globalPosition) {
if (widget.handleDrag != null) {
final RenderBox box = context.findRenderObject() as RenderBox;
final Offset tapPos = box.globalToLocal(globalPosition);
final double relative = tapPos.dx / box.size.width;
final Duration position = controller.value.duration * relative;
widget.handleDrag?.call(position, controller.value.duration);
}
}
return GestureDetector(
behavior: HitTestBehavior.opaque,
child: widget.child,
onHorizontalDragStart: (DragStartDetails details) {
if (!controller.value.isInitialized) {
return;
}
_controllerWasPlaying = controller.value.isPlaying;
if (_controllerWasPlaying) {
controller.pause();
}
},
onHorizontalDragUpdate: (DragUpdateDetails details) {
if (!controller.value.isInitialized) {
return;
}
emitDragUpdate(details.globalPosition);
seekToRelativePosition(details.globalPosition);
},
onHorizontalDragEnd: (DragEndDetails details) {
if (_controllerWasPlaying) {
controller.play();
}
},
onTapDown: (TapDownDetails details) {
if (!controller.value.isInitialized) {
return;
}
seekToRelativePosition(details.globalPosition);
},
);
}
}
/// 绘制进度条
class _ProgressBarPainter extends CustomPainter {
_ProgressBarPainter(this.value, this.style);
final VideoPlayerValue value;
final VideoProgressStyle style;
//刷新布局的时候告诉flutter 是否需要重绘
@override
bool shouldRepaint(CustomPainter painter) {
return true;
}
//绘制流程
@override
void paint(Canvas canvas, Size size) {
final baseOffset = size.height / 2 - style.height / 2.0;
canvas.drawRRect(
RRect.fromRectAndRadius(
Rect.fromPoints(
Offset(0.0, baseOffset),
Offset(size.width, baseOffset + style.height),
),
Radius.circular(style.progressRadius),
),
Paint()..color = style.backgroundColor,
);
if (!value.isInitialized) {
return;
}
final double playedPartPercent =
value.position.inMilliseconds / value.duration.inMilliseconds;
final double playedPart =
playedPartPercent > 1 ? size.width : playedPartPercent * size.width;
for (DurationRange range in value.buffered) {
final double start = range.startFraction(value.duration) * size.width;
final double end = range.endFraction(value.duration) * size.width;
canvas.drawRRect(
RRect.fromRectAndRadius(
Rect.fromPoints(
Offset(start, baseOffset),
Offset(end, baseOffset + style.height),
),
Radius.circular(style.progressRadius),
),
Paint()..color = style.bufferedColor,
);
}
canvas.drawRRect(
RRect.fromRectAndRadius(
Rect.fromPoints(
Offset(0.0, baseOffset),
Offset(playedPart, baseOffset + style.height),
),
Radius.circular(style.progressRadius),
),
Paint()..color = style.playedColor,
);
final shadowPath = Path()
..addOval(Rect.fromCircle(
center: Offset(playedPart, baseOffset + style.height / 2),
radius: style.dragHeight));
canvas.drawShadow(shadowPath, Colors.black, 0.2, false);
canvas.drawCircle(
Offset(playedPart, baseOffset + style.height / 2),
style.dragHeight,
Paint()..color = style.dragBarColor,
);
}
}
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论