[video_player] Federate mobile implementations (#4712)
Moves the iOS and Android implementations to their own federated packages. The iOS implementation package uses the name `avfoundation` rather than `ios` since it is likely that a macOS implementation could share a significant amount of code.
As part of the federation, migrates the mobile implementations to using in-package method channels rather than the shared method channel. Currently these are just duplicates of the existing method channels; updating them to new version of Pigeon will be done in a separate PR later.
Temporarily marks `video_player` as unpublishable to allow the implementations to be moved, rather than copied and deleted, in order to better preserve git history. A follow-up PR will restore it to publishable form.
No version change: The changes to `video_player_platform_interface` only affect development of the plugin, not use of the plugin.
Part of https://github.com/flutter/flutter/issues/68498
Part of https://github.com/flutter/flutter/issues/94224
diff --git a/packages/video_player/video_player/CHANGELOG.md b/packages/video_player/video_player/CHANGELOG.md
index 8209cc9..76c0a4a 100644
--- a/packages/video_player/video_player/CHANGELOG.md
+++ b/packages/video_player/video_player/CHANGELOG.md
@@ -1,5 +1,6 @@
## NEXT
+* Moves Android and iOS implementations to federated packages.
* Update audio URL in iOS tests.
## 2.2.17
diff --git a/packages/video_player/video_player/android/settings.gradle b/packages/video_player/video_player/android/settings.gradle
deleted file mode 100644
index bbc9b9d..0000000
--- a/packages/video_player/video_player/android/settings.gradle
+++ /dev/null
@@ -1 +0,0 @@
-rootProject.name = 'video_player'
diff --git a/packages/video_player/video_player/example/ios/Podfile b/packages/video_player/video_player/example/ios/Podfile
index fe37427..f7d6a5e 100644
--- a/packages/video_player/video_player/example/ios/Podfile
+++ b/packages/video_player/video_player/example/ios/Podfile
@@ -29,10 +29,6 @@
target 'Runner' do
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
- target 'RunnerTests' do
- inherit! :search_paths
- pod 'OCMock', '3.5'
- end
end
post_install do |installer|
diff --git a/packages/video_player/video_player/example/ios/Runner.xcodeproj/project.pbxproj b/packages/video_player/video_player/example/ios/Runner.xcodeproj/project.pbxproj
index d19d578..2596398 100644
--- a/packages/video_player/video_player/example/ios/Runner.xcodeproj/project.pbxproj
+++ b/packages/video_player/video_player/example/ios/Runner.xcodeproj/project.pbxproj
@@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
- objectVersion = 50;
+ objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
@@ -15,28 +15,8 @@
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
B0F5C77B94E32FB72444AE9F /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 20721C28387E1F78689EC502 /* libPods-Runner.a */; };
- D182ECB59C06DBC7E2D5D913 /* libPods-RunnerTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7BD232FD3BD3343A5F52AF50 /* libPods-RunnerTests.a */; };
- F7151F2F26603EBD0028CB91 /* VideoPlayerUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = F7151F2E26603EBD0028CB91 /* VideoPlayerUITests.m */; };
- F7151F3D26603ECA0028CB91 /* VideoPlayerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F7151F3C26603ECA0028CB91 /* VideoPlayerTests.m */; };
/* End PBXBuildFile section */
-/* Begin PBXContainerItemProxy section */
- F7151F3126603EBD0028CB91 /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 97C146E61CF9000F007C117D /* Project object */;
- proxyType = 1;
- remoteGlobalIDString = 97C146ED1CF9000F007C117D;
- remoteInfo = Runner;
- };
- F7151F3F26603ECA0028CB91 /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 97C146E61CF9000F007C117D /* Project object */;
- proxyType = 1;
- remoteGlobalIDString = 97C146ED1CF9000F007C117D;
- remoteInfo = Runner;
- };
-/* End PBXContainerItemProxy section */
-
/* Begin PBXCopyFilesBuildPhase section */
9705A1C41CF9048500538489 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
@@ -71,12 +51,6 @@
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
B15EC39F4617FE1082B18834 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
C18C242FF01156F58C0DAF1C /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
- F7151F2C26603EBD0028CB91 /* RunnerUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
- F7151F2E26603EBD0028CB91 /* VideoPlayerUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VideoPlayerUITests.m; sourceTree = "<group>"; };
- F7151F3026603EBD0028CB91 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
- F7151F3A26603ECA0028CB91 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
- F7151F3C26603ECA0028CB91 /* VideoPlayerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VideoPlayerTests.m; sourceTree = "<group>"; };
- F7151F3E26603ECA0028CB91 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -88,21 +62,6 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
- F7151F2926603EBD0028CB91 /* Frameworks */ = {
- isa = PBXFrameworksBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
- F7151F3726603ECA0028CB91 /* Frameworks */ = {
- isa = PBXFrameworksBuildPhase;
- buildActionMask = 2147483647;
- files = (
- D182ECB59C06DBC7E2D5D913 /* libPods-RunnerTests.a in Frameworks */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
@@ -142,8 +101,6 @@
children = (
9740EEB11CF90186004384FC /* Flutter */,
97C146F01CF9000F007C117D /* Runner */,
- F7151F3B26603ECA0028CB91 /* RunnerTests */,
- F7151F2D26603EBD0028CB91 /* RunnerUITests */,
97C146EF1CF9000F007C117D /* Products */,
05E898481BC29A7FA83AA441 /* Pods */,
23104BB9DCF267F65AD246F9 /* Frameworks */,
@@ -154,8 +111,6 @@
isa = PBXGroup;
children = (
97C146EE1CF9000F007C117D /* Runner.app */,
- F7151F2C26603EBD0028CB91 /* RunnerUITests.xctest */,
- F7151F3A26603ECA0028CB91 /* RunnerTests.xctest */,
);
name = Products;
sourceTree = "<group>";
@@ -184,24 +139,6 @@
name = "Supporting Files";
sourceTree = "<group>";
};
- F7151F2D26603EBD0028CB91 /* RunnerUITests */ = {
- isa = PBXGroup;
- children = (
- F7151F2E26603EBD0028CB91 /* VideoPlayerUITests.m */,
- F7151F3026603EBD0028CB91 /* Info.plist */,
- );
- path = RunnerUITests;
- sourceTree = "<group>";
- };
- F7151F3B26603ECA0028CB91 /* RunnerTests */ = {
- isa = PBXGroup;
- children = (
- F7151F3C26603ECA0028CB91 /* VideoPlayerTests.m */,
- F7151F3E26603ECA0028CB91 /* Info.plist */,
- );
- path = RunnerTests;
- sourceTree = "<group>";
- };
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -226,43 +163,6 @@
productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
productType = "com.apple.product-type.application";
};
- F7151F2B26603EBD0028CB91 /* RunnerUITests */ = {
- isa = PBXNativeTarget;
- buildConfigurationList = F7151F3526603EBD0028CB91 /* Build configuration list for PBXNativeTarget "RunnerUITests" */;
- buildPhases = (
- F7151F2826603EBD0028CB91 /* Sources */,
- F7151F2926603EBD0028CB91 /* Frameworks */,
- F7151F2A26603EBD0028CB91 /* Resources */,
- );
- buildRules = (
- );
- dependencies = (
- F7151F3226603EBD0028CB91 /* PBXTargetDependency */,
- );
- name = RunnerUITests;
- productName = RunnerUITests;
- productReference = F7151F2C26603EBD0028CB91 /* RunnerUITests.xctest */;
- productType = "com.apple.product-type.bundle.ui-testing";
- };
- F7151F3926603ECA0028CB91 /* RunnerTests */ = {
- isa = PBXNativeTarget;
- buildConfigurationList = F7151F4126603ECB0028CB91 /* Build configuration list for PBXNativeTarget "RunnerTests" */;
- buildPhases = (
- E9F7B01F913C69934A6629F6 /* [CP] Check Pods Manifest.lock */,
- F7151F3626603ECA0028CB91 /* Sources */,
- F7151F3726603ECA0028CB91 /* Frameworks */,
- F7151F3826603ECA0028CB91 /* Resources */,
- );
- buildRules = (
- );
- dependencies = (
- F7151F4026603ECA0028CB91 /* PBXTargetDependency */,
- );
- name = RunnerTests;
- productName = RunnerTests;
- productReference = F7151F3A26603ECA0028CB91 /* RunnerTests.xctest */;
- productType = "com.apple.product-type.bundle.unit-test";
- };
/* End PBXNativeTarget section */
/* Begin PBXProject section */
@@ -275,16 +175,6 @@
97C146ED1CF9000F007C117D = {
CreatedOnToolsVersion = 7.3.1;
};
- F7151F2B26603EBD0028CB91 = {
- CreatedOnToolsVersion = 12.5;
- ProvisioningStyle = Automatic;
- TestTargetID = 97C146ED1CF9000F007C117D;
- };
- F7151F3926603ECA0028CB91 = {
- CreatedOnToolsVersion = 12.5;
- ProvisioningStyle = Automatic;
- TestTargetID = 97C146ED1CF9000F007C117D;
- };
};
};
buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
@@ -301,8 +191,6 @@
projectRoot = "";
targets = (
97C146ED1CF9000F007C117D /* Runner */,
- F7151F3926603ECA0028CB91 /* RunnerTests */,
- F7151F2B26603EBD0028CB91 /* RunnerUITests */,
);
};
/* End PBXProject section */
@@ -319,20 +207,6 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
- F7151F2A26603EBD0028CB91 /* Resources */ = {
- isa = PBXResourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
- F7151F3826603ECA0028CB91 /* Resources */ = {
- isa = PBXResourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
@@ -364,28 +238,6 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
- E9F7B01F913C69934A6629F6 /* [CP] Check Pods Manifest.lock */ = {
- isa = PBXShellScriptBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- inputFileListPaths = (
- );
- inputPaths = (
- "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
- "${PODS_ROOT}/Manifest.lock",
- );
- name = "[CP] Check Pods Manifest.lock";
- outputFileListPaths = (
- );
- outputPaths = (
- "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt",
- );
- runOnlyForDeploymentPostprocessing = 0;
- shellPath = /bin/sh;
- shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
- showEnvVarsInLog = 0;
- };
F31A669BD45D5A7C940BF077 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@@ -417,37 +269,8 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
- F7151F2826603EBD0028CB91 /* Sources */ = {
- isa = PBXSourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- F7151F2F26603EBD0028CB91 /* VideoPlayerUITests.m in Sources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
- F7151F3626603ECA0028CB91 /* Sources */ = {
- isa = PBXSourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- F7151F3D26603ECA0028CB91 /* VideoPlayerTests.m in Sources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
/* End PBXSourcesBuildPhase section */
-/* Begin PBXTargetDependency section */
- F7151F3226603EBD0028CB91 /* PBXTargetDependency */ = {
- isa = PBXTargetDependency;
- target = 97C146ED1CF9000F007C117D /* Runner */;
- targetProxy = F7151F3126603EBD0028CB91 /* PBXContainerItemProxy */;
- };
- F7151F4026603ECA0028CB91 /* PBXTargetDependency */ = {
- isa = PBXTargetDependency;
- target = 97C146ED1CF9000F007C117D /* Runner */;
- targetProxy = F7151F3F26603ECA0028CB91 /* PBXContainerItemProxy */;
- };
-/* End PBXTargetDependency section */
-
/* Begin PBXVariantGroup section */
97C146FA1CF9000F007C117D /* Main.storyboard */ = {
isa = PBXVariantGroup;
@@ -616,62 +439,6 @@
};
name = Release;
};
- F7151F3326603EBD0028CB91 /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- CODE_SIGN_STYLE = Automatic;
- INFOPLIST_FILE = RunnerUITests/Info.plist;
- LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
- MTL_FAST_MATH = YES;
- PRODUCT_BUNDLE_IDENTIFIER = dev.flutter.plugins.RunnerUITests;
- PRODUCT_NAME = "$(TARGET_NAME)";
- TEST_TARGET_NAME = Runner;
- };
- name = Debug;
- };
- F7151F3426603EBD0028CB91 /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- CODE_SIGN_STYLE = Automatic;
- INFOPLIST_FILE = RunnerUITests/Info.plist;
- LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
- MTL_FAST_MATH = YES;
- PRODUCT_BUNDLE_IDENTIFIER = dev.flutter.plugins.RunnerUITests;
- PRODUCT_NAME = "$(TARGET_NAME)";
- TEST_TARGET_NAME = Runner;
- };
- name = Release;
- };
- F7151F4226603ECB0028CB91 /* Debug */ = {
- isa = XCBuildConfiguration;
- baseConfigurationReference = 6CDC4DA5940705A6E7671616 /* Pods-RunnerTests.debug.xcconfig */;
- buildSettings = {
- BUNDLE_LOADER = "$(TEST_HOST)";
- CODE_SIGN_STYLE = Automatic;
- INFOPLIST_FILE = RunnerTests/Info.plist;
- LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
- MTL_FAST_MATH = YES;
- PRODUCT_BUNDLE_IDENTIFIER = dev.flutter.plugins.RunnerTests;
- PRODUCT_NAME = "$(TARGET_NAME)";
- TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/Runner";
- };
- name = Debug;
- };
- F7151F4326603ECB0028CB91 /* Release */ = {
- isa = XCBuildConfiguration;
- baseConfigurationReference = 2A2EA522BDC492279A91AB75 /* Pods-RunnerTests.release.xcconfig */;
- buildSettings = {
- BUNDLE_LOADER = "$(TEST_HOST)";
- CODE_SIGN_STYLE = Automatic;
- INFOPLIST_FILE = RunnerTests/Info.plist;
- LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
- MTL_FAST_MATH = YES;
- PRODUCT_BUNDLE_IDENTIFIER = dev.flutter.plugins.RunnerTests;
- PRODUCT_NAME = "$(TARGET_NAME)";
- TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/Runner";
- };
- name = Release;
- };
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
@@ -693,24 +460,6 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
- F7151F3526603EBD0028CB91 /* Build configuration list for PBXNativeTarget "RunnerUITests" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- F7151F3326603EBD0028CB91 /* Debug */,
- F7151F3426603EBD0028CB91 /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
- F7151F4126603ECB0028CB91 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- F7151F4226603ECB0028CB91 /* Debug */,
- F7151F4326603ECB0028CB91 /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
/* End XCConfigurationList section */
};
rootObject = 97C146E61CF9000F007C117D /* Project object */;
diff --git a/packages/video_player/video_player/pubspec.yaml b/packages/video_player/video_player/pubspec.yaml
index 9a3697b..02739bb 100644
--- a/packages/video_player/video_player/pubspec.yaml
+++ b/packages/video_player/video_player/pubspec.yaml
@@ -4,6 +4,9 @@
repository: https://github.com/flutter/plugins/tree/main/packages/video_player/video_player
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+video_player%22
version: 2.2.17
+# Temporarily disable publishing to allow moving Android and iOS
+# implementations.
+publish_to: none
environment:
sdk: ">=2.14.0 <3.0.0"
@@ -13,16 +16,20 @@
plugin:
platforms:
android:
- package: io.flutter.plugins.videoplayer
- pluginClass: VideoPlayerPlugin
+ default_package: video_player_android
ios:
- pluginClass: FLTVideoPlayerPlugin
+ default_package: video_player_avfoundation
web:
default_package: video_player_web
dependencies:
flutter:
sdk: flutter
+ # Temporary path dependencies to allow moving Android and iOS implementations.
+ video_player_android:
+ path: ../video_player_android
+ video_player_avfoundation:
+ path: ../video_player_avfoundation
video_player_platform_interface: ">=4.2.0 <6.0.0"
video_player_web: ^2.0.0
html: ^0.15.0
@@ -31,4 +38,3 @@
flutter_test:
sdk: flutter
pedantic: ^1.10.0
- pigeon: ^0.1.21
diff --git a/packages/video_player/video_player_android/AUTHORS b/packages/video_player/video_player_android/AUTHORS
new file mode 100644
index 0000000..493a0b4
--- /dev/null
+++ b/packages/video_player/video_player_android/AUTHORS
@@ -0,0 +1,66 @@
+# Below is a list of people and organizations that have contributed
+# to the Flutter project. Names should be added to the list like so:
+#
+# Name/Organization <email address>
+
+Google Inc.
+The Chromium Authors
+German Saprykin <saprykin.h@gmail.com>
+Benjamin Sauer <sauer.benjamin@gmail.com>
+larsenthomasj@gmail.com
+Ali Bitek <alibitek@protonmail.ch>
+Pol Batlló <pol.batllo@gmail.com>
+Anatoly Pulyaevskiy
+Hayden Flinner <haydenflinner@gmail.com>
+Stefano Rodriguez <hlsroddy@gmail.com>
+Salvatore Giordano <salvatoregiordanoo@gmail.com>
+Brian Armstrong <brian@flutter.institute>
+Paul DeMarco <paulmdemarco@gmail.com>
+Fabricio Nogueira <feufeu@gmail.com>
+Simon Lightfoot <simon@devangels.london>
+Ashton Thomas <ashton@acrinta.com>
+Thomas Danner <thmsdnnr@gmail.com>
+Diego Velásquez <diego.velasquez.lopez@gmail.com>
+Hajime Nakamura <nkmrhj@gmail.com>
+Tuyển Vũ Xuân <netsoft1985@gmail.com>
+Miguel Ruivo <miguel@miguelruivo.com>
+Sarthak Verma <sarthak@artiosys.com>
+Mike Diarmid <mike@invertase.io>
+Invertase <oss@invertase.io>
+Elliot Hesp <elliot@invertase.io>
+Vince Varga <vince.varga@smaho.com>
+Aawaz Gyawali <awazgyawali@gmail.com>
+EUI Limited <ian.evans3@admiralgroup.co.uk>
+Katarina Sheremet <katarina@sheremet.ch>
+Thomas Stockx <thomas@stockxit.com>
+Sarbagya Dhaubanjar <sarbagyastha@gmail.com>
+Ozkan Eksi <ozeksi@gmail.com>
+Rishab Nayak <rishab@bu.edu>
+ko2ic <ko2ic.dev@gmail.com>
+Jonathan Younger <jonathan@daikini.com>
+Jose Sanchez <josesm82@gmail.com>
+Debkanchan Samadder <debu.samadder@gmail.com>
+Audrius Karosevicius <audrius.karosevicius@gmail.com>
+Lukasz Piliszczuk <lukasz@intheloup.io>
+SoundReply Solutions GmbH <ch@soundreply.com>
+Rafal Wachol <rwachol@gmail.com>
+Pau Picas <pau.picas@gmail.com>
+Christian Weder <chrstian.weder@yapeal.ch>
+Alexandru Tuca <salexandru.tuca@outlook.com>
+Christian Weder <chrstian.weder@yapeal.ch>
+Rhodes Davis Jr. <rody.davis.jr@gmail.com>
+Luigi Agosti <luigi@tengio.com>
+Quentin Le Guennec <quentin@tengio.com>
+Koushik Ravikumar <koushik@tengio.com>
+Nissim Dsilva <nissim@tengio.com>
+Giancarlo Rocha <giancarloiff@gmail.com>
+Ryo Miyake <ryo@miyake.id>
+Théo Champion <contact.theochampion@gmail.com>
+Kazuki Yamaguchi <y.kazuki0614n@gmail.com>
+Eitan Schwartz <eshvartz@gmail.com>
+Chris Rutkowski <chrisrutkowski89@gmail.com>
+Juan Alvarez <juan.alvarez@resideo.com>
+Aleksandr Yurkovskiy <sanekyy@gmail.com>
+Anton Borries <mail@antonborri.es>
+Alex Li <google@alexv525.com>
+Rahul Raj <64.rahulraj@gmail.com>
diff --git a/packages/video_player/video_player_android/CHANGELOG.md b/packages/video_player/video_player_android/CHANGELOG.md
new file mode 100644
index 0000000..626b9ef
--- /dev/null
+++ b/packages/video_player/video_player_android/CHANGELOG.md
@@ -0,0 +1,3 @@
+## 2.2.17
+
+* Splits from `video_player` as a federated implementation.
diff --git a/packages/video_player/video_player/CONTRIBUTING.md b/packages/video_player/video_player_android/CONTRIBUTING.md
similarity index 100%
rename from packages/video_player/video_player/CONTRIBUTING.md
rename to packages/video_player/video_player_android/CONTRIBUTING.md
diff --git a/packages/video_player/video_player_android/LICENSE b/packages/video_player/video_player_android/LICENSE
new file mode 100644
index 0000000..c6823b8
--- /dev/null
+++ b/packages/video_player/video_player_android/LICENSE
@@ -0,0 +1,25 @@
+Copyright 2013 The Flutter Authors. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+ * Neither the name of Google Inc. nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/packages/video_player/video_player_android/README.md b/packages/video_player/video_player_android/README.md
new file mode 100644
index 0000000..28bd66f
--- /dev/null
+++ b/packages/video_player/video_player_android/README.md
@@ -0,0 +1,11 @@
+# video\_player\_android
+
+The Android implementation of [`video_player`][1].
+
+## Usage
+
+This package is [endorsed][2], which means you can simply use `video_player`
+normally. This package will be automatically included in your app when you do.
+
+[1]: https://pub.dev/packages/video_player
+[2]: https://flutter.dev/docs/development/packages-and-plugins/developing-packages#endorsed-federated-plugin
diff --git a/packages/video_player/video_player/android/build.gradle b/packages/video_player/video_player_android/android/build.gradle
similarity index 100%
rename from packages/video_player/video_player/android/build.gradle
rename to packages/video_player/video_player_android/android/build.gradle
diff --git a/packages/video_player/video_player/android/gradle/wrapper/gradle-wrapper.properties b/packages/video_player/video_player_android/android/gradle/wrapper/gradle-wrapper.properties
similarity index 100%
rename from packages/video_player/video_player/android/gradle/wrapper/gradle-wrapper.properties
rename to packages/video_player/video_player_android/android/gradle/wrapper/gradle-wrapper.properties
diff --git a/packages/video_player/video_player_android/android/settings.gradle b/packages/video_player/video_player_android/android/settings.gradle
new file mode 100644
index 0000000..0068171
--- /dev/null
+++ b/packages/video_player/video_player_android/android/settings.gradle
@@ -0,0 +1 @@
+rootProject.name = 'video_player_android'
diff --git a/packages/video_player/video_player/android/src/main/AndroidManifest.xml b/packages/video_player/video_player_android/android/src/main/AndroidManifest.xml
similarity index 100%
rename from packages/video_player/video_player/android/src/main/AndroidManifest.xml
rename to packages/video_player/video_player_android/android/src/main/AndroidManifest.xml
diff --git a/packages/video_player/video_player/android/src/main/java/io/flutter/plugins/videoplayer/CustomSSLSocketFactory.java b/packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/CustomSSLSocketFactory.java
similarity index 100%
rename from packages/video_player/video_player/android/src/main/java/io/flutter/plugins/videoplayer/CustomSSLSocketFactory.java
rename to packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/CustomSSLSocketFactory.java
diff --git a/packages/video_player/video_player/android/src/main/java/io/flutter/plugins/videoplayer/Messages.java b/packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/Messages.java
similarity index 100%
rename from packages/video_player/video_player/android/src/main/java/io/flutter/plugins/videoplayer/Messages.java
rename to packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/Messages.java
diff --git a/packages/video_player/video_player/android/src/main/java/io/flutter/plugins/videoplayer/QueuingEventSink.java b/packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/QueuingEventSink.java
similarity index 100%
rename from packages/video_player/video_player/android/src/main/java/io/flutter/plugins/videoplayer/QueuingEventSink.java
rename to packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/QueuingEventSink.java
diff --git a/packages/video_player/video_player/android/src/main/java/io/flutter/plugins/videoplayer/VideoPlayer.java b/packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/VideoPlayer.java
similarity index 100%
rename from packages/video_player/video_player/android/src/main/java/io/flutter/plugins/videoplayer/VideoPlayer.java
rename to packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/VideoPlayer.java
diff --git a/packages/video_player/video_player/android/src/main/java/io/flutter/plugins/videoplayer/VideoPlayerOptions.java b/packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/VideoPlayerOptions.java
similarity index 100%
rename from packages/video_player/video_player/android/src/main/java/io/flutter/plugins/videoplayer/VideoPlayerOptions.java
rename to packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/VideoPlayerOptions.java
diff --git a/packages/video_player/video_player/android/src/main/java/io/flutter/plugins/videoplayer/VideoPlayerPlugin.java b/packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/VideoPlayerPlugin.java
similarity index 100%
rename from packages/video_player/video_player/android/src/main/java/io/flutter/plugins/videoplayer/VideoPlayerPlugin.java
rename to packages/video_player/video_player_android/android/src/main/java/io/flutter/plugins/videoplayer/VideoPlayerPlugin.java
diff --git a/packages/video_player/video_player/android/src/test/java/io/flutter/plugins/videoplayer/VideoPlayerTest.java b/packages/video_player/video_player_android/android/src/test/java/io/flutter/plugins/videoplayer/VideoPlayerTest.java
similarity index 100%
rename from packages/video_player/video_player/android/src/test/java/io/flutter/plugins/videoplayer/VideoPlayerTest.java
rename to packages/video_player/video_player_android/android/src/test/java/io/flutter/plugins/videoplayer/VideoPlayerTest.java
diff --git a/packages/video_player/video_player_android/example/.gitignore b/packages/video_player/video_player_android/example/.gitignore
new file mode 100644
index 0000000..d3e68fd
--- /dev/null
+++ b/packages/video_player/video_player_android/example/.gitignore
@@ -0,0 +1 @@
+lib/generated_plugin_registrant.dart
diff --git a/packages/video_player/video_player_android/example/README.md b/packages/video_player/video_player_android/example/README.md
new file mode 100644
index 0000000..8ceb0ff
--- /dev/null
+++ b/packages/video_player/video_player_android/example/README.md
@@ -0,0 +1,8 @@
+# video_player_example
+
+Demonstrates how to use the video_player plugin.
+
+## Getting Started
+
+For help getting started with Flutter, view our online
+[documentation](https://flutter.dev/).
diff --git a/packages/video_player/video_player_android/example/android/app/build.gradle b/packages/video_player/video_player_android/example/android/app/build.gradle
new file mode 100644
index 0000000..7b3c7db
--- /dev/null
+++ b/packages/video_player/video_player_android/example/android/app/build.gradle
@@ -0,0 +1,66 @@
+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 from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
+
+android {
+ compileSdkVersion 31
+
+ lintOptions {
+ disable 'InvalidPackage'
+ }
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ defaultConfig {
+ applicationId "io.flutter.plugins.videoplayerexample"
+ minSdkVersion 21
+ targetSdkVersion 29
+ versionCode flutterVersionCode.toInteger()
+ versionName flutterVersionName
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ }
+
+ 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 '../..'
+}
+
+dependencies {
+ testImplementation 'junit:junit:4.13'
+ testImplementation 'org.robolectric:robolectric:4.4'
+ testImplementation 'org.mockito:mockito-core:3.5.13'
+ androidTestImplementation 'androidx.test:runner:1.1.1'
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
+}
diff --git a/packages/video_player/video_player_android/example/android/app/gradle/wrapper/gradle-wrapper.properties b/packages/video_player/video_player_android/example/android/app/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..9a4163a
--- /dev/null
+++ b/packages/video_player/video_player_android/example/android/app/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,5 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/packages/video_player/video_player_android/example/android/app/src/androidTest/java/io/flutter/plugins/DartIntegrationTest.java b/packages/video_player/video_player_android/example/android/app/src/androidTest/java/io/flutter/plugins/DartIntegrationTest.java
new file mode 100644
index 0000000..0f4298d
--- /dev/null
+++ b/packages/video_player/video_player_android/example/android/app/src/androidTest/java/io/flutter/plugins/DartIntegrationTest.java
@@ -0,0 +1,14 @@
+// Copyright 2013 The Flutter Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package io.flutter.plugins;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface DartIntegrationTest {}
diff --git a/packages/video_player/video_player_android/example/android/app/src/androidTest/java/io/flutter/plugins/videoplayerexample/FlutterActivityTest.java b/packages/video_player/video_player_android/example/android/app/src/androidTest/java/io/flutter/plugins/videoplayerexample/FlutterActivityTest.java
new file mode 100644
index 0000000..45cf5c6
--- /dev/null
+++ b/packages/video_player/video_player_android/example/android/app/src/androidTest/java/io/flutter/plugins/videoplayerexample/FlutterActivityTest.java
@@ -0,0 +1,19 @@
+// Copyright 2013 The Flutter Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package io.flutter.plugins.videoplayerexample;
+
+import androidx.test.rule.ActivityTestRule;
+import dev.flutter.plugins.integration_test.FlutterTestRunner;
+import io.flutter.embedding.android.FlutterActivity;
+import io.flutter.plugins.DartIntegrationTest;
+import org.junit.Rule;
+import org.junit.runner.RunWith;
+
+@DartIntegrationTest
+@RunWith(FlutterTestRunner.class)
+public class FlutterActivityTest {
+ @Rule
+ public ActivityTestRule<FlutterActivity> rule = new ActivityTestRule<>(FlutterActivity.class);
+}
diff --git a/packages/video_player/video_player_android/example/android/app/src/main/AndroidManifest.xml b/packages/video_player/video_player_android/example/android/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..a2574c9
--- /dev/null
+++ b/packages/video_player/video_player_android/example/android/app/src/main/AndroidManifest.xml
@@ -0,0 +1,23 @@
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="io.flutter.plugins.videoplayerexample">
+
+ <application
+ android:icon="@mipmap/ic_launcher"
+ android:label="video_player_example"
+ android:networkSecurityConfig="@xml/network_security_config">
+ <activity
+ android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection"
+ android:hardwareAccelerated="true"
+ android:name="io.flutter.embedding.android.FlutterActivity"
+ android:theme="@style/LaunchTheme"
+ android:windowSoftInputMode="adjustResize">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="android.intent.category.LAUNCHER"/>
+ </intent-filter>
+ </activity>
+ <meta-data android:name="flutterEmbedding" android:value="2"/>
+ </application>
+
+ <uses-permission android:name="android.permission.INTERNET"/>
+</manifest>
diff --git a/packages/video_player/video_player_android/example/android/app/src/main/res/drawable/launch_background.xml b/packages/video_player/video_player_android/example/android/app/src/main/res/drawable/launch_background.xml
new file mode 100644
index 0000000..304732f
--- /dev/null
+++ b/packages/video_player/video_player_android/example/android/app/src/main/res/drawable/launch_background.xml
@@ -0,0 +1,12 @@
+<?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>
diff --git a/packages/video_player/video_player_android/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/packages/video_player/video_player_android/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..db77bb4
--- /dev/null
+++ b/packages/video_player/video_player_android/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Binary files differ
diff --git a/packages/video_player/video_player_android/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/packages/video_player/video_player_android/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..17987b7
--- /dev/null
+++ b/packages/video_player/video_player_android/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Binary files differ
diff --git a/packages/video_player/video_player_android/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/packages/video_player/video_player_android/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..09d4391
--- /dev/null
+++ b/packages/video_player/video_player_android/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Binary files differ
diff --git a/packages/video_player/video_player_android/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/packages/video_player/video_player_android/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..d5f1c8d
--- /dev/null
+++ b/packages/video_player/video_player_android/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/packages/video_player/video_player_android/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/packages/video_player/video_player_android/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 0000000..4d6372e
--- /dev/null
+++ b/packages/video_player/video_player_android/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Binary files differ
diff --git a/packages/video_player/video_player_android/example/android/app/src/main/res/values/styles.xml b/packages/video_player/video_player_android/example/android/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..5691c75
--- /dev/null
+++ b/packages/video_player/video_player_android/example/android/app/src/main/res/values/styles.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
+ <item name="android:windowBackground">@drawable/launch_background</item>
+ </style>
+</resources>
diff --git a/packages/video_player/video_player_android/example/android/app/src/main/res/xml/network_security_config.xml b/packages/video_player/video_player_android/example/android/app/src/main/res/xml/network_security_config.xml
new file mode 100644
index 0000000..043e5ce
--- /dev/null
+++ b/packages/video_player/video_player_android/example/android/app/src/main/res/xml/network_security_config.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<network-security-config>
+ <domain-config cleartextTrafficPermitted="true">
+ <domain includeSubdomains="true">www.sample-videos.com</domain>
+ <domain includeSubdomains="true">184.72.239.149</domain>
+ </domain-config>
+</network-security-config>
\ No newline at end of file
diff --git a/packages/video_player/video_player_android/example/android/app/src/test/java/io/flutter/plugins/videoplayerexample/FlutterActivityTest.java b/packages/video_player/video_player_android/example/android/app/src/test/java/io/flutter/plugins/videoplayerexample/FlutterActivityTest.java
new file mode 100644
index 0000000..434861f
--- /dev/null
+++ b/packages/video_player/video_player_android/example/android/app/src/test/java/io/flutter/plugins/videoplayerexample/FlutterActivityTest.java
@@ -0,0 +1,50 @@
+// Copyright 2013 The Flutter Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package io.flutter.plugins.videoplayerexample;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import io.flutter.embedding.engine.FlutterEngine;
+import io.flutter.embedding.engine.FlutterEngineCache;
+import io.flutter.embedding.engine.FlutterJNI;
+import io.flutter.embedding.engine.loader.FlutterLoader;
+import io.flutter.embedding.engine.plugins.FlutterPlugin;
+import io.flutter.plugins.videoplayer.VideoPlayerPlugin;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+import org.robolectric.annotation.Config;
+
+@RunWith(RobolectricTestRunner.class)
+@Config(manifest = Config.NONE)
+public class FlutterActivityTest {
+
+ @Test
+ public void disposeAllPlayers() {
+ VideoPlayerPlugin videoPlayerPlugin = spy(new VideoPlayerPlugin());
+ FlutterLoader flutterLoader = mock(FlutterLoader.class);
+ FlutterJNI flutterJNI = mock(FlutterJNI.class);
+ ArgumentCaptor<FlutterPlugin.FlutterPluginBinding> pluginBindingCaptor =
+ ArgumentCaptor.forClass(FlutterPlugin.FlutterPluginBinding.class);
+
+ when(flutterJNI.isAttached()).thenReturn(true);
+ FlutterEngine engine =
+ spy(new FlutterEngine(RuntimeEnvironment.application, flutterLoader, flutterJNI));
+ FlutterEngineCache.getInstance().put("my_flutter_engine", engine);
+
+ engine.getPlugins().add(videoPlayerPlugin);
+ verify(videoPlayerPlugin, times(1)).onAttachedToEngine(pluginBindingCaptor.capture());
+
+ engine.destroy();
+ verify(videoPlayerPlugin, times(1)).onDetachedFromEngine(pluginBindingCaptor.capture());
+ verify(videoPlayerPlugin, times(1)).initialize();
+ }
+}
diff --git a/packages/video_player/video_player_android/example/android/build.gradle b/packages/video_player/video_player_android/example/android/build.gradle
new file mode 100644
index 0000000..c21bff8
--- /dev/null
+++ b/packages/video_player/video_player_android/example/android/build.gradle
@@ -0,0 +1,29 @@
+buildscript {
+ repositories {
+ google()
+ mavenCentral()
+ }
+
+ dependencies {
+ classpath 'com.android.tools.build:gradle:7.0.1'
+ }
+}
+
+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
+}
diff --git a/packages/video_player/video_player_android/example/android/gradle.properties b/packages/video_player/video_player_android/example/android/gradle.properties
new file mode 100644
index 0000000..a673820
--- /dev/null
+++ b/packages/video_player/video_player_android/example/android/gradle.properties
@@ -0,0 +1,4 @@
+org.gradle.jvmargs=-Xmx1536M
+android.useAndroidX=true
+android.enableJetifier=true
+android.enableR8=true
diff --git a/packages/video_player/video_player_android/example/android/gradle/wrapper/gradle-wrapper.properties b/packages/video_player/video_player_android/example/android/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..b8793d3
--- /dev/null
+++ b/packages/video_player/video_player_android/example/android/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Fri Jun 23 08:50:38 CEST 2017
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
diff --git a/packages/video_player/video_player_android/example/android/settings.gradle b/packages/video_player/video_player_android/example/android/settings.gradle
new file mode 100644
index 0000000..115da6c
--- /dev/null
+++ b/packages/video_player/video_player_android/example/android/settings.gradle
@@ -0,0 +1,15 @@
+include ':app'
+
+def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
+
+def plugins = new Properties()
+def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
+if (pluginsFile.exists()) {
+ pluginsFile.withInputStream { stream -> plugins.load(stream) }
+}
+
+plugins.each { name, path ->
+ def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
+ include ":$name"
+ project(":$name").projectDir = pluginDirectory
+}
diff --git a/packages/video_player/video_player_android/example/assets/Butterfly-209.mp4 b/packages/video_player/video_player_android/example/assets/Butterfly-209.mp4
new file mode 100644
index 0000000..c848979
--- /dev/null
+++ b/packages/video_player/video_player_android/example/assets/Butterfly-209.mp4
Binary files differ
diff --git a/packages/video_player/video_player_android/example/assets/flutter-mark-square-64.png b/packages/video_player/video_player_android/example/assets/flutter-mark-square-64.png
new file mode 100644
index 0000000..56f22d5
--- /dev/null
+++ b/packages/video_player/video_player_android/example/assets/flutter-mark-square-64.png
Binary files differ
diff --git a/packages/video_player/video_player_android/example/integration_test/video_player_test.dart b/packages/video_player/video_player_android/example/integration_test/video_player_test.dart
new file mode 100644
index 0000000..b80ed74
--- /dev/null
+++ b/packages/video_player/video_player_android/example/integration_test/video_player_test.dart
@@ -0,0 +1,169 @@
+// Copyright 2013 The Flutter Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+import 'dart:async';
+import 'dart:io';
+import 'dart:typed_data';
+
+import 'package:flutter/services.dart' show rootBundle;
+import 'package:flutter_test/flutter_test.dart';
+import 'package:integration_test/integration_test.dart';
+import 'package:path_provider/path_provider.dart';
+import 'package:video_player_android/video_player_android.dart';
+// TODO(stuartmorgan): Remove the use of MiniController in tests, as that is
+// testing test code; tests should instead be written directly against the
+// platform interface. (These tests were copied from the app-facing package
+// during federation and minimally modified, which is why they currently use the
+// controller.)
+import 'package:video_player_example/mini_controller.dart';
+import 'package:video_player_platform_interface/video_player_platform_interface.dart';
+
+const Duration _playDuration = Duration(seconds: 1);
+
+const String _videoAssetKey = 'assets/Butterfly-209.mp4';
+
+// Returns the URL to load an asset from this example app as a network source.
+String getUrlForAssetAsNetworkSource(String assetKey) {
+ return 'https://github.com/flutter/plugins/blob/'
+ // This hash can be rolled forward to pick up newly-added assets.
+ 'cba393233e559c925a4daf71b06b4bb01c606762'
+ '/packages/video_player/video_player/example/'
+ '$assetKey'
+ '?raw=true';
+}
+
+void main() {
+ IntegrationTestWidgetsFlutterBinding.ensureInitialized();
+
+ late MiniController _controller;
+ tearDown(() async => _controller.dispose());
+
+ group('asset videos', () {
+ setUp(() {
+ _controller = MiniController.asset(_videoAssetKey);
+ });
+
+ testWidgets('registers expected implementation',
+ (WidgetTester tester) async {
+ AndroidVideoPlayer.registerWith();
+ expect(VideoPlayerPlatform.instance, isA<AndroidVideoPlayer>());
+ });
+
+ testWidgets('can be initialized', (WidgetTester tester) async {
+ await _controller.initialize();
+
+ expect(_controller.value.isInitialized, true);
+ expect(await _controller.position, const Duration(seconds: 0));
+ expect(_controller.value.duration,
+ const Duration(seconds: 7, milliseconds: 540));
+ });
+
+ testWidgets('can be played', (WidgetTester tester) async {
+ await _controller.initialize();
+
+ await _controller.play();
+ await tester.pumpAndSettle(_playDuration);
+
+ expect(
+ await _controller.position, greaterThan(const Duration(seconds: 0)));
+ });
+
+ testWidgets('can seek', (WidgetTester tester) async {
+ await _controller.initialize();
+
+ await _controller.seekTo(const Duration(seconds: 3));
+
+ expect(await _controller.position, const Duration(seconds: 3));
+ });
+
+ testWidgets('can be paused', (WidgetTester tester) async {
+ await _controller.initialize();
+
+ // Play for a second, then pause, and then wait a second.
+ await _controller.play();
+ await tester.pumpAndSettle(_playDuration);
+ await _controller.pause();
+ await tester.pumpAndSettle(_playDuration);
+ final Duration pausedPosition = (await _controller.position)!;
+ await tester.pumpAndSettle(_playDuration);
+
+ // Verify that we stopped playing after the pause.
+ expect(await _controller.position, pausedPosition);
+ });
+ });
+
+ group('file-based videos', () {
+ setUp(() async {
+ // Load the data from the asset.
+ final String tempDir = (await getTemporaryDirectory()).path;
+ final ByteData bytes = await rootBundle.load(_videoAssetKey);
+
+ // Write it to a file to use as a source.
+ final String filename = _videoAssetKey.split('/').last;
+ final File file = File('$tempDir/$filename');
+ await file.writeAsBytes(bytes.buffer.asInt8List());
+
+ _controller = MiniController.file(file);
+ });
+
+ testWidgets('test video player using static file() method as constructor',
+ (WidgetTester tester) async {
+ await _controller.initialize();
+
+ await _controller.play();
+ await tester.pumpAndSettle(_playDuration);
+
+ expect(
+ await _controller.position, greaterThan(const Duration(seconds: 0)));
+ });
+ });
+
+ group('network videos', () {
+ setUp(() {
+ final String videoUrl = getUrlForAssetAsNetworkSource(_videoAssetKey);
+ _controller = MiniController.network(videoUrl);
+ });
+
+ testWidgets('reports buffering status', (WidgetTester tester) async {
+ await _controller.initialize();
+
+ final Completer<void> started = Completer<void>();
+ final Completer<void> ended = Completer<void>();
+ _controller.addListener(() {
+ if (!started.isCompleted && _controller.value.isBuffering) {
+ started.complete();
+ }
+ if (started.isCompleted &&
+ !_controller.value.isBuffering &&
+ !ended.isCompleted) {
+ ended.complete();
+ }
+ });
+
+ await _controller.play();
+ await _controller.seekTo(const Duration(seconds: 5));
+ await tester.pumpAndSettle(_playDuration);
+ await _controller.pause();
+
+ expect(
+ await _controller.position, greaterThan(const Duration(seconds: 0)));
+
+ await expectLater(started.future, completes);
+ await expectLater(ended.future, completes);
+ });
+
+ testWidgets('live stream duration != 0', (WidgetTester tester) async {
+ final MiniController livestreamController = MiniController.network(
+ 'https://cph-p2p-msl.akamaized.net/hls/live/2000341/test/master.m3u8',
+ );
+ await livestreamController.initialize();
+
+ expect(livestreamController.value.isInitialized, true);
+ // Live streams should have either a positive duration or C.TIME_UNSET if the duration is unknown
+ // See https://exoplayer.dev/doc/reference/com/google/android/exoplayer2/Player.html#getDuration--
+ expect(livestreamController.value.duration,
+ (Duration duration) => duration != Duration.zero);
+ });
+ });
+}
diff --git a/packages/video_player/video_player_android/example/lib/main.dart b/packages/video_player/video_player_android/example/lib/main.dart
new file mode 100644
index 0000000..cab6eb8
--- /dev/null
+++ b/packages/video_player/video_player_android/example/lib/main.dart
@@ -0,0 +1,235 @@
+// Copyright 2013 The Flutter Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// ignore_for_file: public_member_api_docs
+
+import 'package:flutter/cupertino.dart';
+import 'package:flutter/material.dart';
+
+import 'mini_controller.dart';
+
+void main() {
+ runApp(
+ MaterialApp(
+ home: _App(),
+ ),
+ );
+}
+
+class _App extends StatelessWidget {
+ @override
+ Widget build(BuildContext context) {
+ return DefaultTabController(
+ length: 2,
+ child: Scaffold(
+ key: const ValueKey<String>('home_page'),
+ appBar: AppBar(
+ title: const Text('Video player example'),
+ bottom: const TabBar(
+ isScrollable: true,
+ tabs: <Widget>[
+ Tab(
+ icon: Icon(Icons.cloud),
+ text: 'Remote',
+ ),
+ Tab(icon: Icon(Icons.insert_drive_file), text: 'Asset'),
+ ],
+ ),
+ ),
+ body: TabBarView(
+ children: <Widget>[
+ _BumbleBeeRemoteVideo(),
+ _ButterFlyAssetVideo(),
+ ],
+ ),
+ ),
+ );
+ }
+}
+
+class _ButterFlyAssetVideo extends StatefulWidget {
+ @override
+ _ButterFlyAssetVideoState createState() => _ButterFlyAssetVideoState();
+}
+
+class _ButterFlyAssetVideoState extends State<_ButterFlyAssetVideo> {
+ late MiniController _controller;
+
+ @override
+ void initState() {
+ super.initState();
+ _controller = MiniController.asset('assets/Butterfly-209.mp4');
+
+ _controller.addListener(() {
+ setState(() {});
+ });
+ _controller.initialize().then((_) => setState(() {}));
+ _controller.play();
+ }
+
+ @override
+ void dispose() {
+ _controller.dispose();
+ super.dispose();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return SingleChildScrollView(
+ child: Column(
+ children: <Widget>[
+ Container(
+ padding: const EdgeInsets.only(top: 20.0),
+ ),
+ const Text('With assets mp4'),
+ Container(
+ padding: const EdgeInsets.all(20),
+ child: AspectRatio(
+ aspectRatio: _controller.value.aspectRatio,
+ child: Stack(
+ alignment: Alignment.bottomCenter,
+ children: <Widget>[
+ VideoPlayer(_controller),
+ _ControlsOverlay(controller: _controller),
+ VideoProgressIndicator(_controller),
+ ],
+ ),
+ ),
+ ),
+ ],
+ ),
+ );
+ }
+}
+
+class _BumbleBeeRemoteVideo extends StatefulWidget {
+ @override
+ _BumbleBeeRemoteVideoState createState() => _BumbleBeeRemoteVideoState();
+}
+
+class _BumbleBeeRemoteVideoState extends State<_BumbleBeeRemoteVideo> {
+ late MiniController _controller;
+
+ @override
+ void initState() {
+ super.initState();
+ _controller = MiniController.network(
+ 'https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4',
+ );
+
+ _controller.addListener(() {
+ setState(() {});
+ });
+ _controller.initialize();
+ }
+
+ @override
+ void dispose() {
+ _controller.dispose();
+ super.dispose();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return SingleChildScrollView(
+ child: Column(
+ children: <Widget>[
+ Container(padding: const EdgeInsets.only(top: 20.0)),
+ const Text('With remote mp4'),
+ Container(
+ padding: const EdgeInsets.all(20),
+ child: AspectRatio(
+ aspectRatio: _controller.value.aspectRatio,
+ child: Stack(
+ alignment: Alignment.bottomCenter,
+ children: <Widget>[
+ VideoPlayer(_controller),
+ _ControlsOverlay(controller: _controller),
+ VideoProgressIndicator(_controller),
+ ],
+ ),
+ ),
+ ),
+ ],
+ ),
+ );
+ }
+}
+
+class _ControlsOverlay extends StatelessWidget {
+ const _ControlsOverlay({Key? key, required this.controller})
+ : super(key: key);
+
+ static const List<double> _examplePlaybackRates = <double>[
+ 0.25,
+ 0.5,
+ 1.0,
+ 1.5,
+ 2.0,
+ 3.0,
+ 5.0,
+ 10.0,
+ ];
+
+ final MiniController controller;
+
+ @override
+ Widget build(BuildContext context) {
+ return Stack(
+ children: <Widget>[
+ AnimatedSwitcher(
+ duration: const Duration(milliseconds: 50),
+ reverseDuration: const Duration(milliseconds: 200),
+ child: controller.value.isPlaying
+ ? const SizedBox.shrink()
+ : Container(
+ color: Colors.black26,
+ child: const Center(
+ child: Icon(
+ Icons.play_arrow,
+ color: Colors.white,
+ size: 100.0,
+ semanticLabel: 'Play',
+ ),
+ ),
+ ),
+ ),
+ GestureDetector(
+ onTap: () {
+ controller.value.isPlaying ? controller.pause() : controller.play();
+ },
+ ),
+ Align(
+ alignment: Alignment.topRight,
+ child: PopupMenuButton<double>(
+ initialValue: controller.value.playbackSpeed,
+ tooltip: 'Playback speed',
+ onSelected: (double speed) {
+ controller.setPlaybackSpeed(speed);
+ },
+ itemBuilder: (BuildContext context) {
+ return <PopupMenuItem<double>>[
+ for (final double speed in _examplePlaybackRates)
+ PopupMenuItem<double>(
+ value: speed,
+ child: Text('${speed}x'),
+ )
+ ];
+ },
+ child: Padding(
+ padding: const EdgeInsets.symmetric(
+ // Using less vertical padding as the text is also longer
+ // horizontally, so it feels like it would need more spacing
+ // horizontally (matching the aspect ratio of the video).
+ vertical: 12,
+ horizontal: 16,
+ ),
+ child: Text('${controller.value.playbackSpeed}x'),
+ ),
+ ),
+ ),
+ ],
+ );
+ }
+}
diff --git a/packages/video_player/video_player_android/example/lib/mini_controller.dart b/packages/video_player/video_player_android/example/lib/mini_controller.dart
new file mode 100644
index 0000000..9bb8e90
--- /dev/null
+++ b/packages/video_player/video_player_android/example/lib/mini_controller.dart
@@ -0,0 +1,538 @@
+// Copyright 2013 The Flutter Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// TODO(stuartmorgan): Consider extracting this to a shared local (path-based)
+// package for use in all implementation packages.
+
+import 'dart:async';
+import 'dart:io';
+
+import 'package:flutter/foundation.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
+import 'package:video_player_platform_interface/video_player_platform_interface.dart';
+
+VideoPlayerPlatform? _cachedPlatform;
+
+VideoPlayerPlatform get _platform {
+ if (_cachedPlatform == null) {
+ _cachedPlatform = VideoPlayerPlatform.instance;
+ _cachedPlatform!.init();
+ }
+ return _cachedPlatform!;
+}
+
+/// The duration, current position, buffering state, error state and settings
+/// of a [MiniController].
+class VideoPlayerValue {
+ /// Constructs a video with the given values. Only [duration] is required. The
+ /// rest will initialize with default values when unset.
+ VideoPlayerValue({
+ required this.duration,
+ this.size = Size.zero,
+ this.position = Duration.zero,
+ this.buffered = const <DurationRange>[],
+ this.isInitialized = false,
+ this.isPlaying = false,
+ this.isBuffering = false,
+ this.playbackSpeed = 1.0,
+ this.errorDescription,
+ });
+
+ /// Returns an instance for a video that hasn't been loaded.
+ VideoPlayerValue.uninitialized()
+ : this(duration: Duration.zero, isInitialized: false);
+
+ /// Returns an instance with the given [errorDescription].
+ VideoPlayerValue.erroneous(String errorDescription)
+ : this(
+ duration: Duration.zero,
+ isInitialized: false,
+ errorDescription: errorDescription);
+
+ /// The total duration of the video.
+ ///
+ /// The duration is [Duration.zero] if the video hasn't been initialized.
+ final Duration duration;
+
+ /// The current playback position.
+ final Duration position;
+
+ /// The currently buffered ranges.
+ final List<DurationRange> buffered;
+
+ /// True if the video is playing. False if it's paused.
+ final bool isPlaying;
+
+ /// True if the video is currently buffering.
+ final bool isBuffering;
+
+ /// The current speed of the playback.
+ final double playbackSpeed;
+
+ /// A description of the error if present.
+ ///
+ /// If [hasError] is false this is `null`.
+ final String? errorDescription;
+
+ /// The [size] of the currently loaded video.
+ final Size size;
+
+ /// Indicates whether or not the video has been loaded and is ready to play.
+ final bool isInitialized;
+
+ /// Indicates whether or not the video is in an error state. If this is true
+ /// [errorDescription] should have information about the problem.
+ bool get hasError => errorDescription != null;
+
+ /// Returns [size.width] / [size.height].
+ ///
+ /// Will return `1.0` if:
+ /// * [isInitialized] is `false`
+ /// * [size.width], or [size.height] is equal to `0.0`
+ /// * aspect ratio would be less than or equal to `0.0`
+ double get aspectRatio {
+ if (!isInitialized || size.width == 0 || size.height == 0) {
+ return 1.0;
+ }
+ final double aspectRatio = size.width / size.height;
+ if (aspectRatio <= 0) {
+ return 1.0;
+ }
+ return aspectRatio;
+ }
+
+ /// Returns a new instance that has the same values as this current instance,
+ /// except for any overrides passed in as arguments to [copyWidth].
+ VideoPlayerValue copyWith({
+ Duration? duration,
+ Size? size,
+ Duration? position,
+ List<DurationRange>? buffered,
+ bool? isInitialized,
+ bool? isPlaying,
+ bool? isBuffering,
+ double? playbackSpeed,
+ String? errorDescription,
+ }) {
+ return VideoPlayerValue(
+ duration: duration ?? this.duration,
+ size: size ?? this.size,
+ position: position ?? this.position,
+ buffered: buffered ?? this.buffered,
+ isInitialized: isInitialized ?? this.isInitialized,
+ isPlaying: isPlaying ?? this.isPlaying,
+ isBuffering: isBuffering ?? this.isBuffering,
+ playbackSpeed: playbackSpeed ?? this.playbackSpeed,
+ errorDescription: errorDescription ?? this.errorDescription,
+ );
+ }
+}
+
+/// A very minimal version of `VideoPlayerController` for running the example
+/// without relying on `video_player`.
+class MiniController extends ValueNotifier<VideoPlayerValue> {
+ /// Constructs a [MiniController] playing a video from an asset.
+ ///
+ /// The name of the asset is given by the [dataSource] argument and must not be
+ /// null. The [package] argument must be non-null when the asset comes from a
+ /// package and null otherwise.
+ MiniController.asset(this.dataSource, {this.package})
+ : dataSourceType = DataSourceType.asset,
+ super(VideoPlayerValue(duration: Duration.zero));
+
+ /// Constructs a [MiniController] playing a video from obtained from
+ /// the network.
+ MiniController.network(this.dataSource)
+ : dataSourceType = DataSourceType.network,
+ package = null,
+ super(VideoPlayerValue(duration: Duration.zero));
+
+ /// Constructs a [MiniController] playing a video from obtained from a file.
+ MiniController.file(File file)
+ : dataSource = 'file://${file.path}',
+ dataSourceType = DataSourceType.file,
+ package = null,
+ super(VideoPlayerValue(duration: Duration.zero));
+
+ /// The URI to the video file. This will be in different formats depending on
+ /// the [DataSourceType] of the original video.
+ final String dataSource;
+
+ /// Describes the type of data source this [MiniController]
+ /// is constructed with.
+ final DataSourceType dataSourceType;
+
+ /// Only set for [asset] videos. The package that the asset was loaded from.
+ final String? package;
+
+ Timer? _timer;
+ Completer<void>? _creatingCompleter;
+ StreamSubscription<dynamic>? _eventSubscription;
+
+ /// The id of a texture that hasn't been initialized.
+ @visibleForTesting
+ static const int kUninitializedTextureId = -1;
+ int _textureId = kUninitializedTextureId;
+
+ /// This is just exposed for testing. It shouldn't be used by anyone depending
+ /// on the plugin.
+ @visibleForTesting
+ int get textureId => _textureId;
+
+ /// Attempts to open the given [dataSource] and load metadata about the video.
+ Future<void> initialize() async {
+ _creatingCompleter = Completer<void>();
+
+ late DataSource dataSourceDescription;
+ switch (dataSourceType) {
+ case DataSourceType.asset:
+ dataSourceDescription = DataSource(
+ sourceType: DataSourceType.asset,
+ asset: dataSource,
+ package: package,
+ );
+ break;
+ case DataSourceType.network:
+ dataSourceDescription = DataSource(
+ sourceType: DataSourceType.network,
+ uri: dataSource,
+ );
+ break;
+ case DataSourceType.file:
+ dataSourceDescription = DataSource(
+ sourceType: DataSourceType.file,
+ uri: dataSource,
+ );
+ break;
+ case DataSourceType.contentUri:
+ dataSourceDescription = DataSource(
+ sourceType: DataSourceType.contentUri,
+ uri: dataSource,
+ );
+ break;
+ }
+
+ _textureId = (await _platform.create(dataSourceDescription)) ??
+ kUninitializedTextureId;
+ _creatingCompleter!.complete(null);
+ final Completer<void> initializingCompleter = Completer<void>();
+
+ void eventListener(VideoEvent event) {
+ switch (event.eventType) {
+ case VideoEventType.initialized:
+ value = value.copyWith(
+ duration: event.duration,
+ size: event.size,
+ isInitialized: event.duration != null,
+ );
+ initializingCompleter.complete(null);
+ _platform.setVolume(_textureId, 1.0);
+ _platform.setLooping(_textureId, true);
+ _applyPlayPause();
+ break;
+ case VideoEventType.completed:
+ pause().then((void pauseResult) => seekTo(value.duration));
+ break;
+ case VideoEventType.bufferingUpdate:
+ value = value.copyWith(buffered: event.buffered);
+ break;
+ case VideoEventType.bufferingStart:
+ value = value.copyWith(isBuffering: true);
+ break;
+ case VideoEventType.bufferingEnd:
+ value = value.copyWith(isBuffering: false);
+ break;
+ case VideoEventType.unknown:
+ break;
+ }
+ }
+
+ void errorListener(Object obj) {
+ final PlatformException e = obj as PlatformException;
+ value = VideoPlayerValue.erroneous(e.message!);
+ _timer?.cancel();
+ if (!initializingCompleter.isCompleted) {
+ initializingCompleter.completeError(obj);
+ }
+ }
+
+ _eventSubscription = _platform
+ .videoEventsFor(_textureId)
+ .listen(eventListener, onError: errorListener);
+ return initializingCompleter.future;
+ }
+
+ @override
+ Future<void> dispose() async {
+ if (_creatingCompleter != null) {
+ await _creatingCompleter!.future;
+ _timer?.cancel();
+ await _eventSubscription?.cancel();
+ await _platform.dispose(_textureId);
+ }
+ super.dispose();
+ }
+
+ /// Starts playing the video.
+ Future<void> play() async {
+ value = value.copyWith(isPlaying: true);
+ await _applyPlayPause();
+ }
+
+ /// Pauses the video.
+ Future<void> pause() async {
+ value = value.copyWith(isPlaying: false);
+ await _applyPlayPause();
+ }
+
+ Future<void> _applyPlayPause() async {
+ _timer?.cancel();
+ if (value.isPlaying) {
+ await _platform.play(_textureId);
+
+ _timer = Timer.periodic(
+ const Duration(milliseconds: 500),
+ (Timer timer) async {
+ final Duration? newPosition = await position;
+ if (newPosition == null) {
+ return;
+ }
+ _updatePosition(newPosition);
+ },
+ );
+ await _applyPlaybackSpeed();
+ } else {
+ await _platform.pause(_textureId);
+ }
+ }
+
+ Future<void> _applyPlaybackSpeed() async {
+ if (value.isPlaying) {
+ await _platform.setPlaybackSpeed(
+ _textureId,
+ value.playbackSpeed,
+ );
+ }
+ }
+
+ /// The position in the current video.
+ Future<Duration?> get position async {
+ return await _platform.getPosition(_textureId);
+ }
+
+ /// Sets the video's current timestamp to be at [position].
+ Future<void> seekTo(Duration position) async {
+ if (position > value.duration) {
+ position = value.duration;
+ } else if (position < const Duration()) {
+ position = const Duration();
+ }
+ await _platform.seekTo(_textureId, position);
+ _updatePosition(position);
+ }
+
+ /// Sets the playback speed.
+ Future<void> setPlaybackSpeed(double speed) async {
+ value = value.copyWith(playbackSpeed: speed);
+ await _applyPlaybackSpeed();
+ }
+
+ void _updatePosition(Duration position) {
+ value = value.copyWith(position: position);
+ }
+
+ @override
+ void removeListener(VoidCallback listener) {
+ super.removeListener(listener);
+ }
+}
+
+/// Widget that displays the video controlled by [controller].
+class VideoPlayer extends StatefulWidget {
+ /// Uses the given [controller] for all video rendered in this widget.
+ const VideoPlayer(this.controller);
+
+ /// The [MiniController] responsible for the video being rendered in
+ /// this widget.
+ final MiniController controller;
+
+ @override
+ _VideoPlayerState createState() => _VideoPlayerState();
+}
+
+class _VideoPlayerState extends State<VideoPlayer> {
+ _VideoPlayerState() {
+ _listener = () {
+ final int newTextureId = widget.controller.textureId;
+ if (newTextureId != _textureId) {
+ setState(() {
+ _textureId = newTextureId;
+ });
+ }
+ };
+ }
+
+ late VoidCallback _listener;
+
+ late int _textureId;
+
+ @override
+ void initState() {
+ super.initState();
+ _textureId = widget.controller.textureId;
+ // Need to listen for initialization events since the actual texture ID
+ // becomes available after asynchronous initialization finishes.
+ widget.controller.addListener(_listener);
+ }
+
+ @override
+ void didUpdateWidget(VideoPlayer oldWidget) {
+ super.didUpdateWidget(oldWidget);
+ oldWidget.controller.removeListener(_listener);
+ _textureId = widget.controller.textureId;
+ widget.controller.addListener(_listener);
+ }
+
+ @override
+ void deactivate() {
+ super.deactivate();
+ widget.controller.removeListener(_listener);
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return _textureId == MiniController.kUninitializedTextureId
+ ? Container()
+ : _platform.buildView(_textureId);
+ }
+}
+
+class _VideoScrubber extends StatefulWidget {
+ const _VideoScrubber({
+ required this.child,
+ required this.controller,
+ });
+
+ final Widget child;
+ final MiniController controller;
+
+ @override
+ _VideoScrubberState createState() => _VideoScrubberState();
+}
+
+class _VideoScrubberState extends State<_VideoScrubber> {
+ MiniController 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);
+ }
+
+ return GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ child: widget.child,
+ onTapDown: (TapDownDetails details) {
+ if (controller.value.isInitialized) {
+ seekToRelativePosition(details.globalPosition);
+ }
+ },
+ );
+ }
+}
+
+/// Displays the play/buffering status of the video controlled by [controller].
+class VideoProgressIndicator extends StatefulWidget {
+ /// Construct an instance that displays the play/buffering status of the video
+ /// controlled by [controller].
+ const VideoProgressIndicator(this.controller);
+
+ /// The [MiniController] that actually associates a video with this
+ /// widget.
+ final MiniController controller;
+
+ @override
+ _VideoProgressIndicatorState createState() => _VideoProgressIndicatorState();
+}
+
+class _VideoProgressIndicatorState extends State<VideoProgressIndicator> {
+ _VideoProgressIndicatorState() {
+ listener = () {
+ if (mounted) {
+ setState(() {});
+ }
+ };
+ }
+
+ late VoidCallback listener;
+
+ MiniController get controller => widget.controller;
+
+ @override
+ void initState() {
+ super.initState();
+ controller.addListener(listener);
+ }
+
+ @override
+ void deactivate() {
+ controller.removeListener(listener);
+ super.deactivate();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ const Color playedColor = Color.fromRGBO(255, 0, 0, 0.7);
+ const Color bufferedColor = Color.fromRGBO(50, 50, 200, 0.2);
+ const Color backgroundColor = Color.fromRGBO(200, 200, 200, 0.5);
+
+ Widget progressIndicator;
+ if (controller.value.isInitialized) {
+ final int duration = controller.value.duration.inMilliseconds;
+ final int position = controller.value.position.inMilliseconds;
+
+ int maxBuffering = 0;
+ for (final DurationRange range in controller.value.buffered) {
+ final int end = range.end.inMilliseconds;
+ if (end > maxBuffering) {
+ maxBuffering = end;
+ }
+ }
+
+ progressIndicator = Stack(
+ fit: StackFit.passthrough,
+ children: <Widget>[
+ LinearProgressIndicator(
+ value: maxBuffering / duration,
+ valueColor: const AlwaysStoppedAnimation<Color>(bufferedColor),
+ backgroundColor: backgroundColor,
+ ),
+ LinearProgressIndicator(
+ value: position / duration,
+ valueColor: const AlwaysStoppedAnimation<Color>(playedColor),
+ backgroundColor: Colors.transparent,
+ ),
+ ],
+ );
+ } else {
+ progressIndicator = const LinearProgressIndicator(
+ value: null,
+ valueColor: AlwaysStoppedAnimation<Color>(playedColor),
+ backgroundColor: backgroundColor,
+ );
+ }
+ return _VideoScrubber(
+ child: Padding(
+ padding: const EdgeInsets.only(top: 5.0),
+ child: progressIndicator,
+ ),
+ controller: controller,
+ );
+ }
+}
diff --git a/packages/video_player/video_player_android/example/pubspec.yaml b/packages/video_player/video_player_android/example/pubspec.yaml
new file mode 100644
index 0000000..14c06f4
--- /dev/null
+++ b/packages/video_player/video_player_android/example/pubspec.yaml
@@ -0,0 +1,35 @@
+name: video_player_example
+description: Demonstrates how to use the video_player plugin.
+publish_to: none
+
+environment:
+ sdk: ">=2.12.0 <3.0.0"
+ flutter: ">=2.8.0"
+
+dependencies:
+ flutter:
+ sdk: flutter
+ video_player_android:
+ # When depending on this package from a real application you should use:
+ # video_player_android: ^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: ../
+ video_player_platform_interface: ">=4.2.0 <6.0.0"
+
+dev_dependencies:
+ flutter_driver:
+ sdk: flutter
+ flutter_test:
+ sdk: flutter
+ integration_test:
+ sdk: flutter
+ path_provider: ^2.0.6
+ test: any
+
+flutter:
+ uses-material-design: true
+ assets:
+ - assets/flutter-mark-square-64.png
+ - assets/Butterfly-209.mp4
diff --git a/packages/video_player/video_player_android/example/test_driver/integration_test.dart b/packages/video_player/video_player_android/example/test_driver/integration_test.dart
new file mode 100644
index 0000000..4f10f2a
--- /dev/null
+++ b/packages/video_player/video_player_android/example/test_driver/integration_test.dart
@@ -0,0 +1,7 @@
+// Copyright 2013 The Flutter Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+import 'package:integration_test/integration_test_driver.dart';
+
+Future<void> main() => integrationDriver();
diff --git a/packages/video_player/video_player_android/example/test_driver/video_player.dart b/packages/video_player/video_player_android/example/test_driver/video_player.dart
new file mode 100644
index 0000000..b72354e
--- /dev/null
+++ b/packages/video_player/video_player_android/example/test_driver/video_player.dart
@@ -0,0 +1,11 @@
+// Copyright 2013 The Flutter Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+import 'package:flutter_driver/driver_extension.dart';
+import 'package:video_player_example/main.dart' as app;
+
+void main() {
+ enableFlutterDriverExtension();
+ app.main();
+}
diff --git a/packages/video_player/video_player_android/lib/src/android_video_player.dart b/packages/video_player/video_player_android/lib/src/android_video_player.dart
new file mode 100644
index 0000000..adb386a
--- /dev/null
+++ b/packages/video_player/video_player_android/lib/src/android_video_player.dart
@@ -0,0 +1,173 @@
+// Copyright 2013 The Flutter Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+import 'dart:async';
+import 'dart:ui';
+
+import 'package:flutter/services.dart';
+import 'package:flutter/widgets.dart';
+import 'package:video_player_platform_interface/video_player_platform_interface.dart';
+
+import 'messages.dart';
+
+/// An Android implementation of [VideoPlayerPlatform] that uses the
+/// Pigeon-generated [VideoPlayerApi].
+class AndroidVideoPlayer extends VideoPlayerPlatform {
+ final VideoPlayerApi _api = VideoPlayerApi();
+
+ /// Registers this class as the default instance of [PathProviderPlatform].
+ static void registerWith() {
+ VideoPlayerPlatform.instance = AndroidVideoPlayer();
+ }
+
+ @override
+ Future<void> init() {
+ return _api.initialize();
+ }
+
+ @override
+ Future<void> dispose(int textureId) {
+ return _api.dispose(TextureMessage()..textureId = textureId);
+ }
+
+ @override
+ Future<int?> create(DataSource dataSource) async {
+ final CreateMessage message = CreateMessage();
+
+ switch (dataSource.sourceType) {
+ case DataSourceType.asset:
+ message.asset = dataSource.asset;
+ message.packageName = dataSource.package;
+ break;
+ case DataSourceType.network:
+ message.uri = dataSource.uri;
+ message.formatHint = _videoFormatStringMap[dataSource.formatHint];
+ message.httpHeaders = dataSource.httpHeaders;
+ break;
+ case DataSourceType.file:
+ message.uri = dataSource.uri;
+ break;
+ case DataSourceType.contentUri:
+ message.uri = dataSource.uri;
+ break;
+ }
+
+ final TextureMessage response = await _api.create(message);
+ return response.textureId;
+ }
+
+ @override
+ Future<void> setLooping(int textureId, bool looping) {
+ return _api.setLooping(LoopingMessage()
+ ..textureId = textureId
+ ..isLooping = looping);
+ }
+
+ @override
+ Future<void> play(int textureId) {
+ return _api.play(TextureMessage()..textureId = textureId);
+ }
+
+ @override
+ Future<void> pause(int textureId) {
+ return _api.pause(TextureMessage()..textureId = textureId);
+ }
+
+ @override
+ Future<void> setVolume(int textureId, double volume) {
+ return _api.setVolume(VolumeMessage()
+ ..textureId = textureId
+ ..volume = volume);
+ }
+
+ @override
+ Future<void> setPlaybackSpeed(int textureId, double speed) {
+ assert(speed > 0);
+
+ return _api.setPlaybackSpeed(PlaybackSpeedMessage()
+ ..textureId = textureId
+ ..speed = speed);
+ }
+
+ @override
+ Future<void> seekTo(int textureId, Duration position) {
+ return _api.seekTo(PositionMessage()
+ ..textureId = textureId
+ ..position = position.inMilliseconds);
+ }
+
+ @override
+ Future<Duration> getPosition(int textureId) async {
+ final PositionMessage response =
+ await _api.position(TextureMessage()..textureId = textureId);
+ return Duration(milliseconds: response.position!);
+ }
+
+ @override
+ Stream<VideoEvent> videoEventsFor(int textureId) {
+ return _eventChannelFor(textureId)
+ .receiveBroadcastStream()
+ .map((dynamic event) {
+ final Map<dynamic, dynamic> map = event as Map<dynamic, dynamic>;
+ switch (map['event']) {
+ case 'initialized':
+ return VideoEvent(
+ eventType: VideoEventType.initialized,
+ duration: Duration(milliseconds: map['duration'] as int),
+ size: Size((map['width'] as num?)?.toDouble() ?? 0.0,
+ (map['height'] as num?)?.toDouble() ?? 0.0),
+ );
+ case 'completed':
+ return VideoEvent(
+ eventType: VideoEventType.completed,
+ );
+ case 'bufferingUpdate':
+ final List<dynamic> values = map['values'] as List<dynamic>;
+
+ return VideoEvent(
+ buffered: values.map<DurationRange>(_toDurationRange).toList(),
+ eventType: VideoEventType.bufferingUpdate,
+ );
+ case 'bufferingStart':
+ return VideoEvent(eventType: VideoEventType.bufferingStart);
+ case 'bufferingEnd':
+ return VideoEvent(eventType: VideoEventType.bufferingEnd);
+ default:
+ return VideoEvent(eventType: VideoEventType.unknown);
+ }
+ });
+ }
+
+ @override
+ Widget buildView(int textureId) {
+ return Texture(textureId: textureId);
+ }
+
+ @override
+ Future<void> setMixWithOthers(bool mixWithOthers) {
+ return _api.setMixWithOthers(
+ MixWithOthersMessage()..mixWithOthers = mixWithOthers,
+ );
+ }
+
+ EventChannel _eventChannelFor(int textureId) {
+ return EventChannel('flutter.io/videoPlayer/videoEvents$textureId');
+ }
+
+ static const Map<VideoFormat, String> _videoFormatStringMap =
+ <VideoFormat, String>{
+ VideoFormat.ss: 'ss',
+ VideoFormat.hls: 'hls',
+ VideoFormat.dash: 'dash',
+ VideoFormat.other: 'other',
+ };
+
+ DurationRange _toDurationRange(dynamic value) {
+ final List<dynamic> pair = value as List<dynamic>;
+ return DurationRange(
+ Duration(milliseconds: pair[0] as int),
+ Duration(milliseconds: pair[1] as int),
+ );
+ }
+}
diff --git a/packages/video_player/video_player_android/lib/src/messages.dart b/packages/video_player/video_player_android/lib/src/messages.dart
new file mode 100644
index 0000000..831f4e3
--- /dev/null
+++ b/packages/video_player/video_player_android/lib/src/messages.dart
@@ -0,0 +1,425 @@
+// Copyright 2013 The Flutter Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Autogenerated from Pigeon (v0.1.21), do not edit directly.
+// See also: https://pub.dev/packages/pigeon
+// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, cast_nullable_to_non_nullable
+// @dart = 2.12
+import 'dart:async';
+import 'dart:typed_data' show Uint8List, Int32List, Int64List, Float64List;
+
+import 'package:flutter/services.dart';
+
+class TextureMessage {
+ int? textureId;
+
+ Object encode() {
+ final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
+ pigeonMap['textureId'] = textureId;
+ return pigeonMap;
+ }
+
+ static TextureMessage decode(Object message) {
+ final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
+ return TextureMessage()..textureId = pigeonMap['textureId'] as int?;
+ }
+}
+
+class CreateMessage {
+ String? asset;
+ String? uri;
+ String? packageName;
+ String? formatHint;
+ Map<Object?, Object?>? httpHeaders;
+
+ Object encode() {
+ final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
+ pigeonMap['asset'] = asset;
+ pigeonMap['uri'] = uri;
+ pigeonMap['packageName'] = packageName;
+ pigeonMap['formatHint'] = formatHint;
+ pigeonMap['httpHeaders'] = httpHeaders;
+ return pigeonMap;
+ }
+
+ static CreateMessage decode(Object message) {
+ final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
+ return CreateMessage()
+ ..asset = pigeonMap['asset'] as String?
+ ..uri = pigeonMap['uri'] as String?
+ ..packageName = pigeonMap['packageName'] as String?
+ ..formatHint = pigeonMap['formatHint'] as String?
+ ..httpHeaders = pigeonMap['httpHeaders'] as Map<Object?, Object?>?;
+ }
+}
+
+class LoopingMessage {
+ int? textureId;
+ bool? isLooping;
+
+ Object encode() {
+ final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
+ pigeonMap['textureId'] = textureId;
+ pigeonMap['isLooping'] = isLooping;
+ return pigeonMap;
+ }
+
+ static LoopingMessage decode(Object message) {
+ final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
+ return LoopingMessage()
+ ..textureId = pigeonMap['textureId'] as int?
+ ..isLooping = pigeonMap['isLooping'] as bool?;
+ }
+}
+
+class VolumeMessage {
+ int? textureId;
+ double? volume;
+
+ Object encode() {
+ final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
+ pigeonMap['textureId'] = textureId;
+ pigeonMap['volume'] = volume;
+ return pigeonMap;
+ }
+
+ static VolumeMessage decode(Object message) {
+ final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
+ return VolumeMessage()
+ ..textureId = pigeonMap['textureId'] as int?
+ ..volume = pigeonMap['volume'] as double?;
+ }
+}
+
+class PlaybackSpeedMessage {
+ int? textureId;
+ double? speed;
+
+ Object encode() {
+ final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
+ pigeonMap['textureId'] = textureId;
+ pigeonMap['speed'] = speed;
+ return pigeonMap;
+ }
+
+ static PlaybackSpeedMessage decode(Object message) {
+ final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
+ return PlaybackSpeedMessage()
+ ..textureId = pigeonMap['textureId'] as int?
+ ..speed = pigeonMap['speed'] as double?;
+ }
+}
+
+class PositionMessage {
+ int? textureId;
+ int? position;
+
+ Object encode() {
+ final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
+ pigeonMap['textureId'] = textureId;
+ pigeonMap['position'] = position;
+ return pigeonMap;
+ }
+
+ static PositionMessage decode(Object message) {
+ final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
+ return PositionMessage()
+ ..textureId = pigeonMap['textureId'] as int?
+ ..position = pigeonMap['position'] as int?;
+ }
+}
+
+class MixWithOthersMessage {
+ bool? mixWithOthers;
+
+ Object encode() {
+ final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
+ pigeonMap['mixWithOthers'] = mixWithOthers;
+ return pigeonMap;
+ }
+
+ static MixWithOthersMessage decode(Object message) {
+ final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
+ return MixWithOthersMessage()
+ ..mixWithOthers = pigeonMap['mixWithOthers'] as bool?;
+ }
+}
+
+class VideoPlayerApi {
+ Future<void> initialize() async {
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.initialize', StandardMessageCodec());
+ final Map<Object?, Object?>? replyMap =
+ await channel.send(null) as Map<Object?, Object?>?;
+ if (replyMap == null) {
+ throw PlatformException(
+ code: 'channel-error',
+ message: 'Unable to establish connection on channel.',
+ details: null,
+ );
+ } else if (replyMap['error'] != null) {
+ final Map<Object?, Object?> error =
+ replyMap['error'] as Map<Object?, Object?>;
+ throw PlatformException(
+ code: error['code'] as String,
+ message: error['message'] as String?,
+ details: error['details'],
+ );
+ } else {
+ // noop
+ }
+ }
+
+ Future<TextureMessage> create(CreateMessage arg) async {
+ final Object encoded = arg.encode();
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.create', StandardMessageCodec());
+ final Map<Object?, Object?>? replyMap =
+ await channel.send(encoded) as Map<Object?, Object?>?;
+ if (replyMap == null) {
+ throw PlatformException(
+ code: 'channel-error',
+ message: 'Unable to establish connection on channel.',
+ details: null,
+ );
+ } else if (replyMap['error'] != null) {
+ final Map<Object?, Object?> error =
+ replyMap['error'] as Map<Object?, Object?>;
+ throw PlatformException(
+ code: error['code'] as String,
+ message: error['message'] as String?,
+ details: error['details'],
+ );
+ } else {
+ return TextureMessage.decode(replyMap['result']!);
+ }
+ }
+
+ Future<void> dispose(TextureMessage arg) async {
+ final Object encoded = arg.encode();
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.dispose', StandardMessageCodec());
+ final Map<Object?, Object?>? replyMap =
+ await channel.send(encoded) as Map<Object?, Object?>?;
+ if (replyMap == null) {
+ throw PlatformException(
+ code: 'channel-error',
+ message: 'Unable to establish connection on channel.',
+ details: null,
+ );
+ } else if (replyMap['error'] != null) {
+ final Map<Object?, Object?> error =
+ replyMap['error'] as Map<Object?, Object?>;
+ throw PlatformException(
+ code: error['code'] as String,
+ message: error['message'] as String?,
+ details: error['details'],
+ );
+ } else {
+ // noop
+ }
+ }
+
+ Future<void> setLooping(LoopingMessage arg) async {
+ final Object encoded = arg.encode();
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.setLooping', StandardMessageCodec());
+ final Map<Object?, Object?>? replyMap =
+ await channel.send(encoded) as Map<Object?, Object?>?;
+ if (replyMap == null) {
+ throw PlatformException(
+ code: 'channel-error',
+ message: 'Unable to establish connection on channel.',
+ details: null,
+ );
+ } else if (replyMap['error'] != null) {
+ final Map<Object?, Object?> error =
+ replyMap['error'] as Map<Object?, Object?>;
+ throw PlatformException(
+ code: error['code'] as String,
+ message: error['message'] as String?,
+ details: error['details'],
+ );
+ } else {
+ // noop
+ }
+ }
+
+ Future<void> setVolume(VolumeMessage arg) async {
+ final Object encoded = arg.encode();
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.setVolume', StandardMessageCodec());
+ final Map<Object?, Object?>? replyMap =
+ await channel.send(encoded) as Map<Object?, Object?>?;
+ if (replyMap == null) {
+ throw PlatformException(
+ code: 'channel-error',
+ message: 'Unable to establish connection on channel.',
+ details: null,
+ );
+ } else if (replyMap['error'] != null) {
+ final Map<Object?, Object?> error =
+ replyMap['error'] as Map<Object?, Object?>;
+ throw PlatformException(
+ code: error['code'] as String,
+ message: error['message'] as String?,
+ details: error['details'],
+ );
+ } else {
+ // noop
+ }
+ }
+
+ Future<void> setPlaybackSpeed(PlaybackSpeedMessage arg) async {
+ final Object encoded = arg.encode();
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.setPlaybackSpeed',
+ StandardMessageCodec());
+ final Map<Object?, Object?>? replyMap =
+ await channel.send(encoded) as Map<Object?, Object?>?;
+ if (replyMap == null) {
+ throw PlatformException(
+ code: 'channel-error',
+ message: 'Unable to establish connection on channel.',
+ details: null,
+ );
+ } else if (replyMap['error'] != null) {
+ final Map<Object?, Object?> error =
+ replyMap['error'] as Map<Object?, Object?>;
+ throw PlatformException(
+ code: error['code'] as String,
+ message: error['message'] as String?,
+ details: error['details'],
+ );
+ } else {
+ // noop
+ }
+ }
+
+ Future<void> play(TextureMessage arg) async {
+ final Object encoded = arg.encode();
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.play', StandardMessageCodec());
+ final Map<Object?, Object?>? replyMap =
+ await channel.send(encoded) as Map<Object?, Object?>?;
+ if (replyMap == null) {
+ throw PlatformException(
+ code: 'channel-error',
+ message: 'Unable to establish connection on channel.',
+ details: null,
+ );
+ } else if (replyMap['error'] != null) {
+ final Map<Object?, Object?> error =
+ replyMap['error'] as Map<Object?, Object?>;
+ throw PlatformException(
+ code: error['code'] as String,
+ message: error['message'] as String?,
+ details: error['details'],
+ );
+ } else {
+ // noop
+ }
+ }
+
+ Future<PositionMessage> position(TextureMessage arg) async {
+ final Object encoded = arg.encode();
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.position', StandardMessageCodec());
+ final Map<Object?, Object?>? replyMap =
+ await channel.send(encoded) as Map<Object?, Object?>?;
+ if (replyMap == null) {
+ throw PlatformException(
+ code: 'channel-error',
+ message: 'Unable to establish connection on channel.',
+ details: null,
+ );
+ } else if (replyMap['error'] != null) {
+ final Map<Object?, Object?> error =
+ replyMap['error'] as Map<Object?, Object?>;
+ throw PlatformException(
+ code: error['code'] as String,
+ message: error['message'] as String?,
+ details: error['details'],
+ );
+ } else {
+ return PositionMessage.decode(replyMap['result']!);
+ }
+ }
+
+ Future<void> seekTo(PositionMessage arg) async {
+ final Object encoded = arg.encode();
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.seekTo', StandardMessageCodec());
+ final Map<Object?, Object?>? replyMap =
+ await channel.send(encoded) as Map<Object?, Object?>?;
+ if (replyMap == null) {
+ throw PlatformException(
+ code: 'channel-error',
+ message: 'Unable to establish connection on channel.',
+ details: null,
+ );
+ } else if (replyMap['error'] != null) {
+ final Map<Object?, Object?> error =
+ replyMap['error'] as Map<Object?, Object?>;
+ throw PlatformException(
+ code: error['code'] as String,
+ message: error['message'] as String?,
+ details: error['details'],
+ );
+ } else {
+ // noop
+ }
+ }
+
+ Future<void> pause(TextureMessage arg) async {
+ final Object encoded = arg.encode();
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.pause', StandardMessageCodec());
+ final Map<Object?, Object?>? replyMap =
+ await channel.send(encoded) as Map<Object?, Object?>?;
+ if (replyMap == null) {
+ throw PlatformException(
+ code: 'channel-error',
+ message: 'Unable to establish connection on channel.',
+ details: null,
+ );
+ } else if (replyMap['error'] != null) {
+ final Map<Object?, Object?> error =
+ replyMap['error'] as Map<Object?, Object?>;
+ throw PlatformException(
+ code: error['code'] as String,
+ message: error['message'] as String?,
+ details: error['details'],
+ );
+ } else {
+ // noop
+ }
+ }
+
+ Future<void> setMixWithOthers(MixWithOthersMessage arg) async {
+ final Object encoded = arg.encode();
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.setMixWithOthers',
+ StandardMessageCodec());
+ final Map<Object?, Object?>? replyMap =
+ await channel.send(encoded) as Map<Object?, Object?>?;
+ if (replyMap == null) {
+ throw PlatformException(
+ code: 'channel-error',
+ message: 'Unable to establish connection on channel.',
+ details: null,
+ );
+ } else if (replyMap['error'] != null) {
+ final Map<Object?, Object?> error =
+ replyMap['error'] as Map<Object?, Object?>;
+ throw PlatformException(
+ code: error['code'] as String,
+ message: error['message'] as String?,
+ details: error['details'],
+ );
+ } else {
+ // noop
+ }
+ }
+}
diff --git a/packages/video_player/video_player_android/lib/video_player_android.dart b/packages/video_player/video_player_android/lib/video_player_android.dart
new file mode 100644
index 0000000..4e06756
--- /dev/null
+++ b/packages/video_player/video_player_android/lib/video_player_android.dart
@@ -0,0 +1,5 @@
+// Copyright 2013 The Flutter Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+export 'src/android_video_player.dart';
diff --git a/packages/video_player/video_player/pigeons/messages.dart b/packages/video_player/video_player_android/pigeons/messages.dart
similarity index 91%
rename from packages/video_player/video_player/pigeons/messages.dart
rename to packages/video_player/video_player_android/pigeons/messages.dart
index e893aaa..42d9640 100644
--- a/packages/video_player/video_player/pigeons/messages.dart
+++ b/packages/video_player/video_player_android/pigeons/messages.dart
@@ -58,8 +58,8 @@
}
void configurePigeon(PigeonOptions opts) {
- opts.dartOut = '../video_player_platform_interface/lib/messages.dart';
- opts.dartTestOut = '../video_player_platform_interface/lib/test.dart';
+ opts.dartOut = 'lib/src/messages.dart';
+ opts.dartTestOut = 'test/test_api.dart';
opts.objcHeaderOut = 'ios/Classes/messages.h';
opts.objcSourceOut = 'ios/Classes/messages.m';
opts.objcOptions.prefix = 'FLT';
diff --git a/packages/video_player/video_player_android/pubspec.yaml b/packages/video_player/video_player_android/pubspec.yaml
new file mode 100644
index 0000000..423c5ad
--- /dev/null
+++ b/packages/video_player/video_player_android/pubspec.yaml
@@ -0,0 +1,28 @@
+name: video_player_android
+description: Android implementation of the video_player plugin.
+repository: https://github.com/flutter/plugins/tree/master/packages/video_player/video_player_android
+issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+video_player%22
+version: 2.2.17
+
+environment:
+ sdk: ">=2.14.0 <3.0.0"
+ flutter: ">=2.8.0"
+
+flutter:
+ plugin:
+ implements: video_player
+ platforms:
+ android:
+ dartPluginClass: AndroidVideoPlayer
+ package: io.flutter.plugins.videoplayer
+ pluginClass: VideoPlayerPlugin
+
+dependencies:
+ flutter:
+ sdk: flutter
+ video_player_platform_interface: ">=4.2.0 <6.0.0"
+
+dev_dependencies:
+ flutter_test:
+ sdk: flutter
+ pigeon: ^0.1.21
diff --git a/packages/video_player/video_player_android/test/android_video_player_test.dart b/packages/video_player/video_player_android/test/android_video_player_test.dart
new file mode 100644
index 0000000..9eac540
--- /dev/null
+++ b/packages/video_player/video_player_android/test/android_video_player_test.dart
@@ -0,0 +1,341 @@
+// Copyright 2013 The Flutter Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+import 'dart:ui';
+
+import 'package:flutter/services.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:video_player_android/src/messages.dart';
+import 'package:video_player_android/video_player_android.dart';
+import 'package:video_player_platform_interface/video_player_platform_interface.dart';
+
+import 'test_api.dart';
+
+class _ApiLogger implements TestHostVideoPlayerApi {
+ final List<String> log = <String>[];
+ TextureMessage? textureMessage;
+ CreateMessage? createMessage;
+ PositionMessage? positionMessage;
+ LoopingMessage? loopingMessage;
+ VolumeMessage? volumeMessage;
+ PlaybackSpeedMessage? playbackSpeedMessage;
+ MixWithOthersMessage? mixWithOthersMessage;
+
+ @override
+ TextureMessage create(CreateMessage arg) {
+ log.add('create');
+ createMessage = arg;
+ return TextureMessage()..textureId = 3;
+ }
+
+ @override
+ void dispose(TextureMessage arg) {
+ log.add('dispose');
+ textureMessage = arg;
+ }
+
+ @override
+ void initialize() {
+ log.add('init');
+ }
+
+ @override
+ void pause(TextureMessage arg) {
+ log.add('pause');
+ textureMessage = arg;
+ }
+
+ @override
+ void play(TextureMessage arg) {
+ log.add('play');
+ textureMessage = arg;
+ }
+
+ @override
+ void setMixWithOthers(MixWithOthersMessage arg) {
+ log.add('setMixWithOthers');
+ mixWithOthersMessage = arg;
+ }
+
+ @override
+ PositionMessage position(TextureMessage arg) {
+ log.add('position');
+ textureMessage = arg;
+ return PositionMessage()..position = 234;
+ }
+
+ @override
+ void seekTo(PositionMessage arg) {
+ log.add('seekTo');
+ positionMessage = arg;
+ }
+
+ @override
+ void setLooping(LoopingMessage arg) {
+ log.add('setLooping');
+ loopingMessage = arg;
+ }
+
+ @override
+ void setVolume(VolumeMessage arg) {
+ log.add('setVolume');
+ volumeMessage = arg;
+ }
+
+ @override
+ void setPlaybackSpeed(PlaybackSpeedMessage arg) {
+ log.add('setPlaybackSpeed');
+ playbackSpeedMessage = arg;
+ }
+}
+
+void main() {
+ TestWidgetsFlutterBinding.ensureInitialized();
+
+ test('registration', () async {
+ AndroidVideoPlayer.registerWith();
+ expect(VideoPlayerPlatform.instance, isA<AndroidVideoPlayer>());
+ });
+
+ group('$AndroidVideoPlayer', () {
+ final AndroidVideoPlayer player = AndroidVideoPlayer();
+ late _ApiLogger log;
+
+ setUp(() {
+ log = _ApiLogger();
+ TestHostVideoPlayerApi.setup(log);
+ });
+
+ test('init', () async {
+ await player.init();
+ expect(
+ log.log.last,
+ 'init',
+ );
+ });
+
+ test('dispose', () async {
+ await player.dispose(1);
+ expect(log.log.last, 'dispose');
+ expect(log.textureMessage?.textureId, 1);
+ });
+
+ test('create with asset', () async {
+ final int? textureId = await player.create(DataSource(
+ sourceType: DataSourceType.asset,
+ asset: 'someAsset',
+ package: 'somePackage',
+ ));
+ expect(log.log.last, 'create');
+ expect(log.createMessage?.asset, 'someAsset');
+ expect(log.createMessage?.packageName, 'somePackage');
+ expect(textureId, 3);
+ });
+
+ test('create with network', () async {
+ final int? textureId = await player.create(DataSource(
+ sourceType: DataSourceType.network,
+ uri: 'someUri',
+ formatHint: VideoFormat.dash,
+ ));
+ expect(log.log.last, 'create');
+ expect(log.createMessage?.asset, null);
+ expect(log.createMessage?.uri, 'someUri');
+ expect(log.createMessage?.packageName, null);
+ expect(log.createMessage?.formatHint, 'dash');
+ expect(log.createMessage?.httpHeaders, <String, String>{});
+ expect(textureId, 3);
+ });
+
+ test('create with network (some headers)', () async {
+ final int? textureId = await player.create(DataSource(
+ sourceType: DataSourceType.network,
+ uri: 'someUri',
+ httpHeaders: <String, String>{'Authorization': 'Bearer token'},
+ ));
+ expect(log.log.last, 'create');
+ expect(log.createMessage?.asset, null);
+ expect(log.createMessage?.uri, 'someUri');
+ expect(log.createMessage?.packageName, null);
+ expect(log.createMessage?.formatHint, null);
+ expect(log.createMessage?.httpHeaders,
+ <String, String>{'Authorization': 'Bearer token'});
+ expect(textureId, 3);
+ });
+
+ test('create with file', () async {
+ final int? textureId = await player.create(DataSource(
+ sourceType: DataSourceType.file,
+ uri: 'someUri',
+ ));
+ expect(log.log.last, 'create');
+ expect(log.createMessage?.uri, 'someUri');
+ expect(textureId, 3);
+ });
+
+ test('setLooping', () async {
+ await player.setLooping(1, true);
+ expect(log.log.last, 'setLooping');
+ expect(log.loopingMessage?.textureId, 1);
+ expect(log.loopingMessage?.isLooping, true);
+ });
+
+ test('play', () async {
+ await player.play(1);
+ expect(log.log.last, 'play');
+ expect(log.textureMessage?.textureId, 1);
+ });
+
+ test('pause', () async {
+ await player.pause(1);
+ expect(log.log.last, 'pause');
+ expect(log.textureMessage?.textureId, 1);
+ });
+
+ test('setMixWithOthers', () async {
+ await player.setMixWithOthers(true);
+ expect(log.log.last, 'setMixWithOthers');
+ expect(log.mixWithOthersMessage?.mixWithOthers, true);
+
+ await player.setMixWithOthers(false);
+ expect(log.log.last, 'setMixWithOthers');
+ expect(log.mixWithOthersMessage?.mixWithOthers, false);
+ });
+
+ test('setVolume', () async {
+ await player.setVolume(1, 0.7);
+ expect(log.log.last, 'setVolume');
+ expect(log.volumeMessage?.textureId, 1);
+ expect(log.volumeMessage?.volume, 0.7);
+ });
+
+ test('setPlaybackSpeed', () async {
+ await player.setPlaybackSpeed(1, 1.5);
+ expect(log.log.last, 'setPlaybackSpeed');
+ expect(log.playbackSpeedMessage?.textureId, 1);
+ expect(log.playbackSpeedMessage?.speed, 1.5);
+ });
+
+ test('seekTo', () async {
+ await player.seekTo(1, const Duration(milliseconds: 12345));
+ expect(log.log.last, 'seekTo');
+ expect(log.positionMessage?.textureId, 1);
+ expect(log.positionMessage?.position, 12345);
+ });
+
+ test('getPosition', () async {
+ final Duration position = await player.getPosition(1);
+ expect(log.log.last, 'position');
+ expect(log.textureMessage?.textureId, 1);
+ expect(position, const Duration(milliseconds: 234));
+ });
+
+ test('videoEventsFor', () async {
+ _ambiguate(ServicesBinding.instance)
+ ?.defaultBinaryMessenger
+ .setMockMessageHandler(
+ 'flutter.io/videoPlayer/videoEvents123',
+ (ByteData? message) async {
+ final MethodCall methodCall =
+ const StandardMethodCodec().decodeMethodCall(message);
+ if (methodCall.method == 'listen') {
+ await _ambiguate(ServicesBinding.instance)
+ ?.defaultBinaryMessenger
+ .handlePlatformMessage(
+ 'flutter.io/videoPlayer/videoEvents123',
+ const StandardMethodCodec()
+ .encodeSuccessEnvelope(<String, dynamic>{
+ 'event': 'initialized',
+ 'duration': 98765,
+ 'width': 1920,
+ 'height': 1080,
+ }),
+ (ByteData? data) {});
+
+ await _ambiguate(ServicesBinding.instance)
+ ?.defaultBinaryMessenger
+ .handlePlatformMessage(
+ 'flutter.io/videoPlayer/videoEvents123',
+ const StandardMethodCodec()
+ .encodeSuccessEnvelope(<String, dynamic>{
+ 'event': 'completed',
+ }),
+ (ByteData? data) {});
+
+ await _ambiguate(ServicesBinding.instance)
+ ?.defaultBinaryMessenger
+ .handlePlatformMessage(
+ 'flutter.io/videoPlayer/videoEvents123',
+ const StandardMethodCodec()
+ .encodeSuccessEnvelope(<String, dynamic>{
+ 'event': 'bufferingUpdate',
+ 'values': <List<dynamic>>[
+ <int>[0, 1234],
+ <int>[1235, 4000],
+ ],
+ }),
+ (ByteData? data) {});
+
+ await _ambiguate(ServicesBinding.instance)
+ ?.defaultBinaryMessenger
+ .handlePlatformMessage(
+ 'flutter.io/videoPlayer/videoEvents123',
+ const StandardMethodCodec()
+ .encodeSuccessEnvelope(<String, dynamic>{
+ 'event': 'bufferingStart',
+ }),
+ (ByteData? data) {});
+
+ await _ambiguate(ServicesBinding.instance)
+ ?.defaultBinaryMessenger
+ .handlePlatformMessage(
+ 'flutter.io/videoPlayer/videoEvents123',
+ const StandardMethodCodec()
+ .encodeSuccessEnvelope(<String, dynamic>{
+ 'event': 'bufferingEnd',
+ }),
+ (ByteData? data) {});
+
+ return const StandardMethodCodec().encodeSuccessEnvelope(null);
+ } else if (methodCall.method == 'cancel') {
+ return const StandardMethodCodec().encodeSuccessEnvelope(null);
+ } else {
+ fail('Expected listen or cancel');
+ }
+ },
+ );
+ expect(
+ player.videoEventsFor(123),
+ emitsInOrder(<dynamic>[
+ VideoEvent(
+ eventType: VideoEventType.initialized,
+ duration: const Duration(milliseconds: 98765),
+ size: const Size(1920, 1080),
+ ),
+ VideoEvent(eventType: VideoEventType.completed),
+ VideoEvent(
+ eventType: VideoEventType.bufferingUpdate,
+ buffered: <DurationRange>[
+ DurationRange(
+ const Duration(milliseconds: 0),
+ const Duration(milliseconds: 1234),
+ ),
+ DurationRange(
+ const Duration(milliseconds: 1235),
+ const Duration(milliseconds: 4000),
+ ),
+ ]),
+ VideoEvent(eventType: VideoEventType.bufferingStart),
+ VideoEvent(eventType: VideoEventType.bufferingEnd),
+ ]));
+ });
+ });
+}
+
+/// This allows a value of type T or T? to be treated as a value of type T?.
+///
+/// We use this so that APIs that have become non-nullable can still be used
+/// with `!` and `?` on the stable branch.
+// TODO(ianh): Remove this once we roll stable in late 2021.
+T? _ambiguate<T>(T? value) => value;
diff --git a/packages/video_player/video_player_android/test/test_api.dart b/packages/video_player/video_player_android/test/test_api.dart
new file mode 100644
index 0000000..2fbcbcf
--- /dev/null
+++ b/packages/video_player/video_player_android/test/test_api.dart
@@ -0,0 +1,200 @@
+// Copyright 2013 The Flutter Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Autogenerated from Pigeon (v0.1.21), do not edit directly.
+// See also: https://pub.dev/packages/pigeon
+// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import
+// @dart = 2.12
+import 'dart:async';
+import 'dart:typed_data' show Uint8List, Int32List, Int64List, Float64List;
+
+import 'package:flutter/services.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:video_player_android/src/messages.dart';
+
+abstract class TestHostVideoPlayerApi {
+ void initialize();
+ TextureMessage create(CreateMessage arg);
+ void dispose(TextureMessage arg);
+ void setLooping(LoopingMessage arg);
+ void setVolume(VolumeMessage arg);
+ void setPlaybackSpeed(PlaybackSpeedMessage arg);
+ void play(TextureMessage arg);
+ PositionMessage position(TextureMessage arg);
+ void seekTo(PositionMessage arg);
+ void pause(TextureMessage arg);
+ void setMixWithOthers(MixWithOthersMessage arg);
+ static void setup(TestHostVideoPlayerApi? api) {
+ {
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.initialize',
+ StandardMessageCodec());
+ if (api == null) {
+ channel.setMockMessageHandler(null);
+ } else {
+ channel.setMockMessageHandler((Object? message) async {
+ // ignore message
+ api.initialize();
+ return <Object?, Object?>{};
+ });
+ }
+ }
+ {
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.create', StandardMessageCodec());
+ if (api == null) {
+ channel.setMockMessageHandler(null);
+ } else {
+ channel.setMockMessageHandler((Object? message) async {
+ assert(message != null,
+ 'Argument for dev.flutter.pigeon.VideoPlayerApi.create was null. Expected CreateMessage.');
+ final CreateMessage input = CreateMessage.decode(message!);
+ final TextureMessage output = api.create(input);
+ return <Object?, Object?>{'result': output.encode()};
+ });
+ }
+ }
+ {
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.dispose', StandardMessageCodec());
+ if (api == null) {
+ channel.setMockMessageHandler(null);
+ } else {
+ channel.setMockMessageHandler((Object? message) async {
+ assert(message != null,
+ 'Argument for dev.flutter.pigeon.VideoPlayerApi.dispose was null. Expected TextureMessage.');
+ final TextureMessage input = TextureMessage.decode(message!);
+ api.dispose(input);
+ return <Object?, Object?>{};
+ });
+ }
+ }
+ {
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.setLooping',
+ StandardMessageCodec());
+ if (api == null) {
+ channel.setMockMessageHandler(null);
+ } else {
+ channel.setMockMessageHandler((Object? message) async {
+ assert(message != null,
+ 'Argument for dev.flutter.pigeon.VideoPlayerApi.setLooping was null. Expected LoopingMessage.');
+ final LoopingMessage input = LoopingMessage.decode(message!);
+ api.setLooping(input);
+ return <Object?, Object?>{};
+ });
+ }
+ }
+ {
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.setVolume',
+ StandardMessageCodec());
+ if (api == null) {
+ channel.setMockMessageHandler(null);
+ } else {
+ channel.setMockMessageHandler((Object? message) async {
+ assert(message != null,
+ 'Argument for dev.flutter.pigeon.VideoPlayerApi.setVolume was null. Expected VolumeMessage.');
+ final VolumeMessage input = VolumeMessage.decode(message!);
+ api.setVolume(input);
+ return <Object?, Object?>{};
+ });
+ }
+ }
+ {
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.setPlaybackSpeed',
+ StandardMessageCodec());
+ if (api == null) {
+ channel.setMockMessageHandler(null);
+ } else {
+ channel.setMockMessageHandler((Object? message) async {
+ assert(message != null,
+ 'Argument for dev.flutter.pigeon.VideoPlayerApi.setPlaybackSpeed was null. Expected PlaybackSpeedMessage.');
+ final PlaybackSpeedMessage input =
+ PlaybackSpeedMessage.decode(message!);
+ api.setPlaybackSpeed(input);
+ return <Object?, Object?>{};
+ });
+ }
+ }
+ {
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.play', StandardMessageCodec());
+ if (api == null) {
+ channel.setMockMessageHandler(null);
+ } else {
+ channel.setMockMessageHandler((Object? message) async {
+ assert(message != null,
+ 'Argument for dev.flutter.pigeon.VideoPlayerApi.play was null. Expected TextureMessage.');
+ final TextureMessage input = TextureMessage.decode(message!);
+ api.play(input);
+ return <Object?, Object?>{};
+ });
+ }
+ }
+ {
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.position', StandardMessageCodec());
+ if (api == null) {
+ channel.setMockMessageHandler(null);
+ } else {
+ channel.setMockMessageHandler((Object? message) async {
+ assert(message != null,
+ 'Argument for dev.flutter.pigeon.VideoPlayerApi.position was null. Expected TextureMessage.');
+ final TextureMessage input = TextureMessage.decode(message!);
+ final PositionMessage output = api.position(input);
+ return <Object?, Object?>{'result': output.encode()};
+ });
+ }
+ }
+ {
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.seekTo', StandardMessageCodec());
+ if (api == null) {
+ channel.setMockMessageHandler(null);
+ } else {
+ channel.setMockMessageHandler((Object? message) async {
+ assert(message != null,
+ 'Argument for dev.flutter.pigeon.VideoPlayerApi.seekTo was null. Expected PositionMessage.');
+ final PositionMessage input = PositionMessage.decode(message!);
+ api.seekTo(input);
+ return <Object?, Object?>{};
+ });
+ }
+ }
+ {
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.pause', StandardMessageCodec());
+ if (api == null) {
+ channel.setMockMessageHandler(null);
+ } else {
+ channel.setMockMessageHandler((Object? message) async {
+ assert(message != null,
+ 'Argument for dev.flutter.pigeon.VideoPlayerApi.pause was null. Expected TextureMessage.');
+ final TextureMessage input = TextureMessage.decode(message!);
+ api.pause(input);
+ return <Object?, Object?>{};
+ });
+ }
+ }
+ {
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.setMixWithOthers',
+ StandardMessageCodec());
+ if (api == null) {
+ channel.setMockMessageHandler(null);
+ } else {
+ channel.setMockMessageHandler((Object? message) async {
+ assert(message != null,
+ 'Argument for dev.flutter.pigeon.VideoPlayerApi.setMixWithOthers was null. Expected MixWithOthersMessage.');
+ final MixWithOthersMessage input =
+ MixWithOthersMessage.decode(message!);
+ api.setMixWithOthers(input);
+ return <Object?, Object?>{};
+ });
+ }
+ }
+ }
+}
diff --git a/packages/video_player/video_player_avfoundation/AUTHORS b/packages/video_player/video_player_avfoundation/AUTHORS
new file mode 100644
index 0000000..493a0b4
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/AUTHORS
@@ -0,0 +1,66 @@
+# Below is a list of people and organizations that have contributed
+# to the Flutter project. Names should be added to the list like so:
+#
+# Name/Organization <email address>
+
+Google Inc.
+The Chromium Authors
+German Saprykin <saprykin.h@gmail.com>
+Benjamin Sauer <sauer.benjamin@gmail.com>
+larsenthomasj@gmail.com
+Ali Bitek <alibitek@protonmail.ch>
+Pol Batlló <pol.batllo@gmail.com>
+Anatoly Pulyaevskiy
+Hayden Flinner <haydenflinner@gmail.com>
+Stefano Rodriguez <hlsroddy@gmail.com>
+Salvatore Giordano <salvatoregiordanoo@gmail.com>
+Brian Armstrong <brian@flutter.institute>
+Paul DeMarco <paulmdemarco@gmail.com>
+Fabricio Nogueira <feufeu@gmail.com>
+Simon Lightfoot <simon@devangels.london>
+Ashton Thomas <ashton@acrinta.com>
+Thomas Danner <thmsdnnr@gmail.com>
+Diego Velásquez <diego.velasquez.lopez@gmail.com>
+Hajime Nakamura <nkmrhj@gmail.com>
+Tuyển Vũ Xuân <netsoft1985@gmail.com>
+Miguel Ruivo <miguel@miguelruivo.com>
+Sarthak Verma <sarthak@artiosys.com>
+Mike Diarmid <mike@invertase.io>
+Invertase <oss@invertase.io>
+Elliot Hesp <elliot@invertase.io>
+Vince Varga <vince.varga@smaho.com>
+Aawaz Gyawali <awazgyawali@gmail.com>
+EUI Limited <ian.evans3@admiralgroup.co.uk>
+Katarina Sheremet <katarina@sheremet.ch>
+Thomas Stockx <thomas@stockxit.com>
+Sarbagya Dhaubanjar <sarbagyastha@gmail.com>
+Ozkan Eksi <ozeksi@gmail.com>
+Rishab Nayak <rishab@bu.edu>
+ko2ic <ko2ic.dev@gmail.com>
+Jonathan Younger <jonathan@daikini.com>
+Jose Sanchez <josesm82@gmail.com>
+Debkanchan Samadder <debu.samadder@gmail.com>
+Audrius Karosevicius <audrius.karosevicius@gmail.com>
+Lukasz Piliszczuk <lukasz@intheloup.io>
+SoundReply Solutions GmbH <ch@soundreply.com>
+Rafal Wachol <rwachol@gmail.com>
+Pau Picas <pau.picas@gmail.com>
+Christian Weder <chrstian.weder@yapeal.ch>
+Alexandru Tuca <salexandru.tuca@outlook.com>
+Christian Weder <chrstian.weder@yapeal.ch>
+Rhodes Davis Jr. <rody.davis.jr@gmail.com>
+Luigi Agosti <luigi@tengio.com>
+Quentin Le Guennec <quentin@tengio.com>
+Koushik Ravikumar <koushik@tengio.com>
+Nissim Dsilva <nissim@tengio.com>
+Giancarlo Rocha <giancarloiff@gmail.com>
+Ryo Miyake <ryo@miyake.id>
+Théo Champion <contact.theochampion@gmail.com>
+Kazuki Yamaguchi <y.kazuki0614n@gmail.com>
+Eitan Schwartz <eshvartz@gmail.com>
+Chris Rutkowski <chrisrutkowski89@gmail.com>
+Juan Alvarez <juan.alvarez@resideo.com>
+Aleksandr Yurkovskiy <sanekyy@gmail.com>
+Anton Borries <mail@antonborri.es>
+Alex Li <google@alexv525.com>
+Rahul Raj <64.rahulraj@gmail.com>
diff --git a/packages/video_player/video_player_avfoundation/CHANGELOG.md b/packages/video_player/video_player_avfoundation/CHANGELOG.md
new file mode 100644
index 0000000..626b9ef
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/CHANGELOG.md
@@ -0,0 +1,3 @@
+## 2.2.17
+
+* Splits from `video_player` as a federated implementation.
diff --git a/packages/video_player/video_player/CONTRIBUTING.md b/packages/video_player/video_player_avfoundation/CONTRIBUTING.md
similarity index 100%
copy from packages/video_player/video_player/CONTRIBUTING.md
copy to packages/video_player/video_player_avfoundation/CONTRIBUTING.md
diff --git a/packages/video_player/video_player_avfoundation/LICENSE b/packages/video_player/video_player_avfoundation/LICENSE
new file mode 100644
index 0000000..c6823b8
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/LICENSE
@@ -0,0 +1,25 @@
+Copyright 2013 The Flutter Authors. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+ * Neither the name of Google Inc. nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/packages/video_player/video_player_avfoundation/README.md b/packages/video_player/video_player_avfoundation/README.md
new file mode 100644
index 0000000..97e028c
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/README.md
@@ -0,0 +1,11 @@
+# video\_player\_avfoundation
+
+The iOS implementation of [`video_player`][1].
+
+## Usage
+
+This package is [endorsed][2], which means you can simply use `video_player`
+normally. This package will be automatically included in your app when you do.
+
+[1]: https://pub.dev/packages/video_player
+[2]: https://flutter.dev/docs/development/packages-and-plugins/developing-packages#endorsed-federated-plugin
diff --git a/packages/video_player/video_player_avfoundation/example/.gitignore b/packages/video_player/video_player_avfoundation/example/.gitignore
new file mode 100644
index 0000000..d3e68fd
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/.gitignore
@@ -0,0 +1 @@
+lib/generated_plugin_registrant.dart
diff --git a/packages/video_player/video_player_avfoundation/example/README.md b/packages/video_player/video_player_avfoundation/example/README.md
new file mode 100644
index 0000000..8ceb0ff
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/README.md
@@ -0,0 +1,8 @@
+# video_player_example
+
+Demonstrates how to use the video_player plugin.
+
+## Getting Started
+
+For help getting started with Flutter, view our online
+[documentation](https://flutter.dev/).
diff --git a/packages/video_player/video_player_avfoundation/example/assets/Butterfly-209.mp4 b/packages/video_player/video_player_avfoundation/example/assets/Butterfly-209.mp4
new file mode 100644
index 0000000..c848979
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/assets/Butterfly-209.mp4
Binary files differ
diff --git a/packages/video_player/video_player_avfoundation/example/assets/flutter-mark-square-64.png b/packages/video_player/video_player_avfoundation/example/assets/flutter-mark-square-64.png
new file mode 100644
index 0000000..56f22d5
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/assets/flutter-mark-square-64.png
Binary files differ
diff --git a/packages/video_player/video_player_avfoundation/example/integration_test/video_player_test.dart b/packages/video_player/video_player_avfoundation/example/integration_test/video_player_test.dart
new file mode 100644
index 0000000..a457d92
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/integration_test/video_player_test.dart
@@ -0,0 +1,181 @@
+// Copyright 2013 The Flutter Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+import 'dart:async';
+import 'dart:io';
+import 'dart:typed_data';
+
+import 'package:flutter/services.dart' show rootBundle;
+import 'package:flutter_test/flutter_test.dart';
+import 'package:integration_test/integration_test.dart';
+import 'package:path_provider/path_provider.dart';
+import 'package:video_player_avfoundation/video_player_avfoundation.dart';
+// TODO(stuartmorgan): Remove the use of MiniController in tests, as that is
+// testing test code; tests should instead be written directly against the
+// platform interface. (These tests were copied from the app-facing package
+// during federation and minimally modified, which is why they currently use the
+// controller.)
+import 'package:video_player_example/mini_controller.dart';
+import 'package:video_player_platform_interface/video_player_platform_interface.dart';
+
+const Duration _playDuration = Duration(seconds: 1);
+
+const String _videoAssetKey = 'assets/Butterfly-209.mp4';
+
+// Returns the URL to load an asset from this example app as a network source.
+String getUrlForAssetAsNetworkSource(String assetKey) {
+ return 'https://github.com/flutter/plugins/blob/'
+ // This hash can be rolled forward to pick up newly-added assets.
+ 'cba393233e559c925a4daf71b06b4bb01c606762'
+ '/packages/video_player/video_player/example/'
+ '$assetKey'
+ '?raw=true';
+}
+
+void main() {
+ IntegrationTestWidgetsFlutterBinding.ensureInitialized();
+
+ late MiniController _controller;
+ tearDown(() async => _controller.dispose());
+
+ group('asset videos', () {
+ setUp(() {
+ _controller = MiniController.asset(_videoAssetKey);
+ });
+
+ testWidgets('registers expected implementation',
+ (WidgetTester tester) async {
+ AVFoundationVideoPlayer.registerWith();
+ expect(VideoPlayerPlatform.instance, isA<AVFoundationVideoPlayer>());
+ });
+
+ testWidgets('can be initialized', (WidgetTester tester) async {
+ await _controller.initialize();
+
+ expect(_controller.value.isInitialized, true);
+ expect(await _controller.position, const Duration(seconds: 0));
+ expect(_controller.value.duration,
+ const Duration(seconds: 7, milliseconds: 540));
+ });
+
+ testWidgets('can be played', (WidgetTester tester) async {
+ await _controller.initialize();
+
+ await _controller.play();
+ await tester.pumpAndSettle(_playDuration);
+
+ expect(
+ await _controller.position, greaterThan(const Duration(seconds: 0)));
+ });
+
+ testWidgets('can seek', (WidgetTester tester) async {
+ await _controller.initialize();
+
+ await _controller.seekTo(const Duration(seconds: 3));
+
+ // TODO(stuartmorgan): Switch to _controller.position once seekTo is
+ // fixed on the native side to wait for completion, so this is testing
+ // the native code rather than the MiniController position cache.
+ expect(_controller.value.position, const Duration(seconds: 3));
+ });
+
+ testWidgets('can be paused', (WidgetTester tester) async {
+ await _controller.initialize();
+
+ // Play for a second, then pause, and then wait a second.
+ await _controller.play();
+ await tester.pumpAndSettle(_playDuration);
+ await _controller.pause();
+ final Duration pausedPosition = (await _controller.position)!;
+ await tester.pumpAndSettle(_playDuration);
+
+ // Verify that we stopped playing after the pause.
+ // TODO(stuartmorgan): Investigate why this has a slight discrepency, and
+ // fix it if possible. Is AVPlayer's pause method internally async?
+ const Duration allowableDelta = Duration(milliseconds: 10);
+ expect(await _controller.position,
+ lessThan(pausedPosition + allowableDelta));
+ });
+ });
+
+ group('file-based videos', () {
+ setUp(() async {
+ // Load the data from the asset.
+ final String tempDir = (await getTemporaryDirectory()).path;
+ final ByteData bytes = await rootBundle.load(_videoAssetKey);
+
+ // Write it to a file to use as a source.
+ final String filename = _videoAssetKey.split('/').last;
+ final File file = File('$tempDir/$filename');
+ await file.writeAsBytes(bytes.buffer.asInt8List());
+
+ _controller = MiniController.file(file);
+ });
+
+ testWidgets('test video player using static file() method as constructor',
+ (WidgetTester tester) async {
+ await _controller.initialize();
+
+ await _controller.play();
+ await tester.pumpAndSettle(_playDuration);
+
+ expect(
+ await _controller.position, greaterThan(const Duration(seconds: 0)));
+ });
+ });
+
+ group('network videos', () {
+ setUp(() {
+ final String videoUrl = getUrlForAssetAsNetworkSource(_videoAssetKey);
+ _controller = MiniController.network(videoUrl);
+ });
+
+ testWidgets('reports buffering status', (WidgetTester tester) async {
+ await _controller.initialize();
+
+ final Completer<void> started = Completer<void>();
+ final Completer<void> ended = Completer<void>();
+ _controller.addListener(() {
+ if (!started.isCompleted && _controller.value.isBuffering) {
+ started.complete();
+ }
+ if (started.isCompleted &&
+ !_controller.value.isBuffering &&
+ !ended.isCompleted) {
+ ended.complete();
+ }
+ });
+
+ await _controller.play();
+ await _controller.seekTo(const Duration(seconds: 5));
+ await tester.pumpAndSettle(_playDuration);
+ await _controller.pause();
+
+ // TODO(stuartmorgan): Switch to _controller.position once seekTo is
+ // fixed on the native side to wait for completion, so this is testing
+ // the native code rather than the MiniController position cache.
+ expect(
+ _controller.value.position, greaterThan(const Duration(seconds: 0)));
+
+ await expectLater(started.future, completes);
+ await expectLater(ended.future, completes);
+ },
+ // TODO(stuartmorgan): Skipped on iOS without explanation in main
+ // package. Needs investigation.
+ skip: true);
+
+ testWidgets('live stream duration != 0', (WidgetTester tester) async {
+ final MiniController livestreamController = MiniController.network(
+ 'https://cph-p2p-msl.akamaized.net/hls/live/2000341/test/master.m3u8',
+ );
+ await livestreamController.initialize();
+
+ expect(livestreamController.value.isInitialized, true);
+ // Live streams should have either a positive duration or C.TIME_UNSET if the duration is unknown
+ // See https://exoplayer.dev/doc/reference/com/google/android/exoplayer2/Player.html#getDuration--
+ expect(livestreamController.value.duration,
+ (Duration duration) => duration != Duration.zero);
+ });
+ });
+}
diff --git a/packages/video_player/video_player_avfoundation/example/ios/Flutter/AppFrameworkInfo.plist b/packages/video_player/video_player_avfoundation/example/ios/Flutter/AppFrameworkInfo.plist
new file mode 100644
index 0000000..3a9c234
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/ios/Flutter/AppFrameworkInfo.plist
@@ -0,0 +1,30 @@
+<?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>UIRequiredDeviceCapabilities</key>
+ <array>
+ <string>arm64</string>
+ </array>
+ <key>MinimumOSVersion</key>
+ <string>9.0</string>
+</dict>
+</plist>
diff --git a/packages/video_player/video_player_avfoundation/example/ios/Flutter/Debug.xcconfig b/packages/video_player/video_player_avfoundation/example/ios/Flutter/Debug.xcconfig
new file mode 100644
index 0000000..e8efba1
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/ios/Flutter/Debug.xcconfig
@@ -0,0 +1,2 @@
+#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
+#include "Generated.xcconfig"
diff --git a/packages/video_player/video_player_avfoundation/example/ios/Flutter/Release.xcconfig b/packages/video_player/video_player_avfoundation/example/ios/Flutter/Release.xcconfig
new file mode 100644
index 0000000..399e934
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/ios/Flutter/Release.xcconfig
@@ -0,0 +1,2 @@
+#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
+#include "Generated.xcconfig"
diff --git a/packages/video_player/video_player_avfoundation/example/ios/Podfile b/packages/video_player/video_player_avfoundation/example/ios/Podfile
new file mode 100644
index 0000000..fe37427
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/ios/Podfile
@@ -0,0 +1,42 @@
+# Uncomment this line to define a global platform for your project
+# platform :ios, '9.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__))
+ target 'RunnerTests' do
+ inherit! :search_paths
+ pod 'OCMock', '3.5'
+ end
+end
+
+post_install do |installer|
+ installer.pods_project.targets.each do |target|
+ flutter_additional_ios_build_settings(target)
+ end
+end
diff --git a/packages/video_player/video_player_avfoundation/example/ios/Runner.xcodeproj/project.pbxproj b/packages/video_player/video_player_avfoundation/example/ios/Runner.xcodeproj/project.pbxproj
new file mode 100644
index 0000000..d19d578
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/ios/Runner.xcodeproj/project.pbxproj
@@ -0,0 +1,717 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 50;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
+ 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
+ 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
+ 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; };
+ 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
+ 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
+ 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
+ B0F5C77B94E32FB72444AE9F /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 20721C28387E1F78689EC502 /* libPods-Runner.a */; };
+ D182ECB59C06DBC7E2D5D913 /* libPods-RunnerTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7BD232FD3BD3343A5F52AF50 /* libPods-RunnerTests.a */; };
+ F7151F2F26603EBD0028CB91 /* VideoPlayerUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = F7151F2E26603EBD0028CB91 /* VideoPlayerUITests.m */; };
+ F7151F3D26603ECA0028CB91 /* VideoPlayerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F7151F3C26603ECA0028CB91 /* VideoPlayerTests.m */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+ F7151F3126603EBD0028CB91 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 97C146E61CF9000F007C117D /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 97C146ED1CF9000F007C117D;
+ remoteInfo = Runner;
+ };
+ F7151F3F26603ECA0028CB91 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 97C146E61CF9000F007C117D /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 97C146ED1CF9000F007C117D;
+ remoteInfo = Runner;
+ };
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+ 9705A1C41CF9048500538489 /* Embed Frameworks */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 2147483647;
+ dstPath = "";
+ dstSubfolderSpec = 10;
+ files = (
+ );
+ name = "Embed Frameworks";
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
+ 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
+ 20721C28387E1F78689EC502 /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; };
+ 2A2EA522BDC492279A91AB75 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = "<group>"; };
+ 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
+ 6CDC4DA5940705A6E7671616 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = "<group>"; };
+ 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
+ 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
+ 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
+ 7BD232FD3BD3343A5F52AF50 /* libPods-RunnerTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RunnerTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
+ 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
+ 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
+ 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
+ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
+ 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
+ 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+ B15EC39F4617FE1082B18834 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
+ C18C242FF01156F58C0DAF1C /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
+ F7151F2C26603EBD0028CB91 /* RunnerUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
+ F7151F2E26603EBD0028CB91 /* VideoPlayerUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VideoPlayerUITests.m; sourceTree = "<group>"; };
+ F7151F3026603EBD0028CB91 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+ F7151F3A26603ECA0028CB91 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
+ F7151F3C26603ECA0028CB91 /* VideoPlayerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VideoPlayerTests.m; sourceTree = "<group>"; };
+ F7151F3E26603ECA0028CB91 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 97C146EB1CF9000F007C117D /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ B0F5C77B94E32FB72444AE9F /* libPods-Runner.a in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ F7151F2926603EBD0028CB91 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ F7151F3726603ECA0028CB91 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ D182ECB59C06DBC7E2D5D913 /* libPods-RunnerTests.a in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 05E898481BC29A7FA83AA441 /* Pods */ = {
+ isa = PBXGroup;
+ children = (
+ C18C242FF01156F58C0DAF1C /* Pods-Runner.debug.xcconfig */,
+ B15EC39F4617FE1082B18834 /* Pods-Runner.release.xcconfig */,
+ 6CDC4DA5940705A6E7671616 /* Pods-RunnerTests.debug.xcconfig */,
+ 2A2EA522BDC492279A91AB75 /* Pods-RunnerTests.release.xcconfig */,
+ );
+ name = Pods;
+ sourceTree = "<group>";
+ };
+ 23104BB9DCF267F65AD246F9 /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 20721C28387E1F78689EC502 /* libPods-Runner.a */,
+ 7BD232FD3BD3343A5F52AF50 /* libPods-RunnerTests.a */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+ 9740EEB11CF90186004384FC /* Flutter */ = {
+ isa = PBXGroup;
+ children = (
+ 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
+ 9740EEB21CF90195004384FC /* Debug.xcconfig */,
+ 7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
+ 9740EEB31CF90195004384FC /* Generated.xcconfig */,
+ );
+ name = Flutter;
+ sourceTree = "<group>";
+ };
+ 97C146E51CF9000F007C117D = {
+ isa = PBXGroup;
+ children = (
+ 9740EEB11CF90186004384FC /* Flutter */,
+ 97C146F01CF9000F007C117D /* Runner */,
+ F7151F3B26603ECA0028CB91 /* RunnerTests */,
+ F7151F2D26603EBD0028CB91 /* RunnerUITests */,
+ 97C146EF1CF9000F007C117D /* Products */,
+ 05E898481BC29A7FA83AA441 /* Pods */,
+ 23104BB9DCF267F65AD246F9 /* Frameworks */,
+ );
+ sourceTree = "<group>";
+ };
+ 97C146EF1CF9000F007C117D /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 97C146EE1CF9000F007C117D /* Runner.app */,
+ F7151F2C26603EBD0028CB91 /* RunnerUITests.xctest */,
+ F7151F3A26603ECA0028CB91 /* RunnerTests.xctest */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 97C146F01CF9000F007C117D /* Runner */ = {
+ isa = PBXGroup;
+ children = (
+ 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */,
+ 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */,
+ 97C146FA1CF9000F007C117D /* Main.storyboard */,
+ 97C146FD1CF9000F007C117D /* Assets.xcassets */,
+ 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
+ 97C147021CF9000F007C117D /* Info.plist */,
+ 97C146F11CF9000F007C117D /* Supporting Files */,
+ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
+ 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
+ );
+ path = Runner;
+ sourceTree = "<group>";
+ };
+ 97C146F11CF9000F007C117D /* Supporting Files */ = {
+ isa = PBXGroup;
+ children = (
+ 97C146F21CF9000F007C117D /* main.m */,
+ );
+ name = "Supporting Files";
+ sourceTree = "<group>";
+ };
+ F7151F2D26603EBD0028CB91 /* RunnerUITests */ = {
+ isa = PBXGroup;
+ children = (
+ F7151F2E26603EBD0028CB91 /* VideoPlayerUITests.m */,
+ F7151F3026603EBD0028CB91 /* Info.plist */,
+ );
+ path = RunnerUITests;
+ sourceTree = "<group>";
+ };
+ F7151F3B26603ECA0028CB91 /* RunnerTests */ = {
+ isa = PBXGroup;
+ children = (
+ F7151F3C26603ECA0028CB91 /* VideoPlayerTests.m */,
+ F7151F3E26603ECA0028CB91 /* Info.plist */,
+ );
+ path = RunnerTests;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 97C146ED1CF9000F007C117D /* Runner */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
+ buildPhases = (
+ F31A669BD45D5A7C940BF077 /* [CP] Check Pods Manifest.lock */,
+ 9740EEB61CF901F6004384FC /* Run Script */,
+ 97C146EA1CF9000F007C117D /* Sources */,
+ 97C146EB1CF9000F007C117D /* Frameworks */,
+ 97C146EC1CF9000F007C117D /* Resources */,
+ 9705A1C41CF9048500538489 /* Embed Frameworks */,
+ 3B06AD1E1E4923F5004D2608 /* Thin Binary */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = Runner;
+ productName = Runner;
+ productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
+ productType = "com.apple.product-type.application";
+ };
+ F7151F2B26603EBD0028CB91 /* RunnerUITests */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = F7151F3526603EBD0028CB91 /* Build configuration list for PBXNativeTarget "RunnerUITests" */;
+ buildPhases = (
+ F7151F2826603EBD0028CB91 /* Sources */,
+ F7151F2926603EBD0028CB91 /* Frameworks */,
+ F7151F2A26603EBD0028CB91 /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ F7151F3226603EBD0028CB91 /* PBXTargetDependency */,
+ );
+ name = RunnerUITests;
+ productName = RunnerUITests;
+ productReference = F7151F2C26603EBD0028CB91 /* RunnerUITests.xctest */;
+ productType = "com.apple.product-type.bundle.ui-testing";
+ };
+ F7151F3926603ECA0028CB91 /* RunnerTests */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = F7151F4126603ECB0028CB91 /* Build configuration list for PBXNativeTarget "RunnerTests" */;
+ buildPhases = (
+ E9F7B01F913C69934A6629F6 /* [CP] Check Pods Manifest.lock */,
+ F7151F3626603ECA0028CB91 /* Sources */,
+ F7151F3726603ECA0028CB91 /* Frameworks */,
+ F7151F3826603ECA0028CB91 /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ F7151F4026603ECA0028CB91 /* PBXTargetDependency */,
+ );
+ name = RunnerTests;
+ productName = RunnerTests;
+ productReference = F7151F3A26603ECA0028CB91 /* RunnerTests.xctest */;
+ productType = "com.apple.product-type.bundle.unit-test";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 97C146E61CF9000F007C117D /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ LastUpgradeCheck = 1300;
+ ORGANIZATIONNAME = "The Flutter Authors";
+ TargetAttributes = {
+ 97C146ED1CF9000F007C117D = {
+ CreatedOnToolsVersion = 7.3.1;
+ };
+ F7151F2B26603EBD0028CB91 = {
+ CreatedOnToolsVersion = 12.5;
+ ProvisioningStyle = Automatic;
+ TestTargetID = 97C146ED1CF9000F007C117D;
+ };
+ F7151F3926603ECA0028CB91 = {
+ CreatedOnToolsVersion = 12.5;
+ ProvisioningStyle = Automatic;
+ TestTargetID = 97C146ED1CF9000F007C117D;
+ };
+ };
+ };
+ buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = en;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ Base,
+ );
+ mainGroup = 97C146E51CF9000F007C117D;
+ productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 97C146ED1CF9000F007C117D /* Runner */,
+ F7151F3926603ECA0028CB91 /* RunnerTests */,
+ F7151F2B26603EBD0028CB91 /* RunnerUITests */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 97C146EC1CF9000F007C117D /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
+ 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
+ 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
+ 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ F7151F2A26603EBD0028CB91 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ F7151F3826603ECA0028CB91 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXShellScriptBuildPhase section */
+ 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "Thin Binary";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
+ };
+ 9740EEB61CF901F6004384FC /* Run Script */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "Run Script";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
+ };
+ E9F7B01F913C69934A6629F6 /* [CP] Check Pods Manifest.lock */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputFileListPaths = (
+ );
+ inputPaths = (
+ "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
+ "${PODS_ROOT}/Manifest.lock",
+ );
+ name = "[CP] Check Pods Manifest.lock";
+ outputFileListPaths = (
+ );
+ outputPaths = (
+ "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
+ showEnvVarsInLog = 0;
+ };
+ F31A669BD45D5A7C940BF077 /* [CP] Check Pods Manifest.lock */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
+ "${PODS_ROOT}/Manifest.lock",
+ );
+ name = "[CP] Check Pods Manifest.lock";
+ outputPaths = (
+ "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
+ showEnvVarsInLog = 0;
+ };
+/* End PBXShellScriptBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 97C146EA1CF9000F007C117D /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */,
+ 97C146F31CF9000F007C117D /* main.m in Sources */,
+ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ F7151F2826603EBD0028CB91 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ F7151F2F26603EBD0028CB91 /* VideoPlayerUITests.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ F7151F3626603ECA0028CB91 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ F7151F3D26603ECA0028CB91 /* VideoPlayerTests.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+ F7151F3226603EBD0028CB91 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 97C146ED1CF9000F007C117D /* Runner */;
+ targetProxy = F7151F3126603EBD0028CB91 /* PBXContainerItemProxy */;
+ };
+ F7151F4026603ECA0028CB91 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 97C146ED1CF9000F007C117D /* Runner */;
+ targetProxy = F7151F3F26603ECA0028CB91 /* PBXContainerItemProxy */;
+ };
+/* End PBXTargetDependency section */
+
+/* Begin PBXVariantGroup section */
+ 97C146FA1CF9000F007C117D /* Main.storyboard */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 97C146FB1CF9000F007C117D /* Base */,
+ );
+ name = Main.storyboard;
+ sourceTree = "<group>";
+ };
+ 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 97C147001CF9000F007C117D /* Base */,
+ );
+ name = LaunchScreen.storyboard;
+ sourceTree = "<group>";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ 97C147031CF9000F007C117D /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
+ CLANG_ANALYZER_NONNULL = YES;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_COMMA = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INFINITE_RECURSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = dwarf;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_TESTABILITY = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+ MTL_ENABLE_DEBUG_INFO = YES;
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = iphoneos;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Debug;
+ };
+ 97C147041CF9000F007C117D /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
+ CLANG_ANALYZER_NONNULL = YES;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_COMMA = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INFINITE_RECURSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+ MTL_ENABLE_DEBUG_INFO = NO;
+ SDKROOT = iphoneos;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ VALIDATE_PRODUCT = YES;
+ };
+ name = Release;
+ };
+ 97C147061CF9000F007C117D /* Debug */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ ENABLE_BITCODE = NO;
+ FRAMEWORK_SEARCH_PATHS = (
+ "$(inherited)",
+ "$(PROJECT_DIR)/Flutter",
+ );
+ INFOPLIST_FILE = Runner/Info.plist;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "$(PROJECT_DIR)/Flutter",
+ );
+ PRODUCT_BUNDLE_IDENTIFIER = dev.flutter.videoPlayerExample;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Debug;
+ };
+ 97C147071CF9000F007C117D /* Release */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ ENABLE_BITCODE = NO;
+ FRAMEWORK_SEARCH_PATHS = (
+ "$(inherited)",
+ "$(PROJECT_DIR)/Flutter",
+ );
+ INFOPLIST_FILE = Runner/Info.plist;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "$(PROJECT_DIR)/Flutter",
+ );
+ PRODUCT_BUNDLE_IDENTIFIER = dev.flutter.videoPlayerExample;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Release;
+ };
+ F7151F3326603EBD0028CB91 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CODE_SIGN_STYLE = Automatic;
+ INFOPLIST_FILE = RunnerUITests/Info.plist;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
+ MTL_FAST_MATH = YES;
+ PRODUCT_BUNDLE_IDENTIFIER = dev.flutter.plugins.RunnerUITests;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ TEST_TARGET_NAME = Runner;
+ };
+ name = Debug;
+ };
+ F7151F3426603EBD0028CB91 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CODE_SIGN_STYLE = Automatic;
+ INFOPLIST_FILE = RunnerUITests/Info.plist;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
+ MTL_FAST_MATH = YES;
+ PRODUCT_BUNDLE_IDENTIFIER = dev.flutter.plugins.RunnerUITests;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ TEST_TARGET_NAME = Runner;
+ };
+ name = Release;
+ };
+ F7151F4226603ECB0028CB91 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 6CDC4DA5940705A6E7671616 /* Pods-RunnerTests.debug.xcconfig */;
+ buildSettings = {
+ BUNDLE_LOADER = "$(TEST_HOST)";
+ CODE_SIGN_STYLE = Automatic;
+ INFOPLIST_FILE = RunnerTests/Info.plist;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
+ MTL_FAST_MATH = YES;
+ PRODUCT_BUNDLE_IDENTIFIER = dev.flutter.plugins.RunnerTests;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/Runner";
+ };
+ name = Debug;
+ };
+ F7151F4326603ECB0028CB91 /* Release */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 2A2EA522BDC492279A91AB75 /* Pods-RunnerTests.release.xcconfig */;
+ buildSettings = {
+ BUNDLE_LOADER = "$(TEST_HOST)";
+ CODE_SIGN_STYLE = Automatic;
+ INFOPLIST_FILE = RunnerTests/Info.plist;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
+ MTL_FAST_MATH = YES;
+ PRODUCT_BUNDLE_IDENTIFIER = dev.flutter.plugins.RunnerTests;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/Runner";
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 97C147031CF9000F007C117D /* Debug */,
+ 97C147041CF9000F007C117D /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 97C147061CF9000F007C117D /* Debug */,
+ 97C147071CF9000F007C117D /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ F7151F3526603EBD0028CB91 /* Build configuration list for PBXNativeTarget "RunnerUITests" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ F7151F3326603EBD0028CB91 /* Debug */,
+ F7151F3426603EBD0028CB91 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ F7151F4126603ECB0028CB91 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ F7151F4226603ECB0028CB91 /* Debug */,
+ F7151F4326603ECB0028CB91 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 97C146E61CF9000F007C117D /* Project object */;
+}
diff --git a/packages/video_player/video_player_avfoundation/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/packages/video_player/video_player_avfoundation/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
new file mode 100644
index 0000000..919434a
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+ version = "1.0">
+ <FileRef
+ location = "self:">
+ </FileRef>
+</Workspace>
diff --git a/packages/video_player/video_player_avfoundation/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/packages/video_player/video_player_avfoundation/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
new file mode 100644
index 0000000..0632b65
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
@@ -0,0 +1,107 @@
+<?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>
+ <TestableReference
+ skipped = "NO">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "F7151F3926603ECA0028CB91"
+ BuildableName = "RunnerTests.xctest"
+ BlueprintName = "RunnerTests"
+ ReferencedContainer = "container:Runner.xcodeproj">
+ </BuildableReference>
+ </TestableReference>
+ <TestableReference
+ skipped = "NO">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "F7151F2B26603EBD0028CB91"
+ BuildableName = "RunnerUITests.xctest"
+ BlueprintName = "RunnerUITests"
+ ReferencedContainer = "container:Runner.xcodeproj">
+ </BuildableReference>
+ </TestableReference>
+ </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 = "Release"
+ 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>
diff --git a/packages/video_player/video_player_avfoundation/example/ios/Runner.xcworkspace/contents.xcworkspacedata b/packages/video_player/video_player_avfoundation/example/ios/Runner.xcworkspace/contents.xcworkspacedata
new file mode 100644
index 0000000..21a3cc1
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/ios/Runner.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,10 @@
+<?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>
diff --git a/packages/video_player/video_player_avfoundation/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/packages/video_player/video_player_avfoundation/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
new file mode 100644
index 0000000..18d9810
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
@@ -0,0 +1,8 @@
+<?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>
diff --git a/packages/video_player/video_player_avfoundation/example/ios/Runner/AppDelegate.h b/packages/video_player/video_player_avfoundation/example/ios/Runner/AppDelegate.h
new file mode 100644
index 0000000..0681d28
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/ios/Runner/AppDelegate.h
@@ -0,0 +1,10 @@
+// Copyright 2013 The Flutter Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import <Flutter/Flutter.h>
+#import <UIKit/UIKit.h>
+
+@interface AppDelegate : FlutterAppDelegate
+
+@end
diff --git a/packages/video_player/video_player_avfoundation/example/ios/Runner/AppDelegate.m b/packages/video_player/video_player_avfoundation/example/ios/Runner/AppDelegate.m
new file mode 100644
index 0000000..30b8796
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/ios/Runner/AppDelegate.m
@@ -0,0 +1,17 @@
+// Copyright 2013 The Flutter Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "AppDelegate.h"
+#include "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
diff --git a/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
new file mode 100644
index 0000000..d22f10b
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
@@ -0,0 +1,116 @@
+{
+ "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"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
diff --git a/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
new file mode 100644
index 0000000..28c6bf0
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
Binary files differ
diff --git a/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
new file mode 100644
index 0000000..2ccbfd9
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
Binary files differ
diff --git a/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
new file mode 100644
index 0000000..f091b6b
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
Binary files differ
diff --git a/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
new file mode 100644
index 0000000..4cde121
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
Binary files differ
diff --git a/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
new file mode 100644
index 0000000..d0ef06e
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
Binary files differ
diff --git a/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
new file mode 100644
index 0000000..dcdc230
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
Binary files differ
diff --git a/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
new file mode 100644
index 0000000..2ccbfd9
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
Binary files differ
diff --git a/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
new file mode 100644
index 0000000..c8f9ed8
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
Binary files differ
diff --git a/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
new file mode 100644
index 0000000..a6d6b86
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
Binary files differ
diff --git a/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
new file mode 100644
index 0000000..a6d6b86
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
Binary files differ
diff --git a/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
new file mode 100644
index 0000000..75b2d16
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
Binary files differ
diff --git a/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
new file mode 100644
index 0000000..c4df70d
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
Binary files differ
diff --git a/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
new file mode 100644
index 0000000..6a84f41
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
Binary files differ
diff --git a/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
new file mode 100644
index 0000000..d0e1f58
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
Binary files differ
diff --git a/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
new file mode 100644
index 0000000..0bedcf2
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
@@ -0,0 +1,23 @@
+{
+ "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"
+ }
+}
diff --git a/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
new file mode 100644
index 0000000..9da19ea
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
Binary files differ
diff --git a/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
new file mode 100644
index 0000000..9da19ea
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
Binary files differ
diff --git a/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
new file mode 100644
index 0000000..9da19ea
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
Binary files differ
diff --git a/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
new file mode 100644
index 0000000..89c2725
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
@@ -0,0 +1,5 @@
+# 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
diff --git a/packages/video_player/video_player_avfoundation/example/ios/Runner/Base.lproj/LaunchScreen.storyboard b/packages/video_player/video_player_avfoundation/example/ios/Runner/Base.lproj/LaunchScreen.storyboard
new file mode 100644
index 0000000..f2e259c
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/ios/Runner/Base.lproj/LaunchScreen.storyboard
@@ -0,0 +1,37 @@
+<?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>
diff --git a/packages/video_player/video_player_avfoundation/example/ios/Runner/Base.lproj/Main.storyboard b/packages/video_player/video_player_avfoundation/example/ios/Runner/Base.lproj/Main.storyboard
new file mode 100644
index 0000000..f3c2851
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/ios/Runner/Base.lproj/Main.storyboard
@@ -0,0 +1,26 @@
+<?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>
diff --git a/packages/video_player/video_player_avfoundation/example/ios/Runner/Info.plist b/packages/video_player/video_player_avfoundation/example/ios/Runner/Info.plist
new file mode 100644
index 0000000..ff775ec
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/ios/Runner/Info.plist
@@ -0,0 +1,54 @@
+<?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>$(EXECUTABLE_NAME)</string>
+ <key>CFBundleIdentifier</key>
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>video_player_example</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ <key>LSRequiresIPhoneOS</key>
+ <true/>
+ <key>NSAppTransportSecurity</key>
+ <dict>
+ <key>NSAllowsArbitraryLoads</key>
+ <true/>
+ </dict>
+ <key>UILaunchStoryboardName</key>
+ <string>LaunchScreen</string>
+ <key>UIMainStoryboardFile</key>
+ <string>Main</string>
+ <key>UIRequiredDeviceCapabilities</key>
+ <array>
+ <string>arm64</string>
+ </array>
+ <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/>
+</dict>
+</plist>
diff --git a/packages/video_player/video_player_avfoundation/example/ios/Runner/main.m b/packages/video_player/video_player_avfoundation/example/ios/Runner/main.m
new file mode 100644
index 0000000..f143297
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/ios/Runner/main.m
@@ -0,0 +1,13 @@
+// Copyright 2013 The Flutter Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#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]));
+ }
+}
diff --git a/packages/video_player/video_player/example/ios/RunnerTests/Info.plist b/packages/video_player/video_player_avfoundation/example/ios/RunnerTests/Info.plist
similarity index 100%
rename from packages/video_player/video_player/example/ios/RunnerTests/Info.plist
rename to packages/video_player/video_player_avfoundation/example/ios/RunnerTests/Info.plist
diff --git a/packages/video_player/video_player/example/ios/RunnerTests/VideoPlayerTests.m b/packages/video_player/video_player_avfoundation/example/ios/RunnerTests/VideoPlayerTests.m
similarity index 99%
rename from packages/video_player/video_player/example/ios/RunnerTests/VideoPlayerTests.m
rename to packages/video_player/video_player_avfoundation/example/ios/RunnerTests/VideoPlayerTests.m
index 1e717fa..a858b14 100644
--- a/packages/video_player/video_player/example/ios/RunnerTests/VideoPlayerTests.m
+++ b/packages/video_player/video_player_avfoundation/example/ios/RunnerTests/VideoPlayerTests.m
@@ -3,7 +3,7 @@
// found in the LICENSE file.
@import AVFoundation;
-@import video_player;
+@import video_player_avfoundation;
@import XCTest;
#import <OCMock/OCMock.h>
diff --git a/packages/video_player/video_player/example/ios/RunnerUITests/Info.plist b/packages/video_player/video_player_avfoundation/example/ios/RunnerUITests/Info.plist
similarity index 100%
rename from packages/video_player/video_player/example/ios/RunnerUITests/Info.plist
rename to packages/video_player/video_player_avfoundation/example/ios/RunnerUITests/Info.plist
diff --git a/packages/video_player/video_player/example/ios/RunnerUITests/VideoPlayerUITests.m b/packages/video_player/video_player_avfoundation/example/ios/RunnerUITests/VideoPlayerUITests.m
similarity index 85%
rename from packages/video_player/video_player/example/ios/RunnerUITests/VideoPlayerUITests.m
rename to packages/video_player/video_player_avfoundation/example/ios/RunnerUITests/VideoPlayerUITests.m
index 7c92493..2933cf3 100644
--- a/packages/video_player/video_player/example/ios/RunnerUITests/VideoPlayerUITests.m
+++ b/packages/video_player/video_player_avfoundation/example/ios/RunnerUITests/VideoPlayerUITests.m
@@ -30,12 +30,6 @@
XCTAssertTrue([playButton waitForExistenceWithTimeout:30.0]);
[playButton tap];
- XCUIElement *chirpClosedCaption = app.staticTexts[@"[ Birds chirping ]"];
- XCTAssertTrue([chirpClosedCaption waitForExistenceWithTimeout:30.0]);
-
- XCUIElement *buzzClosedCaption = app.staticTexts[@"[ Buzzing ]"];
- XCTAssertTrue([buzzClosedCaption waitForExistenceWithTimeout:30.0]);
-
XCUIElement *playbackSpeed1x = app.staticTexts[@"Playback speed\n1.0x"];
XCTAssertTrue([playbackSpeed1x waitForExistenceWithTimeout:30.0]);
[playbackSpeed1x tap];
@@ -48,7 +42,7 @@
XCTAssertTrue([playbackSpeed5x waitForExistenceWithTimeout:30.0]);
// Cycle through tabs.
- for (NSString *tabName in @[ @"Asset", @"List example" ]) {
+ for (NSString *tabName in @[ @"Asset", @"Remote" ]) {
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"label BEGINSWITH %@", tabName];
XCUIElement *unselectedTab = [app.staticTexts elementMatchingPredicate:predicate];
XCTAssertTrue([unselectedTab waitForExistenceWithTimeout:30.0]);
diff --git a/packages/video_player/video_player_avfoundation/example/lib/main.dart b/packages/video_player/video_player_avfoundation/example/lib/main.dart
new file mode 100644
index 0000000..cab6eb8
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/lib/main.dart
@@ -0,0 +1,235 @@
+// Copyright 2013 The Flutter Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// ignore_for_file: public_member_api_docs
+
+import 'package:flutter/cupertino.dart';
+import 'package:flutter/material.dart';
+
+import 'mini_controller.dart';
+
+void main() {
+ runApp(
+ MaterialApp(
+ home: _App(),
+ ),
+ );
+}
+
+class _App extends StatelessWidget {
+ @override
+ Widget build(BuildContext context) {
+ return DefaultTabController(
+ length: 2,
+ child: Scaffold(
+ key: const ValueKey<String>('home_page'),
+ appBar: AppBar(
+ title: const Text('Video player example'),
+ bottom: const TabBar(
+ isScrollable: true,
+ tabs: <Widget>[
+ Tab(
+ icon: Icon(Icons.cloud),
+ text: 'Remote',
+ ),
+ Tab(icon: Icon(Icons.insert_drive_file), text: 'Asset'),
+ ],
+ ),
+ ),
+ body: TabBarView(
+ children: <Widget>[
+ _BumbleBeeRemoteVideo(),
+ _ButterFlyAssetVideo(),
+ ],
+ ),
+ ),
+ );
+ }
+}
+
+class _ButterFlyAssetVideo extends StatefulWidget {
+ @override
+ _ButterFlyAssetVideoState createState() => _ButterFlyAssetVideoState();
+}
+
+class _ButterFlyAssetVideoState extends State<_ButterFlyAssetVideo> {
+ late MiniController _controller;
+
+ @override
+ void initState() {
+ super.initState();
+ _controller = MiniController.asset('assets/Butterfly-209.mp4');
+
+ _controller.addListener(() {
+ setState(() {});
+ });
+ _controller.initialize().then((_) => setState(() {}));
+ _controller.play();
+ }
+
+ @override
+ void dispose() {
+ _controller.dispose();
+ super.dispose();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return SingleChildScrollView(
+ child: Column(
+ children: <Widget>[
+ Container(
+ padding: const EdgeInsets.only(top: 20.0),
+ ),
+ const Text('With assets mp4'),
+ Container(
+ padding: const EdgeInsets.all(20),
+ child: AspectRatio(
+ aspectRatio: _controller.value.aspectRatio,
+ child: Stack(
+ alignment: Alignment.bottomCenter,
+ children: <Widget>[
+ VideoPlayer(_controller),
+ _ControlsOverlay(controller: _controller),
+ VideoProgressIndicator(_controller),
+ ],
+ ),
+ ),
+ ),
+ ],
+ ),
+ );
+ }
+}
+
+class _BumbleBeeRemoteVideo extends StatefulWidget {
+ @override
+ _BumbleBeeRemoteVideoState createState() => _BumbleBeeRemoteVideoState();
+}
+
+class _BumbleBeeRemoteVideoState extends State<_BumbleBeeRemoteVideo> {
+ late MiniController _controller;
+
+ @override
+ void initState() {
+ super.initState();
+ _controller = MiniController.network(
+ 'https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4',
+ );
+
+ _controller.addListener(() {
+ setState(() {});
+ });
+ _controller.initialize();
+ }
+
+ @override
+ void dispose() {
+ _controller.dispose();
+ super.dispose();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return SingleChildScrollView(
+ child: Column(
+ children: <Widget>[
+ Container(padding: const EdgeInsets.only(top: 20.0)),
+ const Text('With remote mp4'),
+ Container(
+ padding: const EdgeInsets.all(20),
+ child: AspectRatio(
+ aspectRatio: _controller.value.aspectRatio,
+ child: Stack(
+ alignment: Alignment.bottomCenter,
+ children: <Widget>[
+ VideoPlayer(_controller),
+ _ControlsOverlay(controller: _controller),
+ VideoProgressIndicator(_controller),
+ ],
+ ),
+ ),
+ ),
+ ],
+ ),
+ );
+ }
+}
+
+class _ControlsOverlay extends StatelessWidget {
+ const _ControlsOverlay({Key? key, required this.controller})
+ : super(key: key);
+
+ static const List<double> _examplePlaybackRates = <double>[
+ 0.25,
+ 0.5,
+ 1.0,
+ 1.5,
+ 2.0,
+ 3.0,
+ 5.0,
+ 10.0,
+ ];
+
+ final MiniController controller;
+
+ @override
+ Widget build(BuildContext context) {
+ return Stack(
+ children: <Widget>[
+ AnimatedSwitcher(
+ duration: const Duration(milliseconds: 50),
+ reverseDuration: const Duration(milliseconds: 200),
+ child: controller.value.isPlaying
+ ? const SizedBox.shrink()
+ : Container(
+ color: Colors.black26,
+ child: const Center(
+ child: Icon(
+ Icons.play_arrow,
+ color: Colors.white,
+ size: 100.0,
+ semanticLabel: 'Play',
+ ),
+ ),
+ ),
+ ),
+ GestureDetector(
+ onTap: () {
+ controller.value.isPlaying ? controller.pause() : controller.play();
+ },
+ ),
+ Align(
+ alignment: Alignment.topRight,
+ child: PopupMenuButton<double>(
+ initialValue: controller.value.playbackSpeed,
+ tooltip: 'Playback speed',
+ onSelected: (double speed) {
+ controller.setPlaybackSpeed(speed);
+ },
+ itemBuilder: (BuildContext context) {
+ return <PopupMenuItem<double>>[
+ for (final double speed in _examplePlaybackRates)
+ PopupMenuItem<double>(
+ value: speed,
+ child: Text('${speed}x'),
+ )
+ ];
+ },
+ child: Padding(
+ padding: const EdgeInsets.symmetric(
+ // Using less vertical padding as the text is also longer
+ // horizontally, so it feels like it would need more spacing
+ // horizontally (matching the aspect ratio of the video).
+ vertical: 12,
+ horizontal: 16,
+ ),
+ child: Text('${controller.value.playbackSpeed}x'),
+ ),
+ ),
+ ),
+ ],
+ );
+ }
+}
diff --git a/packages/video_player/video_player_avfoundation/example/lib/mini_controller.dart b/packages/video_player/video_player_avfoundation/example/lib/mini_controller.dart
new file mode 100644
index 0000000..9bb8e90
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/lib/mini_controller.dart
@@ -0,0 +1,538 @@
+// Copyright 2013 The Flutter Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// TODO(stuartmorgan): Consider extracting this to a shared local (path-based)
+// package for use in all implementation packages.
+
+import 'dart:async';
+import 'dart:io';
+
+import 'package:flutter/foundation.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
+import 'package:video_player_platform_interface/video_player_platform_interface.dart';
+
+VideoPlayerPlatform? _cachedPlatform;
+
+VideoPlayerPlatform get _platform {
+ if (_cachedPlatform == null) {
+ _cachedPlatform = VideoPlayerPlatform.instance;
+ _cachedPlatform!.init();
+ }
+ return _cachedPlatform!;
+}
+
+/// The duration, current position, buffering state, error state and settings
+/// of a [MiniController].
+class VideoPlayerValue {
+ /// Constructs a video with the given values. Only [duration] is required. The
+ /// rest will initialize with default values when unset.
+ VideoPlayerValue({
+ required this.duration,
+ this.size = Size.zero,
+ this.position = Duration.zero,
+ this.buffered = const <DurationRange>[],
+ this.isInitialized = false,
+ this.isPlaying = false,
+ this.isBuffering = false,
+ this.playbackSpeed = 1.0,
+ this.errorDescription,
+ });
+
+ /// Returns an instance for a video that hasn't been loaded.
+ VideoPlayerValue.uninitialized()
+ : this(duration: Duration.zero, isInitialized: false);
+
+ /// Returns an instance with the given [errorDescription].
+ VideoPlayerValue.erroneous(String errorDescription)
+ : this(
+ duration: Duration.zero,
+ isInitialized: false,
+ errorDescription: errorDescription);
+
+ /// The total duration of the video.
+ ///
+ /// The duration is [Duration.zero] if the video hasn't been initialized.
+ final Duration duration;
+
+ /// The current playback position.
+ final Duration position;
+
+ /// The currently buffered ranges.
+ final List<DurationRange> buffered;
+
+ /// True if the video is playing. False if it's paused.
+ final bool isPlaying;
+
+ /// True if the video is currently buffering.
+ final bool isBuffering;
+
+ /// The current speed of the playback.
+ final double playbackSpeed;
+
+ /// A description of the error if present.
+ ///
+ /// If [hasError] is false this is `null`.
+ final String? errorDescription;
+
+ /// The [size] of the currently loaded video.
+ final Size size;
+
+ /// Indicates whether or not the video has been loaded and is ready to play.
+ final bool isInitialized;
+
+ /// Indicates whether or not the video is in an error state. If this is true
+ /// [errorDescription] should have information about the problem.
+ bool get hasError => errorDescription != null;
+
+ /// Returns [size.width] / [size.height].
+ ///
+ /// Will return `1.0` if:
+ /// * [isInitialized] is `false`
+ /// * [size.width], or [size.height] is equal to `0.0`
+ /// * aspect ratio would be less than or equal to `0.0`
+ double get aspectRatio {
+ if (!isInitialized || size.width == 0 || size.height == 0) {
+ return 1.0;
+ }
+ final double aspectRatio = size.width / size.height;
+ if (aspectRatio <= 0) {
+ return 1.0;
+ }
+ return aspectRatio;
+ }
+
+ /// Returns a new instance that has the same values as this current instance,
+ /// except for any overrides passed in as arguments to [copyWidth].
+ VideoPlayerValue copyWith({
+ Duration? duration,
+ Size? size,
+ Duration? position,
+ List<DurationRange>? buffered,
+ bool? isInitialized,
+ bool? isPlaying,
+ bool? isBuffering,
+ double? playbackSpeed,
+ String? errorDescription,
+ }) {
+ return VideoPlayerValue(
+ duration: duration ?? this.duration,
+ size: size ?? this.size,
+ position: position ?? this.position,
+ buffered: buffered ?? this.buffered,
+ isInitialized: isInitialized ?? this.isInitialized,
+ isPlaying: isPlaying ?? this.isPlaying,
+ isBuffering: isBuffering ?? this.isBuffering,
+ playbackSpeed: playbackSpeed ?? this.playbackSpeed,
+ errorDescription: errorDescription ?? this.errorDescription,
+ );
+ }
+}
+
+/// A very minimal version of `VideoPlayerController` for running the example
+/// without relying on `video_player`.
+class MiniController extends ValueNotifier<VideoPlayerValue> {
+ /// Constructs a [MiniController] playing a video from an asset.
+ ///
+ /// The name of the asset is given by the [dataSource] argument and must not be
+ /// null. The [package] argument must be non-null when the asset comes from a
+ /// package and null otherwise.
+ MiniController.asset(this.dataSource, {this.package})
+ : dataSourceType = DataSourceType.asset,
+ super(VideoPlayerValue(duration: Duration.zero));
+
+ /// Constructs a [MiniController] playing a video from obtained from
+ /// the network.
+ MiniController.network(this.dataSource)
+ : dataSourceType = DataSourceType.network,
+ package = null,
+ super(VideoPlayerValue(duration: Duration.zero));
+
+ /// Constructs a [MiniController] playing a video from obtained from a file.
+ MiniController.file(File file)
+ : dataSource = 'file://${file.path}',
+ dataSourceType = DataSourceType.file,
+ package = null,
+ super(VideoPlayerValue(duration: Duration.zero));
+
+ /// The URI to the video file. This will be in different formats depending on
+ /// the [DataSourceType] of the original video.
+ final String dataSource;
+
+ /// Describes the type of data source this [MiniController]
+ /// is constructed with.
+ final DataSourceType dataSourceType;
+
+ /// Only set for [asset] videos. The package that the asset was loaded from.
+ final String? package;
+
+ Timer? _timer;
+ Completer<void>? _creatingCompleter;
+ StreamSubscription<dynamic>? _eventSubscription;
+
+ /// The id of a texture that hasn't been initialized.
+ @visibleForTesting
+ static const int kUninitializedTextureId = -1;
+ int _textureId = kUninitializedTextureId;
+
+ /// This is just exposed for testing. It shouldn't be used by anyone depending
+ /// on the plugin.
+ @visibleForTesting
+ int get textureId => _textureId;
+
+ /// Attempts to open the given [dataSource] and load metadata about the video.
+ Future<void> initialize() async {
+ _creatingCompleter = Completer<void>();
+
+ late DataSource dataSourceDescription;
+ switch (dataSourceType) {
+ case DataSourceType.asset:
+ dataSourceDescription = DataSource(
+ sourceType: DataSourceType.asset,
+ asset: dataSource,
+ package: package,
+ );
+ break;
+ case DataSourceType.network:
+ dataSourceDescription = DataSource(
+ sourceType: DataSourceType.network,
+ uri: dataSource,
+ );
+ break;
+ case DataSourceType.file:
+ dataSourceDescription = DataSource(
+ sourceType: DataSourceType.file,
+ uri: dataSource,
+ );
+ break;
+ case DataSourceType.contentUri:
+ dataSourceDescription = DataSource(
+ sourceType: DataSourceType.contentUri,
+ uri: dataSource,
+ );
+ break;
+ }
+
+ _textureId = (await _platform.create(dataSourceDescription)) ??
+ kUninitializedTextureId;
+ _creatingCompleter!.complete(null);
+ final Completer<void> initializingCompleter = Completer<void>();
+
+ void eventListener(VideoEvent event) {
+ switch (event.eventType) {
+ case VideoEventType.initialized:
+ value = value.copyWith(
+ duration: event.duration,
+ size: event.size,
+ isInitialized: event.duration != null,
+ );
+ initializingCompleter.complete(null);
+ _platform.setVolume(_textureId, 1.0);
+ _platform.setLooping(_textureId, true);
+ _applyPlayPause();
+ break;
+ case VideoEventType.completed:
+ pause().then((void pauseResult) => seekTo(value.duration));
+ break;
+ case VideoEventType.bufferingUpdate:
+ value = value.copyWith(buffered: event.buffered);
+ break;
+ case VideoEventType.bufferingStart:
+ value = value.copyWith(isBuffering: true);
+ break;
+ case VideoEventType.bufferingEnd:
+ value = value.copyWith(isBuffering: false);
+ break;
+ case VideoEventType.unknown:
+ break;
+ }
+ }
+
+ void errorListener(Object obj) {
+ final PlatformException e = obj as PlatformException;
+ value = VideoPlayerValue.erroneous(e.message!);
+ _timer?.cancel();
+ if (!initializingCompleter.isCompleted) {
+ initializingCompleter.completeError(obj);
+ }
+ }
+
+ _eventSubscription = _platform
+ .videoEventsFor(_textureId)
+ .listen(eventListener, onError: errorListener);
+ return initializingCompleter.future;
+ }
+
+ @override
+ Future<void> dispose() async {
+ if (_creatingCompleter != null) {
+ await _creatingCompleter!.future;
+ _timer?.cancel();
+ await _eventSubscription?.cancel();
+ await _platform.dispose(_textureId);
+ }
+ super.dispose();
+ }
+
+ /// Starts playing the video.
+ Future<void> play() async {
+ value = value.copyWith(isPlaying: true);
+ await _applyPlayPause();
+ }
+
+ /// Pauses the video.
+ Future<void> pause() async {
+ value = value.copyWith(isPlaying: false);
+ await _applyPlayPause();
+ }
+
+ Future<void> _applyPlayPause() async {
+ _timer?.cancel();
+ if (value.isPlaying) {
+ await _platform.play(_textureId);
+
+ _timer = Timer.periodic(
+ const Duration(milliseconds: 500),
+ (Timer timer) async {
+ final Duration? newPosition = await position;
+ if (newPosition == null) {
+ return;
+ }
+ _updatePosition(newPosition);
+ },
+ );
+ await _applyPlaybackSpeed();
+ } else {
+ await _platform.pause(_textureId);
+ }
+ }
+
+ Future<void> _applyPlaybackSpeed() async {
+ if (value.isPlaying) {
+ await _platform.setPlaybackSpeed(
+ _textureId,
+ value.playbackSpeed,
+ );
+ }
+ }
+
+ /// The position in the current video.
+ Future<Duration?> get position async {
+ return await _platform.getPosition(_textureId);
+ }
+
+ /// Sets the video's current timestamp to be at [position].
+ Future<void> seekTo(Duration position) async {
+ if (position > value.duration) {
+ position = value.duration;
+ } else if (position < const Duration()) {
+ position = const Duration();
+ }
+ await _platform.seekTo(_textureId, position);
+ _updatePosition(position);
+ }
+
+ /// Sets the playback speed.
+ Future<void> setPlaybackSpeed(double speed) async {
+ value = value.copyWith(playbackSpeed: speed);
+ await _applyPlaybackSpeed();
+ }
+
+ void _updatePosition(Duration position) {
+ value = value.copyWith(position: position);
+ }
+
+ @override
+ void removeListener(VoidCallback listener) {
+ super.removeListener(listener);
+ }
+}
+
+/// Widget that displays the video controlled by [controller].
+class VideoPlayer extends StatefulWidget {
+ /// Uses the given [controller] for all video rendered in this widget.
+ const VideoPlayer(this.controller);
+
+ /// The [MiniController] responsible for the video being rendered in
+ /// this widget.
+ final MiniController controller;
+
+ @override
+ _VideoPlayerState createState() => _VideoPlayerState();
+}
+
+class _VideoPlayerState extends State<VideoPlayer> {
+ _VideoPlayerState() {
+ _listener = () {
+ final int newTextureId = widget.controller.textureId;
+ if (newTextureId != _textureId) {
+ setState(() {
+ _textureId = newTextureId;
+ });
+ }
+ };
+ }
+
+ late VoidCallback _listener;
+
+ late int _textureId;
+
+ @override
+ void initState() {
+ super.initState();
+ _textureId = widget.controller.textureId;
+ // Need to listen for initialization events since the actual texture ID
+ // becomes available after asynchronous initialization finishes.
+ widget.controller.addListener(_listener);
+ }
+
+ @override
+ void didUpdateWidget(VideoPlayer oldWidget) {
+ super.didUpdateWidget(oldWidget);
+ oldWidget.controller.removeListener(_listener);
+ _textureId = widget.controller.textureId;
+ widget.controller.addListener(_listener);
+ }
+
+ @override
+ void deactivate() {
+ super.deactivate();
+ widget.controller.removeListener(_listener);
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return _textureId == MiniController.kUninitializedTextureId
+ ? Container()
+ : _platform.buildView(_textureId);
+ }
+}
+
+class _VideoScrubber extends StatefulWidget {
+ const _VideoScrubber({
+ required this.child,
+ required this.controller,
+ });
+
+ final Widget child;
+ final MiniController controller;
+
+ @override
+ _VideoScrubberState createState() => _VideoScrubberState();
+}
+
+class _VideoScrubberState extends State<_VideoScrubber> {
+ MiniController 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);
+ }
+
+ return GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ child: widget.child,
+ onTapDown: (TapDownDetails details) {
+ if (controller.value.isInitialized) {
+ seekToRelativePosition(details.globalPosition);
+ }
+ },
+ );
+ }
+}
+
+/// Displays the play/buffering status of the video controlled by [controller].
+class VideoProgressIndicator extends StatefulWidget {
+ /// Construct an instance that displays the play/buffering status of the video
+ /// controlled by [controller].
+ const VideoProgressIndicator(this.controller);
+
+ /// The [MiniController] that actually associates a video with this
+ /// widget.
+ final MiniController controller;
+
+ @override
+ _VideoProgressIndicatorState createState() => _VideoProgressIndicatorState();
+}
+
+class _VideoProgressIndicatorState extends State<VideoProgressIndicator> {
+ _VideoProgressIndicatorState() {
+ listener = () {
+ if (mounted) {
+ setState(() {});
+ }
+ };
+ }
+
+ late VoidCallback listener;
+
+ MiniController get controller => widget.controller;
+
+ @override
+ void initState() {
+ super.initState();
+ controller.addListener(listener);
+ }
+
+ @override
+ void deactivate() {
+ controller.removeListener(listener);
+ super.deactivate();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ const Color playedColor = Color.fromRGBO(255, 0, 0, 0.7);
+ const Color bufferedColor = Color.fromRGBO(50, 50, 200, 0.2);
+ const Color backgroundColor = Color.fromRGBO(200, 200, 200, 0.5);
+
+ Widget progressIndicator;
+ if (controller.value.isInitialized) {
+ final int duration = controller.value.duration.inMilliseconds;
+ final int position = controller.value.position.inMilliseconds;
+
+ int maxBuffering = 0;
+ for (final DurationRange range in controller.value.buffered) {
+ final int end = range.end.inMilliseconds;
+ if (end > maxBuffering) {
+ maxBuffering = end;
+ }
+ }
+
+ progressIndicator = Stack(
+ fit: StackFit.passthrough,
+ children: <Widget>[
+ LinearProgressIndicator(
+ value: maxBuffering / duration,
+ valueColor: const AlwaysStoppedAnimation<Color>(bufferedColor),
+ backgroundColor: backgroundColor,
+ ),
+ LinearProgressIndicator(
+ value: position / duration,
+ valueColor: const AlwaysStoppedAnimation<Color>(playedColor),
+ backgroundColor: Colors.transparent,
+ ),
+ ],
+ );
+ } else {
+ progressIndicator = const LinearProgressIndicator(
+ value: null,
+ valueColor: AlwaysStoppedAnimation<Color>(playedColor),
+ backgroundColor: backgroundColor,
+ );
+ }
+ return _VideoScrubber(
+ child: Padding(
+ padding: const EdgeInsets.only(top: 5.0),
+ child: progressIndicator,
+ ),
+ controller: controller,
+ );
+ }
+}
diff --git a/packages/video_player/video_player_avfoundation/example/pubspec.yaml b/packages/video_player/video_player_avfoundation/example/pubspec.yaml
new file mode 100644
index 0000000..40b88d5
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/pubspec.yaml
@@ -0,0 +1,35 @@
+name: video_player_example
+description: Demonstrates how to use the video_player plugin.
+publish_to: none
+
+environment:
+ sdk: ">=2.12.0 <3.0.0"
+ flutter: ">=2.8.0"
+
+dependencies:
+ flutter:
+ sdk: flutter
+ video_player_avfoundation:
+ # When depending on this package from a real application you should use:
+ # video_player_avfoundation: ^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: ../
+ video_player_platform_interface: ">=4.2.0 <6.0.0"
+
+dev_dependencies:
+ flutter_driver:
+ sdk: flutter
+ flutter_test:
+ sdk: flutter
+ integration_test:
+ sdk: flutter
+ path_provider: ^2.0.6
+ test: any
+
+flutter:
+ uses-material-design: true
+ assets:
+ - assets/flutter-mark-square-64.png
+ - assets/Butterfly-209.mp4
diff --git a/packages/video_player/video_player_avfoundation/example/test_driver/integration_test.dart b/packages/video_player/video_player_avfoundation/example/test_driver/integration_test.dart
new file mode 100644
index 0000000..4f10f2a
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/test_driver/integration_test.dart
@@ -0,0 +1,7 @@
+// Copyright 2013 The Flutter Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+import 'package:integration_test/integration_test_driver.dart';
+
+Future<void> main() => integrationDriver();
diff --git a/packages/video_player/video_player_avfoundation/example/test_driver/video_player.dart b/packages/video_player/video_player_avfoundation/example/test_driver/video_player.dart
new file mode 100644
index 0000000..b72354e
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/example/test_driver/video_player.dart
@@ -0,0 +1,11 @@
+// Copyright 2013 The Flutter Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+import 'package:flutter_driver/driver_extension.dart';
+import 'package:video_player_example/main.dart' as app;
+
+void main() {
+ enableFlutterDriverExtension();
+ app.main();
+}
diff --git a/packages/video_player/video_player/ios/Assets/.gitkeep b/packages/video_player/video_player_avfoundation/ios/Assets/.gitkeep
similarity index 100%
rename from packages/video_player/video_player/ios/Assets/.gitkeep
rename to packages/video_player/video_player_avfoundation/ios/Assets/.gitkeep
diff --git a/packages/video_player/video_player/ios/Classes/FLTVideoPlayerPlugin.h b/packages/video_player/video_player_avfoundation/ios/Classes/FLTVideoPlayerPlugin.h
similarity index 100%
rename from packages/video_player/video_player/ios/Classes/FLTVideoPlayerPlugin.h
rename to packages/video_player/video_player_avfoundation/ios/Classes/FLTVideoPlayerPlugin.h
diff --git a/packages/video_player/video_player/ios/Classes/FLTVideoPlayerPlugin.m b/packages/video_player/video_player_avfoundation/ios/Classes/FLTVideoPlayerPlugin.m
similarity index 98%
rename from packages/video_player/video_player/ios/Classes/FLTVideoPlayerPlugin.m
rename to packages/video_player/video_player_avfoundation/ios/Classes/FLTVideoPlayerPlugin.m
index 5d09cfe..9cc40e3 100644
--- a/packages/video_player/video_player/ios/Classes/FLTVideoPlayerPlugin.m
+++ b/packages/video_player/video_player_avfoundation/ios/Classes/FLTVideoPlayerPlugin.m
@@ -397,6 +397,9 @@
}
- (void)seekTo:(int)location {
+ // TODO(stuartmorgan): Update this to use completionHandler: to only return
+ // once the seek operation is complete once the Pigeon API is updated to a
+ // version that handles async calls.
[_player seekToTime:CMTimeMake(location, 1000)
toleranceBefore:kCMTimeZero
toleranceAfter:kCMTimeZero];
diff --git a/packages/video_player/video_player/ios/Classes/messages.h b/packages/video_player/video_player_avfoundation/ios/Classes/messages.h
similarity index 100%
rename from packages/video_player/video_player/ios/Classes/messages.h
rename to packages/video_player/video_player_avfoundation/ios/Classes/messages.h
diff --git a/packages/video_player/video_player/ios/Classes/messages.m b/packages/video_player/video_player_avfoundation/ios/Classes/messages.m
similarity index 100%
rename from packages/video_player/video_player/ios/Classes/messages.m
rename to packages/video_player/video_player_avfoundation/ios/Classes/messages.m
diff --git a/packages/video_player/video_player/ios/video_player.podspec b/packages/video_player/video_player_avfoundation/ios/video_player_avfoundation.podspec
similarity index 87%
rename from packages/video_player/video_player/ios/video_player.podspec
rename to packages/video_player/video_player_avfoundation/ios/video_player_avfoundation.podspec
index 12ea7e9..80dd2a5 100644
--- a/packages/video_player/video_player/ios/video_player.podspec
+++ b/packages/video_player/video_player_avfoundation/ios/video_player_avfoundation.podspec
@@ -2,7 +2,7 @@
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
- s.name = 'video_player'
+ s.name = 'video_player_avfoundation'
s.version = '0.0.1'
s.summary = 'Flutter Video Player'
s.description = <<-DESC
@@ -12,13 +12,12 @@
s.homepage = 'https://github.com/flutter/plugins'
s.license = { :type => 'BSD', :file => '../LICENSE' }
s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' }
- s.source = { :http => 'https://github.com/flutter/plugins/tree/main/packages/video_player/video_player' }
+ s.source = { :http => 'https://github.com/flutter/plugins/tree/main/packages/video_player/video_player_avfoundation' }
s.documentation_url = 'https://pub.dev/packages/video_player'
s.source_files = 'Classes/**/*'
s.public_header_files = 'Classes/**/*.h'
s.dependency 'Flutter'
-
+
s.platform = :ios, '9.0'
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
end
-
diff --git a/packages/video_player/video_player_avfoundation/lib/src/avfoundation_video_player.dart b/packages/video_player/video_player_avfoundation/lib/src/avfoundation_video_player.dart
new file mode 100644
index 0000000..db7e04b
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/lib/src/avfoundation_video_player.dart
@@ -0,0 +1,173 @@
+// Copyright 2013 The Flutter Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+import 'dart:async';
+import 'dart:ui';
+
+import 'package:flutter/services.dart';
+import 'package:flutter/widgets.dart';
+import 'package:video_player_platform_interface/video_player_platform_interface.dart';
+
+import 'messages.dart';
+
+/// An iOS implementation of [VideoPlayerPlatform] that uses the
+/// Pigeon-generated [VideoPlayerApi].
+class AVFoundationVideoPlayer extends VideoPlayerPlatform {
+ final VideoPlayerApi _api = VideoPlayerApi();
+
+ /// Registers this class as the default instance of [VideoPlayerPlatform].
+ static void registerWith() {
+ VideoPlayerPlatform.instance = AVFoundationVideoPlayer();
+ }
+
+ @override
+ Future<void> init() {
+ return _api.initialize();
+ }
+
+ @override
+ Future<void> dispose(int textureId) {
+ return _api.dispose(TextureMessage()..textureId = textureId);
+ }
+
+ @override
+ Future<int?> create(DataSource dataSource) async {
+ final CreateMessage message = CreateMessage();
+
+ switch (dataSource.sourceType) {
+ case DataSourceType.asset:
+ message.asset = dataSource.asset;
+ message.packageName = dataSource.package;
+ break;
+ case DataSourceType.network:
+ message.uri = dataSource.uri;
+ message.formatHint = _videoFormatStringMap[dataSource.formatHint];
+ message.httpHeaders = dataSource.httpHeaders;
+ break;
+ case DataSourceType.file:
+ message.uri = dataSource.uri;
+ break;
+ case DataSourceType.contentUri:
+ message.uri = dataSource.uri;
+ break;
+ }
+
+ final TextureMessage response = await _api.create(message);
+ return response.textureId;
+ }
+
+ @override
+ Future<void> setLooping(int textureId, bool looping) {
+ return _api.setLooping(LoopingMessage()
+ ..textureId = textureId
+ ..isLooping = looping);
+ }
+
+ @override
+ Future<void> play(int textureId) {
+ return _api.play(TextureMessage()..textureId = textureId);
+ }
+
+ @override
+ Future<void> pause(int textureId) {
+ return _api.pause(TextureMessage()..textureId = textureId);
+ }
+
+ @override
+ Future<void> setVolume(int textureId, double volume) {
+ return _api.setVolume(VolumeMessage()
+ ..textureId = textureId
+ ..volume = volume);
+ }
+
+ @override
+ Future<void> setPlaybackSpeed(int textureId, double speed) {
+ assert(speed > 0);
+
+ return _api.setPlaybackSpeed(PlaybackSpeedMessage()
+ ..textureId = textureId
+ ..speed = speed);
+ }
+
+ @override
+ Future<void> seekTo(int textureId, Duration position) {
+ return _api.seekTo(PositionMessage()
+ ..textureId = textureId
+ ..position = position.inMilliseconds);
+ }
+
+ @override
+ Future<Duration> getPosition(int textureId) async {
+ final PositionMessage response =
+ await _api.position(TextureMessage()..textureId = textureId);
+ return Duration(milliseconds: response.position!);
+ }
+
+ @override
+ Stream<VideoEvent> videoEventsFor(int textureId) {
+ return _eventChannelFor(textureId)
+ .receiveBroadcastStream()
+ .map((dynamic event) {
+ final Map<dynamic, dynamic> map = event as Map<dynamic, dynamic>;
+ switch (map['event']) {
+ case 'initialized':
+ return VideoEvent(
+ eventType: VideoEventType.initialized,
+ duration: Duration(milliseconds: map['duration'] as int),
+ size: Size((map['width'] as num?)?.toDouble() ?? 0.0,
+ (map['height'] as num?)?.toDouble() ?? 0.0),
+ );
+ case 'completed':
+ return VideoEvent(
+ eventType: VideoEventType.completed,
+ );
+ case 'bufferingUpdate':
+ final List<dynamic> values = map['values'] as List<dynamic>;
+
+ return VideoEvent(
+ buffered: values.map<DurationRange>(_toDurationRange).toList(),
+ eventType: VideoEventType.bufferingUpdate,
+ );
+ case 'bufferingStart':
+ return VideoEvent(eventType: VideoEventType.bufferingStart);
+ case 'bufferingEnd':
+ return VideoEvent(eventType: VideoEventType.bufferingEnd);
+ default:
+ return VideoEvent(eventType: VideoEventType.unknown);
+ }
+ });
+ }
+
+ @override
+ Widget buildView(int textureId) {
+ return Texture(textureId: textureId);
+ }
+
+ @override
+ Future<void> setMixWithOthers(bool mixWithOthers) {
+ return _api.setMixWithOthers(
+ MixWithOthersMessage()..mixWithOthers = mixWithOthers,
+ );
+ }
+
+ EventChannel _eventChannelFor(int textureId) {
+ return EventChannel('flutter.io/videoPlayer/videoEvents$textureId');
+ }
+
+ static const Map<VideoFormat, String> _videoFormatStringMap =
+ <VideoFormat, String>{
+ VideoFormat.ss: 'ss',
+ VideoFormat.hls: 'hls',
+ VideoFormat.dash: 'dash',
+ VideoFormat.other: 'other',
+ };
+
+ DurationRange _toDurationRange(dynamic value) {
+ final List<dynamic> pair = value as List<dynamic>;
+ return DurationRange(
+ Duration(milliseconds: pair[0] as int),
+ Duration(milliseconds: pair[1] as int),
+ );
+ }
+}
diff --git a/packages/video_player/video_player_avfoundation/lib/src/messages.dart b/packages/video_player/video_player_avfoundation/lib/src/messages.dart
new file mode 100644
index 0000000..831f4e3
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/lib/src/messages.dart
@@ -0,0 +1,425 @@
+// Copyright 2013 The Flutter Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Autogenerated from Pigeon (v0.1.21), do not edit directly.
+// See also: https://pub.dev/packages/pigeon
+// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, cast_nullable_to_non_nullable
+// @dart = 2.12
+import 'dart:async';
+import 'dart:typed_data' show Uint8List, Int32List, Int64List, Float64List;
+
+import 'package:flutter/services.dart';
+
+class TextureMessage {
+ int? textureId;
+
+ Object encode() {
+ final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
+ pigeonMap['textureId'] = textureId;
+ return pigeonMap;
+ }
+
+ static TextureMessage decode(Object message) {
+ final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
+ return TextureMessage()..textureId = pigeonMap['textureId'] as int?;
+ }
+}
+
+class CreateMessage {
+ String? asset;
+ String? uri;
+ String? packageName;
+ String? formatHint;
+ Map<Object?, Object?>? httpHeaders;
+
+ Object encode() {
+ final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
+ pigeonMap['asset'] = asset;
+ pigeonMap['uri'] = uri;
+ pigeonMap['packageName'] = packageName;
+ pigeonMap['formatHint'] = formatHint;
+ pigeonMap['httpHeaders'] = httpHeaders;
+ return pigeonMap;
+ }
+
+ static CreateMessage decode(Object message) {
+ final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
+ return CreateMessage()
+ ..asset = pigeonMap['asset'] as String?
+ ..uri = pigeonMap['uri'] as String?
+ ..packageName = pigeonMap['packageName'] as String?
+ ..formatHint = pigeonMap['formatHint'] as String?
+ ..httpHeaders = pigeonMap['httpHeaders'] as Map<Object?, Object?>?;
+ }
+}
+
+class LoopingMessage {
+ int? textureId;
+ bool? isLooping;
+
+ Object encode() {
+ final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
+ pigeonMap['textureId'] = textureId;
+ pigeonMap['isLooping'] = isLooping;
+ return pigeonMap;
+ }
+
+ static LoopingMessage decode(Object message) {
+ final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
+ return LoopingMessage()
+ ..textureId = pigeonMap['textureId'] as int?
+ ..isLooping = pigeonMap['isLooping'] as bool?;
+ }
+}
+
+class VolumeMessage {
+ int? textureId;
+ double? volume;
+
+ Object encode() {
+ final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
+ pigeonMap['textureId'] = textureId;
+ pigeonMap['volume'] = volume;
+ return pigeonMap;
+ }
+
+ static VolumeMessage decode(Object message) {
+ final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
+ return VolumeMessage()
+ ..textureId = pigeonMap['textureId'] as int?
+ ..volume = pigeonMap['volume'] as double?;
+ }
+}
+
+class PlaybackSpeedMessage {
+ int? textureId;
+ double? speed;
+
+ Object encode() {
+ final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
+ pigeonMap['textureId'] = textureId;
+ pigeonMap['speed'] = speed;
+ return pigeonMap;
+ }
+
+ static PlaybackSpeedMessage decode(Object message) {
+ final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
+ return PlaybackSpeedMessage()
+ ..textureId = pigeonMap['textureId'] as int?
+ ..speed = pigeonMap['speed'] as double?;
+ }
+}
+
+class PositionMessage {
+ int? textureId;
+ int? position;
+
+ Object encode() {
+ final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
+ pigeonMap['textureId'] = textureId;
+ pigeonMap['position'] = position;
+ return pigeonMap;
+ }
+
+ static PositionMessage decode(Object message) {
+ final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
+ return PositionMessage()
+ ..textureId = pigeonMap['textureId'] as int?
+ ..position = pigeonMap['position'] as int?;
+ }
+}
+
+class MixWithOthersMessage {
+ bool? mixWithOthers;
+
+ Object encode() {
+ final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
+ pigeonMap['mixWithOthers'] = mixWithOthers;
+ return pigeonMap;
+ }
+
+ static MixWithOthersMessage decode(Object message) {
+ final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
+ return MixWithOthersMessage()
+ ..mixWithOthers = pigeonMap['mixWithOthers'] as bool?;
+ }
+}
+
+class VideoPlayerApi {
+ Future<void> initialize() async {
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.initialize', StandardMessageCodec());
+ final Map<Object?, Object?>? replyMap =
+ await channel.send(null) as Map<Object?, Object?>?;
+ if (replyMap == null) {
+ throw PlatformException(
+ code: 'channel-error',
+ message: 'Unable to establish connection on channel.',
+ details: null,
+ );
+ } else if (replyMap['error'] != null) {
+ final Map<Object?, Object?> error =
+ replyMap['error'] as Map<Object?, Object?>;
+ throw PlatformException(
+ code: error['code'] as String,
+ message: error['message'] as String?,
+ details: error['details'],
+ );
+ } else {
+ // noop
+ }
+ }
+
+ Future<TextureMessage> create(CreateMessage arg) async {
+ final Object encoded = arg.encode();
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.create', StandardMessageCodec());
+ final Map<Object?, Object?>? replyMap =
+ await channel.send(encoded) as Map<Object?, Object?>?;
+ if (replyMap == null) {
+ throw PlatformException(
+ code: 'channel-error',
+ message: 'Unable to establish connection on channel.',
+ details: null,
+ );
+ } else if (replyMap['error'] != null) {
+ final Map<Object?, Object?> error =
+ replyMap['error'] as Map<Object?, Object?>;
+ throw PlatformException(
+ code: error['code'] as String,
+ message: error['message'] as String?,
+ details: error['details'],
+ );
+ } else {
+ return TextureMessage.decode(replyMap['result']!);
+ }
+ }
+
+ Future<void> dispose(TextureMessage arg) async {
+ final Object encoded = arg.encode();
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.dispose', StandardMessageCodec());
+ final Map<Object?, Object?>? replyMap =
+ await channel.send(encoded) as Map<Object?, Object?>?;
+ if (replyMap == null) {
+ throw PlatformException(
+ code: 'channel-error',
+ message: 'Unable to establish connection on channel.',
+ details: null,
+ );
+ } else if (replyMap['error'] != null) {
+ final Map<Object?, Object?> error =
+ replyMap['error'] as Map<Object?, Object?>;
+ throw PlatformException(
+ code: error['code'] as String,
+ message: error['message'] as String?,
+ details: error['details'],
+ );
+ } else {
+ // noop
+ }
+ }
+
+ Future<void> setLooping(LoopingMessage arg) async {
+ final Object encoded = arg.encode();
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.setLooping', StandardMessageCodec());
+ final Map<Object?, Object?>? replyMap =
+ await channel.send(encoded) as Map<Object?, Object?>?;
+ if (replyMap == null) {
+ throw PlatformException(
+ code: 'channel-error',
+ message: 'Unable to establish connection on channel.',
+ details: null,
+ );
+ } else if (replyMap['error'] != null) {
+ final Map<Object?, Object?> error =
+ replyMap['error'] as Map<Object?, Object?>;
+ throw PlatformException(
+ code: error['code'] as String,
+ message: error['message'] as String?,
+ details: error['details'],
+ );
+ } else {
+ // noop
+ }
+ }
+
+ Future<void> setVolume(VolumeMessage arg) async {
+ final Object encoded = arg.encode();
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.setVolume', StandardMessageCodec());
+ final Map<Object?, Object?>? replyMap =
+ await channel.send(encoded) as Map<Object?, Object?>?;
+ if (replyMap == null) {
+ throw PlatformException(
+ code: 'channel-error',
+ message: 'Unable to establish connection on channel.',
+ details: null,
+ );
+ } else if (replyMap['error'] != null) {
+ final Map<Object?, Object?> error =
+ replyMap['error'] as Map<Object?, Object?>;
+ throw PlatformException(
+ code: error['code'] as String,
+ message: error['message'] as String?,
+ details: error['details'],
+ );
+ } else {
+ // noop
+ }
+ }
+
+ Future<void> setPlaybackSpeed(PlaybackSpeedMessage arg) async {
+ final Object encoded = arg.encode();
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.setPlaybackSpeed',
+ StandardMessageCodec());
+ final Map<Object?, Object?>? replyMap =
+ await channel.send(encoded) as Map<Object?, Object?>?;
+ if (replyMap == null) {
+ throw PlatformException(
+ code: 'channel-error',
+ message: 'Unable to establish connection on channel.',
+ details: null,
+ );
+ } else if (replyMap['error'] != null) {
+ final Map<Object?, Object?> error =
+ replyMap['error'] as Map<Object?, Object?>;
+ throw PlatformException(
+ code: error['code'] as String,
+ message: error['message'] as String?,
+ details: error['details'],
+ );
+ } else {
+ // noop
+ }
+ }
+
+ Future<void> play(TextureMessage arg) async {
+ final Object encoded = arg.encode();
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.play', StandardMessageCodec());
+ final Map<Object?, Object?>? replyMap =
+ await channel.send(encoded) as Map<Object?, Object?>?;
+ if (replyMap == null) {
+ throw PlatformException(
+ code: 'channel-error',
+ message: 'Unable to establish connection on channel.',
+ details: null,
+ );
+ } else if (replyMap['error'] != null) {
+ final Map<Object?, Object?> error =
+ replyMap['error'] as Map<Object?, Object?>;
+ throw PlatformException(
+ code: error['code'] as String,
+ message: error['message'] as String?,
+ details: error['details'],
+ );
+ } else {
+ // noop
+ }
+ }
+
+ Future<PositionMessage> position(TextureMessage arg) async {
+ final Object encoded = arg.encode();
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.position', StandardMessageCodec());
+ final Map<Object?, Object?>? replyMap =
+ await channel.send(encoded) as Map<Object?, Object?>?;
+ if (replyMap == null) {
+ throw PlatformException(
+ code: 'channel-error',
+ message: 'Unable to establish connection on channel.',
+ details: null,
+ );
+ } else if (replyMap['error'] != null) {
+ final Map<Object?, Object?> error =
+ replyMap['error'] as Map<Object?, Object?>;
+ throw PlatformException(
+ code: error['code'] as String,
+ message: error['message'] as String?,
+ details: error['details'],
+ );
+ } else {
+ return PositionMessage.decode(replyMap['result']!);
+ }
+ }
+
+ Future<void> seekTo(PositionMessage arg) async {
+ final Object encoded = arg.encode();
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.seekTo', StandardMessageCodec());
+ final Map<Object?, Object?>? replyMap =
+ await channel.send(encoded) as Map<Object?, Object?>?;
+ if (replyMap == null) {
+ throw PlatformException(
+ code: 'channel-error',
+ message: 'Unable to establish connection on channel.',
+ details: null,
+ );
+ } else if (replyMap['error'] != null) {
+ final Map<Object?, Object?> error =
+ replyMap['error'] as Map<Object?, Object?>;
+ throw PlatformException(
+ code: error['code'] as String,
+ message: error['message'] as String?,
+ details: error['details'],
+ );
+ } else {
+ // noop
+ }
+ }
+
+ Future<void> pause(TextureMessage arg) async {
+ final Object encoded = arg.encode();
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.pause', StandardMessageCodec());
+ final Map<Object?, Object?>? replyMap =
+ await channel.send(encoded) as Map<Object?, Object?>?;
+ if (replyMap == null) {
+ throw PlatformException(
+ code: 'channel-error',
+ message: 'Unable to establish connection on channel.',
+ details: null,
+ );
+ } else if (replyMap['error'] != null) {
+ final Map<Object?, Object?> error =
+ replyMap['error'] as Map<Object?, Object?>;
+ throw PlatformException(
+ code: error['code'] as String,
+ message: error['message'] as String?,
+ details: error['details'],
+ );
+ } else {
+ // noop
+ }
+ }
+
+ Future<void> setMixWithOthers(MixWithOthersMessage arg) async {
+ final Object encoded = arg.encode();
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.setMixWithOthers',
+ StandardMessageCodec());
+ final Map<Object?, Object?>? replyMap =
+ await channel.send(encoded) as Map<Object?, Object?>?;
+ if (replyMap == null) {
+ throw PlatformException(
+ code: 'channel-error',
+ message: 'Unable to establish connection on channel.',
+ details: null,
+ );
+ } else if (replyMap['error'] != null) {
+ final Map<Object?, Object?> error =
+ replyMap['error'] as Map<Object?, Object?>;
+ throw PlatformException(
+ code: error['code'] as String,
+ message: error['message'] as String?,
+ details: error['details'],
+ );
+ } else {
+ // noop
+ }
+ }
+}
diff --git a/packages/video_player/video_player_avfoundation/lib/video_player_avfoundation.dart b/packages/video_player/video_player_avfoundation/lib/video_player_avfoundation.dart
new file mode 100644
index 0000000..b36daa1
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/lib/video_player_avfoundation.dart
@@ -0,0 +1,5 @@
+// Copyright 2013 The Flutter Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+export 'src/avfoundation_video_player.dart';
diff --git a/packages/video_player/video_player/pigeons/messages.dart b/packages/video_player/video_player_avfoundation/pigeons/messages.dart
similarity index 91%
copy from packages/video_player/video_player/pigeons/messages.dart
copy to packages/video_player/video_player_avfoundation/pigeons/messages.dart
index e893aaa..42d9640 100644
--- a/packages/video_player/video_player/pigeons/messages.dart
+++ b/packages/video_player/video_player_avfoundation/pigeons/messages.dart
@@ -58,8 +58,8 @@
}
void configurePigeon(PigeonOptions opts) {
- opts.dartOut = '../video_player_platform_interface/lib/messages.dart';
- opts.dartTestOut = '../video_player_platform_interface/lib/test.dart';
+ opts.dartOut = 'lib/src/messages.dart';
+ opts.dartTestOut = 'test/test_api.dart';
opts.objcHeaderOut = 'ios/Classes/messages.h';
opts.objcSourceOut = 'ios/Classes/messages.m';
opts.objcOptions.prefix = 'FLT';
diff --git a/packages/video_player/video_player_avfoundation/pubspec.yaml b/packages/video_player/video_player_avfoundation/pubspec.yaml
new file mode 100644
index 0000000..82ffede
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/pubspec.yaml
@@ -0,0 +1,27 @@
+name: video_player_avfoundation
+description: iOS implementation of the video_player plugin.
+repository: https://github.com/flutter/plugins/tree/master/packages/video_player/video_player_avfoundation
+issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+video_player%22
+version: 2.2.17
+
+environment:
+ sdk: ">=2.14.0 <3.0.0"
+ flutter: ">=2.8.0"
+
+flutter:
+ plugin:
+ implements: video_player
+ platforms:
+ ios:
+ dartPluginClass: AVFoundationVideoPlayer
+ pluginClass: FLTVideoPlayerPlugin
+
+dependencies:
+ flutter:
+ sdk: flutter
+ video_player_platform_interface: ">=4.2.0 <6.0.0"
+
+dev_dependencies:
+ flutter_test:
+ sdk: flutter
+ pigeon: ^0.1.21
diff --git a/packages/video_player/video_player_avfoundation/test/avfoundation_video_player_test.dart b/packages/video_player/video_player_avfoundation/test/avfoundation_video_player_test.dart
new file mode 100644
index 0000000..adb29a5
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/test/avfoundation_video_player_test.dart
@@ -0,0 +1,341 @@
+// Copyright 2013 The Flutter Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+import 'dart:ui';
+
+import 'package:flutter/services.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:video_player_avfoundation/src/messages.dart';
+import 'package:video_player_avfoundation/video_player_avfoundation.dart';
+import 'package:video_player_platform_interface/video_player_platform_interface.dart';
+
+import 'test_api.dart';
+
+class _ApiLogger implements TestHostVideoPlayerApi {
+ final List<String> log = <String>[];
+ TextureMessage? textureMessage;
+ CreateMessage? createMessage;
+ PositionMessage? positionMessage;
+ LoopingMessage? loopingMessage;
+ VolumeMessage? volumeMessage;
+ PlaybackSpeedMessage? playbackSpeedMessage;
+ MixWithOthersMessage? mixWithOthersMessage;
+
+ @override
+ TextureMessage create(CreateMessage arg) {
+ log.add('create');
+ createMessage = arg;
+ return TextureMessage()..textureId = 3;
+ }
+
+ @override
+ void dispose(TextureMessage arg) {
+ log.add('dispose');
+ textureMessage = arg;
+ }
+
+ @override
+ void initialize() {
+ log.add('init');
+ }
+
+ @override
+ void pause(TextureMessage arg) {
+ log.add('pause');
+ textureMessage = arg;
+ }
+
+ @override
+ void play(TextureMessage arg) {
+ log.add('play');
+ textureMessage = arg;
+ }
+
+ @override
+ void setMixWithOthers(MixWithOthersMessage arg) {
+ log.add('setMixWithOthers');
+ mixWithOthersMessage = arg;
+ }
+
+ @override
+ PositionMessage position(TextureMessage arg) {
+ log.add('position');
+ textureMessage = arg;
+ return PositionMessage()..position = 234;
+ }
+
+ @override
+ void seekTo(PositionMessage arg) {
+ log.add('seekTo');
+ positionMessage = arg;
+ }
+
+ @override
+ void setLooping(LoopingMessage arg) {
+ log.add('setLooping');
+ loopingMessage = arg;
+ }
+
+ @override
+ void setVolume(VolumeMessage arg) {
+ log.add('setVolume');
+ volumeMessage = arg;
+ }
+
+ @override
+ void setPlaybackSpeed(PlaybackSpeedMessage arg) {
+ log.add('setPlaybackSpeed');
+ playbackSpeedMessage = arg;
+ }
+}
+
+void main() {
+ TestWidgetsFlutterBinding.ensureInitialized();
+
+ test('registration', () async {
+ AVFoundationVideoPlayer.registerWith();
+ expect(VideoPlayerPlatform.instance, isA<AVFoundationVideoPlayer>());
+ });
+
+ group('$AVFoundationVideoPlayer', () {
+ final AVFoundationVideoPlayer player = AVFoundationVideoPlayer();
+ late _ApiLogger log;
+
+ setUp(() {
+ log = _ApiLogger();
+ TestHostVideoPlayerApi.setup(log);
+ });
+
+ test('init', () async {
+ await player.init();
+ expect(
+ log.log.last,
+ 'init',
+ );
+ });
+
+ test('dispose', () async {
+ await player.dispose(1);
+ expect(log.log.last, 'dispose');
+ expect(log.textureMessage?.textureId, 1);
+ });
+
+ test('create with asset', () async {
+ final int? textureId = await player.create(DataSource(
+ sourceType: DataSourceType.asset,
+ asset: 'someAsset',
+ package: 'somePackage',
+ ));
+ expect(log.log.last, 'create');
+ expect(log.createMessage?.asset, 'someAsset');
+ expect(log.createMessage?.packageName, 'somePackage');
+ expect(textureId, 3);
+ });
+
+ test('create with network', () async {
+ final int? textureId = await player.create(DataSource(
+ sourceType: DataSourceType.network,
+ uri: 'someUri',
+ formatHint: VideoFormat.dash,
+ ));
+ expect(log.log.last, 'create');
+ expect(log.createMessage?.asset, null);
+ expect(log.createMessage?.uri, 'someUri');
+ expect(log.createMessage?.packageName, null);
+ expect(log.createMessage?.formatHint, 'dash');
+ expect(log.createMessage?.httpHeaders, <String, String>{});
+ expect(textureId, 3);
+ });
+
+ test('create with network (some headers)', () async {
+ final int? textureId = await player.create(DataSource(
+ sourceType: DataSourceType.network,
+ uri: 'someUri',
+ httpHeaders: <String, String>{'Authorization': 'Bearer token'},
+ ));
+ expect(log.log.last, 'create');
+ expect(log.createMessage?.asset, null);
+ expect(log.createMessage?.uri, 'someUri');
+ expect(log.createMessage?.packageName, null);
+ expect(log.createMessage?.formatHint, null);
+ expect(log.createMessage?.httpHeaders,
+ <String, String>{'Authorization': 'Bearer token'});
+ expect(textureId, 3);
+ });
+
+ test('create with file', () async {
+ final int? textureId = await player.create(DataSource(
+ sourceType: DataSourceType.file,
+ uri: 'someUri',
+ ));
+ expect(log.log.last, 'create');
+ expect(log.createMessage?.uri, 'someUri');
+ expect(textureId, 3);
+ });
+
+ test('setLooping', () async {
+ await player.setLooping(1, true);
+ expect(log.log.last, 'setLooping');
+ expect(log.loopingMessage?.textureId, 1);
+ expect(log.loopingMessage?.isLooping, true);
+ });
+
+ test('play', () async {
+ await player.play(1);
+ expect(log.log.last, 'play');
+ expect(log.textureMessage?.textureId, 1);
+ });
+
+ test('pause', () async {
+ await player.pause(1);
+ expect(log.log.last, 'pause');
+ expect(log.textureMessage?.textureId, 1);
+ });
+
+ test('setMixWithOthers', () async {
+ await player.setMixWithOthers(true);
+ expect(log.log.last, 'setMixWithOthers');
+ expect(log.mixWithOthersMessage?.mixWithOthers, true);
+
+ await player.setMixWithOthers(false);
+ expect(log.log.last, 'setMixWithOthers');
+ expect(log.mixWithOthersMessage?.mixWithOthers, false);
+ });
+
+ test('setVolume', () async {
+ await player.setVolume(1, 0.7);
+ expect(log.log.last, 'setVolume');
+ expect(log.volumeMessage?.textureId, 1);
+ expect(log.volumeMessage?.volume, 0.7);
+ });
+
+ test('setPlaybackSpeed', () async {
+ await player.setPlaybackSpeed(1, 1.5);
+ expect(log.log.last, 'setPlaybackSpeed');
+ expect(log.playbackSpeedMessage?.textureId, 1);
+ expect(log.playbackSpeedMessage?.speed, 1.5);
+ });
+
+ test('seekTo', () async {
+ await player.seekTo(1, const Duration(milliseconds: 12345));
+ expect(log.log.last, 'seekTo');
+ expect(log.positionMessage?.textureId, 1);
+ expect(log.positionMessage?.position, 12345);
+ });
+
+ test('getPosition', () async {
+ final Duration position = await player.getPosition(1);
+ expect(log.log.last, 'position');
+ expect(log.textureMessage?.textureId, 1);
+ expect(position, const Duration(milliseconds: 234));
+ });
+
+ test('videoEventsFor', () async {
+ _ambiguate(ServicesBinding.instance)
+ ?.defaultBinaryMessenger
+ .setMockMessageHandler(
+ 'flutter.io/videoPlayer/videoEvents123',
+ (ByteData? message) async {
+ final MethodCall methodCall =
+ const StandardMethodCodec().decodeMethodCall(message);
+ if (methodCall.method == 'listen') {
+ await _ambiguate(ServicesBinding.instance)
+ ?.defaultBinaryMessenger
+ .handlePlatformMessage(
+ 'flutter.io/videoPlayer/videoEvents123',
+ const StandardMethodCodec()
+ .encodeSuccessEnvelope(<String, dynamic>{
+ 'event': 'initialized',
+ 'duration': 98765,
+ 'width': 1920,
+ 'height': 1080,
+ }),
+ (ByteData? data) {});
+
+ await _ambiguate(ServicesBinding.instance)
+ ?.defaultBinaryMessenger
+ .handlePlatformMessage(
+ 'flutter.io/videoPlayer/videoEvents123',
+ const StandardMethodCodec()
+ .encodeSuccessEnvelope(<String, dynamic>{
+ 'event': 'completed',
+ }),
+ (ByteData? data) {});
+
+ await _ambiguate(ServicesBinding.instance)
+ ?.defaultBinaryMessenger
+ .handlePlatformMessage(
+ 'flutter.io/videoPlayer/videoEvents123',
+ const StandardMethodCodec()
+ .encodeSuccessEnvelope(<String, dynamic>{
+ 'event': 'bufferingUpdate',
+ 'values': <List<dynamic>>[
+ <int>[0, 1234],
+ <int>[1235, 4000],
+ ],
+ }),
+ (ByteData? data) {});
+
+ await _ambiguate(ServicesBinding.instance)
+ ?.defaultBinaryMessenger
+ .handlePlatformMessage(
+ 'flutter.io/videoPlayer/videoEvents123',
+ const StandardMethodCodec()
+ .encodeSuccessEnvelope(<String, dynamic>{
+ 'event': 'bufferingStart',
+ }),
+ (ByteData? data) {});
+
+ await _ambiguate(ServicesBinding.instance)
+ ?.defaultBinaryMessenger
+ .handlePlatformMessage(
+ 'flutter.io/videoPlayer/videoEvents123',
+ const StandardMethodCodec()
+ .encodeSuccessEnvelope(<String, dynamic>{
+ 'event': 'bufferingEnd',
+ }),
+ (ByteData? data) {});
+
+ return const StandardMethodCodec().encodeSuccessEnvelope(null);
+ } else if (methodCall.method == 'cancel') {
+ return const StandardMethodCodec().encodeSuccessEnvelope(null);
+ } else {
+ fail('Expected listen or cancel');
+ }
+ },
+ );
+ expect(
+ player.videoEventsFor(123),
+ emitsInOrder(<dynamic>[
+ VideoEvent(
+ eventType: VideoEventType.initialized,
+ duration: const Duration(milliseconds: 98765),
+ size: const Size(1920, 1080),
+ ),
+ VideoEvent(eventType: VideoEventType.completed),
+ VideoEvent(
+ eventType: VideoEventType.bufferingUpdate,
+ buffered: <DurationRange>[
+ DurationRange(
+ const Duration(milliseconds: 0),
+ const Duration(milliseconds: 1234),
+ ),
+ DurationRange(
+ const Duration(milliseconds: 1235),
+ const Duration(milliseconds: 4000),
+ ),
+ ]),
+ VideoEvent(eventType: VideoEventType.bufferingStart),
+ VideoEvent(eventType: VideoEventType.bufferingEnd),
+ ]));
+ });
+ });
+}
+
+/// This allows a value of type T or T? to be treated as a value of type T?.
+///
+/// We use this so that APIs that have become non-nullable can still be used
+/// with `!` and `?` on the stable branch.
+// TODO(ianh): Remove this once we roll stable in late 2021.
+T? _ambiguate<T>(T? value) => value;
diff --git a/packages/video_player/video_player_avfoundation/test/test_api.dart b/packages/video_player/video_player_avfoundation/test/test_api.dart
new file mode 100644
index 0000000..b173705
--- /dev/null
+++ b/packages/video_player/video_player_avfoundation/test/test_api.dart
@@ -0,0 +1,199 @@
+// Copyright 2013 The Flutter Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Autogenerated from Pigeon (v0.1.21), do not edit directly.
+// See also: https://pub.dev/packages/pigeon
+// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import
+// @dart = 2.12
+import 'dart:async';
+import 'dart:typed_data' show Uint8List, Int32List, Int64List, Float64List;
+import 'package:flutter/services.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:video_player_avfoundation/src/messages.dart';
+
+abstract class TestHostVideoPlayerApi {
+ void initialize();
+ TextureMessage create(CreateMessage arg);
+ void dispose(TextureMessage arg);
+ void setLooping(LoopingMessage arg);
+ void setVolume(VolumeMessage arg);
+ void setPlaybackSpeed(PlaybackSpeedMessage arg);
+ void play(TextureMessage arg);
+ PositionMessage position(TextureMessage arg);
+ void seekTo(PositionMessage arg);
+ void pause(TextureMessage arg);
+ void setMixWithOthers(MixWithOthersMessage arg);
+ static void setup(TestHostVideoPlayerApi? api) {
+ {
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.initialize',
+ StandardMessageCodec());
+ if (api == null) {
+ channel.setMockMessageHandler(null);
+ } else {
+ channel.setMockMessageHandler((Object? message) async {
+ // ignore message
+ api.initialize();
+ return <Object?, Object?>{};
+ });
+ }
+ }
+ {
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.create', StandardMessageCodec());
+ if (api == null) {
+ channel.setMockMessageHandler(null);
+ } else {
+ channel.setMockMessageHandler((Object? message) async {
+ assert(message != null,
+ 'Argument for dev.flutter.pigeon.VideoPlayerApi.create was null. Expected CreateMessage.');
+ final CreateMessage input = CreateMessage.decode(message!);
+ final TextureMessage output = api.create(input);
+ return <Object?, Object?>{'result': output.encode()};
+ });
+ }
+ }
+ {
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.dispose', StandardMessageCodec());
+ if (api == null) {
+ channel.setMockMessageHandler(null);
+ } else {
+ channel.setMockMessageHandler((Object? message) async {
+ assert(message != null,
+ 'Argument for dev.flutter.pigeon.VideoPlayerApi.dispose was null. Expected TextureMessage.');
+ final TextureMessage input = TextureMessage.decode(message!);
+ api.dispose(input);
+ return <Object?, Object?>{};
+ });
+ }
+ }
+ {
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.setLooping',
+ StandardMessageCodec());
+ if (api == null) {
+ channel.setMockMessageHandler(null);
+ } else {
+ channel.setMockMessageHandler((Object? message) async {
+ assert(message != null,
+ 'Argument for dev.flutter.pigeon.VideoPlayerApi.setLooping was null. Expected LoopingMessage.');
+ final LoopingMessage input = LoopingMessage.decode(message!);
+ api.setLooping(input);
+ return <Object?, Object?>{};
+ });
+ }
+ }
+ {
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.setVolume',
+ StandardMessageCodec());
+ if (api == null) {
+ channel.setMockMessageHandler(null);
+ } else {
+ channel.setMockMessageHandler((Object? message) async {
+ assert(message != null,
+ 'Argument for dev.flutter.pigeon.VideoPlayerApi.setVolume was null. Expected VolumeMessage.');
+ final VolumeMessage input = VolumeMessage.decode(message!);
+ api.setVolume(input);
+ return <Object?, Object?>{};
+ });
+ }
+ }
+ {
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.setPlaybackSpeed',
+ StandardMessageCodec());
+ if (api == null) {
+ channel.setMockMessageHandler(null);
+ } else {
+ channel.setMockMessageHandler((Object? message) async {
+ assert(message != null,
+ 'Argument for dev.flutter.pigeon.VideoPlayerApi.setPlaybackSpeed was null. Expected PlaybackSpeedMessage.');
+ final PlaybackSpeedMessage input =
+ PlaybackSpeedMessage.decode(message!);
+ api.setPlaybackSpeed(input);
+ return <Object?, Object?>{};
+ });
+ }
+ }
+ {
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.play', StandardMessageCodec());
+ if (api == null) {
+ channel.setMockMessageHandler(null);
+ } else {
+ channel.setMockMessageHandler((Object? message) async {
+ assert(message != null,
+ 'Argument for dev.flutter.pigeon.VideoPlayerApi.play was null. Expected TextureMessage.');
+ final TextureMessage input = TextureMessage.decode(message!);
+ api.play(input);
+ return <Object?, Object?>{};
+ });
+ }
+ }
+ {
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.position', StandardMessageCodec());
+ if (api == null) {
+ channel.setMockMessageHandler(null);
+ } else {
+ channel.setMockMessageHandler((Object? message) async {
+ assert(message != null,
+ 'Argument for dev.flutter.pigeon.VideoPlayerApi.position was null. Expected TextureMessage.');
+ final TextureMessage input = TextureMessage.decode(message!);
+ final PositionMessage output = api.position(input);
+ return <Object?, Object?>{'result': output.encode()};
+ });
+ }
+ }
+ {
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.seekTo', StandardMessageCodec());
+ if (api == null) {
+ channel.setMockMessageHandler(null);
+ } else {
+ channel.setMockMessageHandler((Object? message) async {
+ assert(message != null,
+ 'Argument for dev.flutter.pigeon.VideoPlayerApi.seekTo was null. Expected PositionMessage.');
+ final PositionMessage input = PositionMessage.decode(message!);
+ api.seekTo(input);
+ return <Object?, Object?>{};
+ });
+ }
+ }
+ {
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.pause', StandardMessageCodec());
+ if (api == null) {
+ channel.setMockMessageHandler(null);
+ } else {
+ channel.setMockMessageHandler((Object? message) async {
+ assert(message != null,
+ 'Argument for dev.flutter.pigeon.VideoPlayerApi.pause was null. Expected TextureMessage.');
+ final TextureMessage input = TextureMessage.decode(message!);
+ api.pause(input);
+ return <Object?, Object?>{};
+ });
+ }
+ }
+ {
+ const BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.VideoPlayerApi.setMixWithOthers',
+ StandardMessageCodec());
+ if (api == null) {
+ channel.setMockMessageHandler(null);
+ } else {
+ channel.setMockMessageHandler((Object? message) async {
+ assert(message != null,
+ 'Argument for dev.flutter.pigeon.VideoPlayerApi.setMixWithOthers was null. Expected MixWithOthersMessage.');
+ final MixWithOthersMessage input =
+ MixWithOthersMessage.decode(message!);
+ api.setMixWithOthers(input);
+ return <Object?, Object?>{};
+ });
+ }
+ }
+ }
+}
diff --git a/packages/video_player/video_player_platform_interface/CHANGELOG.md b/packages/video_player/video_player_platform_interface/CHANGELOG.md
index bf51960..8d295aa 100644
--- a/packages/video_player/video_player_platform_interface/CHANGELOG.md
+++ b/packages/video_player/video_player_platform_interface/CHANGELOG.md
@@ -1,3 +1,7 @@
+## NEXT
+
+* Adds the Pigeon definitions used to create the method channel implementation.
+
## 5.0.1
* Update to use the `verify` method introduced in platform_plugin_interface 2.1.0.
diff --git a/packages/video_player/video_player_platform_interface/CONTRIBUTING.md b/packages/video_player/video_player_platform_interface/CONTRIBUTING.md
new file mode 100644
index 0000000..dbbfbf6
--- /dev/null
+++ b/packages/video_player/video_player_platform_interface/CONTRIBUTING.md
@@ -0,0 +1,46 @@
+## Updating pigeon-generated files
+
+**WARNING**: Because `messages.dart` is part of the public API of this package,
+breaking changes in that file are breaking changes for the package. This means
+that:
+- You should never update the version of Pigeon used for this package unless
+ making a breaking change to the package for other reasons.
+- Because the method channel is a legacy implementation for compatibility with
+ existing third-party `video_player` implementations, in many cases the best
+ option may be to simply not implemented new features in
+ `MethodChannelVideoPlayer`. Breaking changes in this package should never
+ be made solely to change `MethodChannelVideoPlayer`.
+
+### Update process
+
+If you update files in the pigeons/ directory, run the following
+command in this directory (ignore the errors you get about
+dependencies in the examples directory):
+
+```bash
+flutter pub upgrade
+flutter pub run pigeon --dart_null_safety --input pigeons/messages.dart
+# git commit your changes so that your working environment is clean
+(cd ../../../; ./script/tool_runner.sh format --clang-format=clang-format-7)
+```
+
+If you update pigeon itself and want to test the changes here,
+temporarily update the pubspec.yaml by adding the following to the
+`dependency_overrides` section, assuming you have checked out the
+`flutter/packages` repo in a sibling directory to the `plugins` repo:
+
+```yaml
+ pigeon:
+ path:
+ ../../../../packages/packages/pigeon/
+```
+
+Then, run the commands above. When you run `pub get` it should warn
+you that you're using an override. If you do this, you will need to
+publish pigeon before you can land the updates to this package, since
+the CI tests run the analysis using latest published version of
+pigeon, not your version or the version on master.
+
+In either case, the configuration will be obtained automatically from
+the `pigeons/messages.dart` file (see `configurePigeon` at the bottom
+of that file).
diff --git a/packages/video_player/video_player_platform_interface/lib/method_channel_video_player.dart b/packages/video_player/video_player_platform_interface/lib/method_channel_video_player.dart
index e01e5b8..31d1839 100644
--- a/packages/video_player/video_player_platform_interface/lib/method_channel_video_player.dart
+++ b/packages/video_player/video_player_platform_interface/lib/method_channel_video_player.dart
@@ -12,6 +12,10 @@
import 'video_player_platform_interface.dart';
/// An implementation of [VideoPlayerPlatform] that uses method channels.
+///
+/// This is the default implementation, for compatibility with existing
+/// third-party implementations. It is not used by other implementations in
+/// this repository.
class MethodChannelVideoPlayer extends VideoPlayerPlatform {
VideoPlayerApi _api = VideoPlayerApi();
diff --git a/packages/video_player/video_player/pigeons/messages.dart b/packages/video_player/video_player_platform_interface/pigeons/messages.dart
similarity index 74%
copy from packages/video_player/video_player/pigeons/messages.dart
copy to packages/video_player/video_player_platform_interface/pigeons/messages.dart
index e893aaa..144edb6 100644
--- a/packages/video_player/video_player/pigeons/messages.dart
+++ b/packages/video_player/video_player_platform_interface/pigeons/messages.dart
@@ -58,12 +58,6 @@
}
void configurePigeon(PigeonOptions opts) {
- opts.dartOut = '../video_player_platform_interface/lib/messages.dart';
- opts.dartTestOut = '../video_player_platform_interface/lib/test.dart';
- opts.objcHeaderOut = 'ios/Classes/messages.h';
- opts.objcSourceOut = 'ios/Classes/messages.m';
- opts.objcOptions.prefix = 'FLT';
- opts.javaOut =
- 'android/src/main/java/io/flutter/plugins/videoplayer/Messages.java';
- opts.javaOptions.package = 'io.flutter.plugins.videoplayer';
+ opts.dartOut = 'lib/messages.dart';
+ opts.dartTestOut = 'test/test.dart';
}
diff --git a/packages/video_player/video_player_platform_interface/pubspec.yaml b/packages/video_player/video_player_platform_interface/pubspec.yaml
index f0448f7..b7d5745 100644
--- a/packages/video_player/video_player_platform_interface/pubspec.yaml
+++ b/packages/video_player/video_player_platform_interface/pubspec.yaml
@@ -19,3 +19,4 @@
flutter_test:
sdk: flutter
pedantic: ^1.10.0
+ pigeon: 0.1.21