Skip to content

Commit 2e3d579

Browse files
committed
Merge commit '3948d23733638d8a58ea5ff065abfe96934d2373' into custom-lg
* commit '3948d23733638d8a58ea5ff065abfe96934d2373': (110 commits) Version 1.3.4. Addresses PRs fluttercommunity#623 and fluttercommunity#646. Update pubspec.yaml version updates fix: change video type fix: format and migration artifacts fix: apply diegotori suggestion feat: added support for apple and desktop version feat: Make progressIndicatorDelay a Duration fix: simplify assignation fix: name fix: let the android player buffer before seeking once more fix: removed old code fix: lint feat: added method to set progress delay feat: added example debug feat: add a delay before displaying progress indicator Version 1.3.3. Adds PR fluttercommunity#634. Update pubspec.yaml chore: remove unused dependency Version 1.3.2. Adds PR fluttercommunity#626. ... # Conflicts: # example/ios/Runner.xcodeproj/project.pbxproj # example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme # example/ios/Runner/Info.plist # example/lib/main.dart # example/pubspec.yaml # lib/src/chewie_player.dart # pubspec.yaml
2 parents 186c7b8 + 3948d23 commit 2e3d579

Some content is hidden

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

62 files changed

+3378
-1640
lines changed

CHANGELOG.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,94 @@
1+
## 1.3.4
2+
* ⬆️ [#646](https://github.com/fluttercommunity/chewie/pull/646): Fix to videos recorded with an orientation of 180° ( landscapeRight) being reversed on Android. Thanks [williamviktorsson](https://github.com/williamviktorsson).
3+
* ⬆️ [#623](https://github.com/fluttercommunity/chewie/pull/646): [Android] Add a delay before displaying progress indicator. Thanks [henri2h](https://github.com/henri2h).
4+
5+
## 1.3.3
6+
* ⬆️ [#634](https://github.com/fluttercommunity/chewie/pull/634): chore: Move very_good_analysis to dev_dependencies. Thanks [JCQuintas](https://github.com/JCQuintas).
7+
8+
## 1.3.2
9+
* ⬆️ [#626](https://github.com/fluttercommunity/chewie/pull/626): Added customizable timer to hide controls. Thanks [BuginRug](https://github.com/BuginRug).
10+
11+
## 1.3.1
12+
* ⬆️ [#617](https://github.com/fluttercommunity/chewie/pull/617): Allow video zooming with InteractiveViewer widget. Thanks [jmsanc](https://github.com/jmsanc).
13+
14+
## 1.3.0
15+
16+
* ⬆️ [#598](https://github.com/fluttercommunity/chewie/pull/598): Update `wakelock` to `^0.6.1+1`. Thanks [fehernyul](https://github.com/fehernyul).
17+
* ⬆️ [#599](https://github.com/fluttercommunity/chewie/pull/599): Uniform controls. Thanks [BuginRug](https://github.com/BuginRug).
18+
19+
**Slight Breaking Change**. Instead of:
20+
21+
```dart
22+
typedef ChewieRoutePageBuilder = Widget Function(
23+
BuildContext context,
24+
Animation<double> animation,
25+
Animation<double> secondaryAnimation,
26+
_ChewieControllerProvider controllerProvider,
27+
);
28+
```
29+
30+
It is now:
31+
32+
```dart
33+
typedef ChewieRoutePageBuilder = Widget Function(
34+
BuildContext context,
35+
Animation<double> animation,
36+
Animation<double> secondaryAnimation,
37+
ChewieControllerProvider controllerProvider,
38+
);
39+
```
40+
41+
TL;DR: We had to make `_ChewieControllerProvider` public.
42+
43+
* 🛠️ Fixed lint and formatting problems
44+
* Under New Management under the auspices of [Flutter Community](https://github.com/fluttercommunity), and new maintainers [diegotori](https://github.com/diegotori) and [maherjaafar](https://github.com/maherjaafar).
45+
46+
## 1.2.3
47+
48+
* ⬆️ Update 'provider' to 6.0.1
49+
- fixes [#568](https://github.com/brianegan/chewie/issues/568)
50+
* ⬆️ Update 'video_player' to 2.2.7
51+
* ⬆️ Update 'wakelock' to 0.5.6
52+
* ⬆️ Update 'lint' to 1.7.2
53+
* ⬆️ Update roadmap
54+
* 🛠️ Fix lint problems
55+
* 💡 Add very_good_analysis package
56+
* 💡 Add analysis_options.yaml for example app
57+
58+
## 1.2.2
59+
60+
* 🛠️ Fix Incorrect use of ParentDataWidget.
61+
- Fixes: [#485](https://github.com/brianegan/chewie/issues/485)
62+
63+
## 1.2.1
64+
65+
* 💡 add `showOptions` flag to show/hide the options-menu
66+
- Fixes: [#491](https://github.com/brianegan/chewie/issues/491)
67+
* ⬆️ update `video_player` to 2.1.5
68+
* 🛠️ fix MaterialUI duration text (RichText)
69+
70+
## 1.2.0
71+
72+
* 🖥 __Desktop-UI__: Added `AdaptiveControls` where `MaterialDesktopControls` is now the default for Desktop-Platforms (start [ChewieDemo](https://github.com/brianegan/chewie/blob/master/example/lib/app/app.dart) for a preview)
73+
- Fixes: [#188](https://github.com/brianegan/chewie/issues/478)
74+
* Redesign `MaterialControls` (inspired by Youtube Mobile and Desktop)
75+
* Fix squeeze of `CenterPlayButton`
76+
* Add: `optionsTranslation`, `additionalOptions` and `optionsBuilder` to create and design your Video-Options like Playback speed, subtitles and other options you want to add (use here: `additionalOptions`!). Use `optionsTranslation` to provide your localized strings!
77+
78+
> See [Options](https://github.com/brianegan/chewie#options) to customize your Chewie options
79+
80+
## 1.1.0
81+
82+
* Add subtitle functionality
83+
- Thanks to kirill09: [#188](https://github.com/brianegan/chewie/pull/188) with which we've improved and optimized subtitles
84+
85+
> See readme on how to create subtitles and provide your own subtitleBuilder: [Subtitles](https://github.com/brianegan/chewie#Subtitles)
86+
87+
## 1.0.0
88+
89+
* Migrate to Null Safety
90+
- Thanks to miDeb: [#406](https://github.com/brianegan/chewie/pull/443)
91+
192
## 0.12.1+1
293

394
* Lint: Format to line length 80 for pub score
@@ -170,3 +261,4 @@ Initial version of Chewie, the video player with a heart of gold.
170261
* Includes Material Player Controls
171262
* Includes Cupertino Player Controls
172263
* Spike version: Focus on good looking UI. Internal code is sloppy, needs a refactor and tests
264+

README.md

Lines changed: 147 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
# chewie
2-
[![Version](https://img.shields.io/badge/pub-v0.12.0-blue)](https://pub.dev/packages/chewie)
2+
[![Version](https://img.shields.io/pub/v/chewie.svg)](https://pub.dev/packages/chewie)
33
![CI](https://github.com/brianegan/chewie/workflows/CI/badge.svg)
44
[![Generic badge](https://img.shields.io/badge/platform-android%20|%20ios%20|%20web%20-blue.svg)](https://pub.dev/packages/chewie)
55

66
The video player for Flutter with a heart of gold.
77

88
The [`video_player`](https://pub.dartlang.org/packages/video_player) plugin provides low-level access to video playback. Chewie uses the `video_player` under the hood and wraps it in a friendly Material or Cupertino UI!
99

10-
## Demo
10+
## Preview
1111

12-
![Demo](https://github.com/brianegan/chewie/raw/master/assets/chewie_demo.gif)
12+
| MaterialControls | MaterialDesktopControls |
13+
| :--------------: | :---------------------: |
14+
| ![](https://github.com/brianegan/chewie/raw/master/assets/MaterialControls.png) | ![](https://github.com/brianegan/chewie/raw/master/assets/MaterialDesktopControls.png) |
15+
16+
### CupertinoControls
17+
![](https://github.com/brianegan/chewie/raw/master/assets/CupertinoControls.png)
1318

1419
## Installation
1520

@@ -51,6 +56,116 @@ void dispose() {
5156
}
5257
```
5358

59+
## Options
60+
61+
![](https://github.com/brianegan/chewie/raw/master/assets/Options.png)
62+
63+
Chewie got some options which controls the video you provide. These options appear on default on a `showModalBottomSheet` (like you already know from YT maybe). Chewie is passing on default `Playback speed` and `Subtitles` options as an `OptionItem`.
64+
65+
To add additional options just add these lines to your `ChewieController`:
66+
67+
```dart
68+
additionalOptions: (context) {
69+
return <OptionItem>[
70+
OptionItem(
71+
onTap: () => debugPrint('My option works!'),
72+
iconData: Icons.chat,
73+
title: 'My localized title',
74+
),
75+
OptionItem(
76+
onTap: () =>
77+
debugPrint('Another option working!'),
78+
iconData: Icons.chat,
79+
title: 'Another localized title',
80+
),
81+
];
82+
},
83+
```
84+
85+
If you don't like to show your options with the default `showModalBottomSheet` just override the View with the `optionsBuilder` method:
86+
87+
```dart
88+
optionsBuilder: (context, defaultOptions) async {
89+
await showDialog<void>(
90+
context: context,
91+
builder: (ctx) {
92+
return AlertDialog(
93+
content: ListView.builder(
94+
itemCount: defaultOptions.length,
95+
itemBuilder: (_, i) => ActionChip(
96+
label: Text(defaultOptions[i].title),
97+
onPressed: () =>
98+
defaultOptions[i].onTap!(),
99+
),
100+
),
101+
);
102+
},
103+
);
104+
},
105+
```
106+
107+
Your `additionalOptions` are already included here (if you provided `additionalOptions`)!
108+
109+
Last but not least: What is an option without proper translation. To add your strings to them just add:
110+
111+
```dart
112+
optionsTranslation: OptionsTranslation(
113+
playbackSpeedButtonText: 'Wiedergabegeschwindigkeit',
114+
subtitlesButtonText: 'Untertitel',
115+
cancelButtonText: 'Abbrechen',
116+
),
117+
```
118+
119+
## Subtitles
120+
121+
> Since version 1.1.0 chewie supports subtitles. Here you can see how to use them
122+
123+
You can provide an `List<Subtitle>` and customize your subtitles with the `subtitleBuilder` function.
124+
125+
Just add subtitles as following code is showing into your `ChewieController`:
126+
127+
```dart
128+
ChewieController(
129+
videoPlayerController: _videoPlayerController,
130+
autoPlay: true,
131+
looping: true,
132+
subtitle: Subtitles([
133+
Subtitle(
134+
index: 0,
135+
start: Duration.zero,
136+
end: const Duration(seconds: 10),
137+
text: 'Hello from subtitles',
138+
),
139+
Subtitle(
140+
index: 1,
141+
start: const Duration(seconds: 10),
142+
end: const Duration(seconds: 20),
143+
text: 'Whats up? :)',
144+
),
145+
]),
146+
subtitleBuilder: (context, subtitle) => Container(
147+
padding: const EdgeInsets.all(10.0),
148+
child: Text(
149+
subtitle,
150+
style: const TextStyle(color: Colors.white),
151+
),
152+
),
153+
);
154+
```
155+
156+
The `index` attribute is just for purpases if you want to structure your subtitles in your database and provide your indexes here. `start`, `end` and `text` are here the key attributes.
157+
158+
The Duration defines on which part of your video your subtitles should start and end. For example: Your video is 10 minutes long and you want to add a subtitle between: `00:00` and `00:10`'th second you've to provide:
159+
160+
```dart
161+
Subtitle(
162+
index: 0,
163+
start: Duration.zero,
164+
end: const Duration(seconds: 10),
165+
text: 'Hello from subtitles',
166+
),
167+
```
168+
54169
## Example
55170

56171
Please run the app in the [`example/`](https://github.com/brianegan/chewie/tree/master/example) folder to start playing!
@@ -80,9 +195,36 @@ final playerWidget = Chewie(
80195
);
81196
```
82197

83-
## iOS warning
198+
## Roadmap
199+
200+
- [x] MaterialUI
201+
- [x] MaterialDesktopUI
202+
- [x] CupertinoUI
203+
- [x] Options with translations
204+
- [x] Subtitles
205+
- [x] CustomControls
206+
- [x] Auto-Rotate on FullScreen depending on Source Aspect-Ratio
207+
- [x] Live-Stream and UI
208+
- [x] AutoPlay
209+
- [x] Placeholder
210+
- [x] Looping
211+
- [x] Start video at
212+
- [x] Custom Progress-Bar colors
213+
- [x] Custom Overlay
214+
- [x] Allow Sleep (Wakelock)
215+
- [x] Playbackspeed Control
216+
- [x] Custom Route-Pagebuilder
217+
- [x] Custom Device-Orientation and SystemOverlay before and after fullscreen
218+
- [x] Custom ErrorBuilder
219+
- [ ] Support different resolutions of video
220+
- [ ] Re-design State-Manager with Provider
221+
- [ ] Screen-Mirroring / Casting (Google Chromecast)
222+
223+
224+
## iOS warning
225+
The video_player plugin used by chewie will only work in iOS simulators if you are on flutter 1.26.0 or above. You may need to switch to the beta channel `flutter channel beta`
226+
Please refer to this [issue](https://github.com/flutter/flutter/issues/14647).
84227

85-
The video player plugin used by chewie is not functional on iOS simulators. An iOS device must be used during development/testing. Please refer to this [issue](https://github.com/flutter/flutter/issues/14647).
86228

87229

88230
```

analysis_options.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ include: package:lint/analysis_options_package.yaml
33
analyzer:
44
strong-mode:
55
implicit-dynamic: false
6+
exclude:
7+
- lib/generated_plugin_registrant.dart
68

79
linter:
810
rules:
911
close_sinks: true
1012
sort_constructors_first: true
11-
13+
sort_pub_dependencies: false

assets/CupertinoControls.png

1.08 MB
Loading

assets/MaterialControls.png

361 KB
Loading

assets/MaterialDesktopControls.png

363 KB
Loading

assets/Options.png

116 KB
Loading

assets/chewie_demo.gif

-10.2 MB
Binary file not shown.

example/analysis_options.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
include: package:lint/analysis_options_package.yaml
2+
3+
analyzer:
4+
strong-mode:
5+
implicit-dynamic: false
6+
exclude:
7+
- lib/generated_plugin_registrant.dart
8+
9+
linter:
10+
rules:
11+
close_sinks: true
12+
sort_constructors_first: true

example/android/app/build.gradle

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,17 @@ apply plugin: 'kotlin-android'
2626
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
2727

2828
android {
29-
compileSdkVersion 29
29+
compileSdkVersion 31
3030

3131
sourceSets {
3232
main.java.srcDirs += 'src/main/kotlin'
3333
}
3434

35-
lintOptions {
36-
disable 'InvalidPackage'
37-
}
38-
3935
defaultConfig {
40-
applicationId "com.example.chewieexample"
36+
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
37+
applicationId "com.example.example"
4138
minSdkVersion 21
42-
targetSdkVersion 29
39+
targetSdkVersion 30
4340
versionCode flutterVersionCode.toInteger()
4441
versionName flutterVersionName
4542
}

example/android/app/src/debug/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.example.chewieexample">
2+
package="com.example.example">
33
<!-- Flutter needs it to communicate with the running application
44
to allow setting breakpoints, to provide hot reload, etc.
55
-->

example/android/app/src/main/AndroidManifest.xml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.example.chewieexample">
3-
4-
<uses-permission android:name="android.permission.INTERNET"/>
5-
2+
package="com.example.example">
63
<application
7-
android:label="chewie_example"
4+
android:label="example"
5+
android:usesCleartextTraffic="true"
86
android:icon="@mipmap/ic_launcher">
97
<activity
108
android:name=".MainActivity"

example/android/app/src/main/kotlin/com/example/chewieexample/MainActivity.kt renamed to example/android/app/src/main/kotlin/com/example/example/MainActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.example.chewieexample
1+
package com.example.example
22

33
import io.flutter.embedding.android.FlutterActivity
44

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Modify this file to customize your launch splash screen -->
3+
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
4+
<item android:drawable="?android:colorBackground" />
5+
6+
<!-- You can insert your own image assets here -->
7+
<!-- <item>
8+
<bitmap
9+
android:gravity="center"
10+
android:src="@mipmap/launch_image" />
11+
</item> -->
12+
</layer-list>

example/android/app/src/main/res/drawable/launch_background.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- Modify this file to customize your launch splash screen -->
33
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
4-
<item android:drawable="?android:colorBackground" />
4+
<item android:drawable="@android:color/white" />
55

66
<!-- You can insert your own image assets here -->
77
<!-- <item>

example/android/app/src/profile/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.example.chewieexample">
2+
package="com.example.example">
33
<!-- Flutter needs it to communicate with the running application
44
to allow setting breakpoints, to provide hot reload, etc.
55
-->

0 commit comments

Comments
 (0)