Skip to content

Commit 1be573f

Browse files
committed
Oficial files video_player
1 parent a6d1f43 commit 1be573f

File tree

78 files changed

+3830
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+3830
-0
lines changed

CHANGELOG.md

+177
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
## 0.10.0+4
2+
3+
* Android: Upgrade ExoPlayer to 2.9.6.
4+
5+
## 0.10.0+3
6+
7+
* Fix divide by zero bug on iOS.
8+
9+
## 0.10.0+2
10+
11+
* Added supported format documentation in README.
12+
13+
## 0.10.0+1
14+
15+
* Log a more detailed warning at build time about the previous AndroidX
16+
migration.
17+
18+
## 0.10.0
19+
20+
* **Breaking change**. Migrate from the deprecated original Android Support
21+
Library to AndroidX. This shouldn't result in any functional changes, but it
22+
requires any Android apps using this plugin to [also
23+
migrate](https://developer.android.com/jetpack/androidx/migrate) if they're
24+
using the original support library.
25+
26+
## 0.9.0
27+
28+
* Fixed the aspect ratio and orientation of videos. Videos are now properly displayed when recorded
29+
in portrait mode both in iOS and Android.
30+
31+
## 0.8.0
32+
33+
* Android: Upgrade ExoPlayer to 2.9.1
34+
* Android: Use current gradle dependencies
35+
* Android 9 compatibility fixes for Demo App
36+
37+
## 0.7.2
38+
39+
* Updated to use factories on exoplayer `MediaSource`s for Android instead of the now-deprecated constructors.
40+
41+
## 0.7.1
42+
43+
* Fixed null exception on Android when the video has a width or height of 0.
44+
45+
## 0.7.0
46+
47+
* Add a unit test for controller and texture changes. This is a breaking change since the interface
48+
had to be cleaned up to facilitate faking.
49+
50+
## 0.6.6
51+
52+
* Fix the condition where the player doesn't update when attached controller is changed.
53+
54+
## 0.6.5
55+
56+
* Eliminate race conditions around initialization: now initialization events are queued and guaranteed
57+
to be delivered to the Dart side. VideoPlayer widget is rebuilt upon completion of initialization.
58+
59+
## 0.6.4
60+
61+
* Android: add support for hls, dash and ss video formats.
62+
63+
## 0.6.3
64+
65+
* iOS: Allow audio playback in silent mode.
66+
67+
## 0.6.2
68+
69+
* `VideoPlayerController.seekTo()` is now frame accurate on both platforms.
70+
71+
## 0.6.1
72+
73+
* iOS: add missing observer removals to prevent crashes on deallocation.
74+
75+
## 0.6.0
76+
77+
* Android: use ExoPlayer instead of MediaPlayer for better video format support.
78+
79+
## 0.5.5
80+
81+
* **Breaking change** `VideoPlayerController.initialize()` now only completes after the controller is initialized.
82+
* Updated example in README.md.
83+
84+
## 0.5.4
85+
86+
* Updated Gradle tooling to match Android Studio 3.1.2.
87+
88+
## 0.5.3
89+
90+
* Added video buffering status.
91+
92+
## 0.5.2
93+
94+
* Fixed a bug on iOS that could lead to missing initialization.
95+
* Added support for HLS video on iOS.
96+
97+
## 0.5.1
98+
99+
* Fixed bug on video loop feature for iOS.
100+
101+
## 0.5.0
102+
103+
* Added the constructor `VideoPlayerController.file`.
104+
* **Breaking change**. Changed `VideoPlayerController.isNetwork` to
105+
an enum `VideoPlayerController.dataSourceType`.
106+
107+
## 0.4.1
108+
109+
* Updated Flutter SDK constraint to reflect the changes in v0.4.0.
110+
111+
## 0.4.0
112+
113+
* **Breaking change**. Removed the `VideoPlayerController` constructor
114+
* Added two new factory constructors `VideoPlayerController.asset` and
115+
`VideoPlayerController.network` to respectively play a video from the
116+
Flutter assets and from a network uri.
117+
118+
## 0.3.0
119+
120+
* **Breaking change**. Set SDK constraints to match the Flutter beta release.
121+
122+
## 0.2.1
123+
124+
* Fixed some signatures to account for strong mode runtime errors.
125+
* Fixed spelling mistake in toString output.
126+
127+
## 0.2.0
128+
129+
* **Breaking change**. Renamed `VideoPlayerController.isErroneous` to `VideoPlayerController.hasError`.
130+
* Updated documentation of when fields are available on `VideoPlayerController`.
131+
* Updated links in README.md.
132+
133+
## 0.1.1
134+
135+
* Simplified and upgraded Android project template to Android SDK 27.
136+
* Moved Android package to io.flutter.plugins.
137+
* Fixed warnings from the Dart 2.0 analyzer.
138+
139+
## 0.1.0
140+
141+
* **Breaking change**. Upgraded to Gradle 4.1 and Android Studio Gradle plugin
142+
3.0.1. Older Flutter projects need to upgrade their Gradle setup as well in
143+
order to use this version of the plugin. Instructions can be found
144+
[here](https://github.com/flutter/flutter/wiki/Updating-Flutter-projects-to-Gradle-4.1-and-Android-Studio-Gradle-plugin-3.0.1).
145+
146+
## 0.0.7
147+
148+
* Added access to the video size.
149+
* Made the VideoProgressIndicator render using a LinearProgressIndicator.
150+
151+
## 0.0.6
152+
153+
* Fixed a bug related to hot restart on Android.
154+
155+
## 0.0.5
156+
157+
* Added VideoPlayerValue.toString().
158+
* Added FLT prefix to iOS types.
159+
160+
## 0.0.4
161+
162+
* The player will now pause on app pause, and resume on app resume.
163+
* Implemented scrubbing on the progress bar.
164+
165+
## 0.0.3
166+
167+
* Made creating a VideoPlayerController a synchronous operation. Must be followed by a call to initialize().
168+
* Added VideoPlayerController.setVolume().
169+
* Moved the package to flutter/plugins github repo.
170+
171+
## 0.0.2
172+
173+
* Fix meta dependency version.
174+
175+
## 0.0.1
176+
177+
* Initial release

LICENSE

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright 2017 The Chromium Authors. All rights reserved.
2+
//
3+
// Redistribution and use in source and binary forms, with or without
4+
// modification, are permitted provided that the following conditions are
5+
// met:
6+
//
7+
// * Redistributions of source code must retain the above copyright
8+
// notice, this list of conditions and the following disclaimer.
9+
// * Redistributions in binary form must reproduce the above
10+
// copyright notice, this list of conditions and the following disclaimer
11+
// in the documentation and/or other materials provided with the
12+
// distribution.
13+
// * Neither the name of Google Inc. nor the names of its
14+
// contributors may be used to endorse or promote products derived from
15+
// this software without specific prior written permission.
16+
//
17+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

+116
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,118 @@
11
# flutter_video_player
22
This plugin is a copy of the official plugin "video_player" but it has a method that makes it possible to change the MediaSource without having to redraw the video controller.
3+
4+
# Oficial install:
5+
6+
# Video Player plugin for Flutter
7+
8+
[![pub package](https://img.shields.io/pub/v/video_player.svg)](https://pub.dartlang.org/packages/video_player)
9+
10+
A Flutter plugin for iOS and Android for playing back video on a Widget surface.
11+
12+
![The example app running in iOS](https://github.com/flutter/plugins/blob/master/packages/video_player/doc/demo_ipod.gif?raw=true)
13+
14+
*Note*: This plugin is still under development, and some APIs might not be available yet.
15+
[Feedback welcome](https://github.com/flutter/flutter/issues) and
16+
[Pull Requests](https://github.com/flutter/plugins/pulls) are most welcome!
17+
18+
## Installation
19+
20+
First, add `video_player` as a [dependency in your pubspec.yaml file](https://flutter.io/using-packages/).
21+
22+
### iOS
23+
24+
Warning: The video player is not functional on iOS simulators. An iOS device must be used during development/testing.
25+
26+
Add the following entry to your _Info.plist_ file, located in `<project root>/ios/Runner/Info.plist`:
27+
28+
```xml
29+
<key>NSAppTransportSecurity</key>
30+
<dict>
31+
<key>NSAllowsArbitraryLoads</key>
32+
<true/>
33+
</dict>
34+
```
35+
36+
This entry allows your app to access video files by URL.
37+
38+
### Android
39+
40+
Ensure the following permission is present in your Android Manifest file, located in `<project root>/android/app/src/main/AndroidManifest.xml:
41+
42+
```xml
43+
<uses-permission android:name="android.permission.INTERNET"/>
44+
```
45+
46+
The Flutter project template adds it, so it may already be there.
47+
48+
### Supported Formats
49+
50+
- On iOS, the backing player is [AVPlayer](https://developer.apple.com/documentation/avfoundation/avplayer).
51+
The supported formats vary depending on the version of iOS, [AVURLAsset](https://developer.apple.com/documentation/avfoundation/avurlasset) class
52+
has [audiovisualTypes](https://developer.apple.com/documentation/avfoundation/avurlasset/1386800-audiovisualtypes?language=objc) that you can query for supported av formats.
53+
- On Android, the backing player is [ExoPlayer](https://google.github.io/ExoPlayer/),
54+
please refer [here](https://google.github.io/ExoPlayer/supported-formats.html) for list of supported formats.
55+
56+
### Example
57+
58+
```dart
59+
import 'package:video_player/video_player.dart';
60+
import 'package:flutter/material.dart';
61+
62+
void main() => runApp(VideoApp());
63+
64+
class VideoApp extends StatefulWidget {
65+
@override
66+
_VideoAppState createState() => _VideoAppState();
67+
}
68+
69+
class _VideoAppState extends State<VideoApp> {
70+
VideoPlayerController _controller;
71+
72+
@override
73+
void initState() {
74+
super.initState();
75+
_controller = VideoPlayerController.network(
76+
'http://www.sample-videos.com/video123/mp4/720/big_buck_bunny_720p_20mb.mp4')
77+
..initialize().then((_) {
78+
// Ensure the first frame is shown after the video is initialized, even before the play button has been pressed.
79+
setState(() {});
80+
});
81+
}
82+
83+
@override
84+
Widget build(BuildContext context) {
85+
return MaterialApp(
86+
title: 'Video Demo',
87+
home: Scaffold(
88+
body: Center(
89+
child: _controller.value.initialized
90+
? AspectRatio(
91+
aspectRatio: _controller.value.aspectRatio,
92+
child: VideoPlayer(_controller),
93+
)
94+
: Container(),
95+
),
96+
floatingActionButton: FloatingActionButton(
97+
onPressed: () {
98+
setState(() {
99+
_controller.value.isPlaying
100+
? _controller.pause()
101+
: _controller.play();
102+
});
103+
},
104+
child: Icon(
105+
_controller.value.isPlaying ? Icons.pause : Icons.play_arrow,
106+
),
107+
),
108+
),
109+
);
110+
}
111+
112+
@override
113+
void dispose() {
114+
super.dispose();
115+
_controller.dispose();
116+
}
117+
}
118+
```

android/build.gradle

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
def PLUGIN = "video_player";
2+
def ANDROIDX_WARNING = "flutterPluginsAndroidXWarning";
3+
gradle.buildFinished { buildResult ->
4+
if (buildResult.failure && !rootProject.ext.has(ANDROIDX_WARNING)) {
5+
println ' *********************************************************'
6+
println 'WARNING: This version of ' + PLUGIN + ' will break your Android build if it or its dependencies aren\'t compatible with AndroidX.'
7+
println ' See https://goo.gl/CP92wY for more information on the problem and how to fix it.'
8+
println ' This warning prints for all Android build failures. The real root cause of the error may be unrelated.'
9+
println ' *********************************************************'
10+
rootProject.ext.set(ANDROIDX_WARNING, true);
11+
}
12+
}
13+
14+
group 'io.flutter.plugins.videoplayer'
15+
version '1.0-SNAPSHOT'
16+
17+
buildscript {
18+
repositories {
19+
google()
20+
jcenter()
21+
}
22+
23+
dependencies {
24+
classpath 'com.android.tools.build:gradle:3.3.0'
25+
}
26+
}
27+
28+
rootProject.allprojects {
29+
repositories {
30+
google()
31+
jcenter()
32+
}
33+
}
34+
35+
apply plugin: 'com.android.library'
36+
37+
android {
38+
compileSdkVersion 28
39+
40+
defaultConfig {
41+
minSdkVersion 16
42+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
43+
}
44+
lintOptions {
45+
disable 'InvalidPackage'
46+
}
47+
android {
48+
compileOptions {
49+
sourceCompatibility 1.8
50+
targetCompatibility 1.8
51+
}
52+
}
53+
54+
dependencies {
55+
implementation 'com.google.android.exoplayer:exoplayer-core:2.9.6'
56+
implementation 'com.google.android.exoplayer:exoplayer-hls:2.9.6'
57+
implementation 'com.google.android.exoplayer:exoplayer-dash:2.9.6'
58+
implementation 'com.google.android.exoplayer:exoplayer-smoothstreaming:2.9.6'
59+
}
60+
}

android/gradle.properties

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
org.gradle.jvmargs=-Xmx1536M
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Wed Oct 17 09:04:56 PDT 2018
2+
distributionBase=GRADLE_USER_HOME
3+
distributionPath=wrapper/dists
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip

android/settings.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rootProject.name = 'video_player'

0 commit comments

Comments
 (0)