Skip to content

Commit

Permalink
Merge commit '3948d23733638d8a58ea5ff065abfe96934d2373' into custom-lg
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
lg8294 committed Sep 22, 2022
2 parents 186c7b8 + 3948d23 commit 2e3d579
Show file tree
Hide file tree
Showing 62 changed files with 3,378 additions and 1,640 deletions.
92 changes: 92 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,94 @@
## 1.3.4
* ⬆️ [#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).
* ⬆️ [#623](https://github.com/fluttercommunity/chewie/pull/646): [Android] Add a delay before displaying progress indicator. Thanks [henri2h](https://github.com/henri2h).

## 1.3.3
* ⬆️ [#634](https://github.com/fluttercommunity/chewie/pull/634): chore: Move very_good_analysis to dev_dependencies. Thanks [JCQuintas](https://github.com/JCQuintas).

## 1.3.2
* ⬆️ [#626](https://github.com/fluttercommunity/chewie/pull/626): Added customizable timer to hide controls. Thanks [BuginRug](https://github.com/BuginRug).

## 1.3.1
* ⬆️ [#617](https://github.com/fluttercommunity/chewie/pull/617): Allow video zooming with InteractiveViewer widget. Thanks [jmsanc](https://github.com/jmsanc).

## 1.3.0

* ⬆️ [#598](https://github.com/fluttercommunity/chewie/pull/598): Update `wakelock` to `^0.6.1+1`. Thanks [fehernyul](https://github.com/fehernyul).
* ⬆️ [#599](https://github.com/fluttercommunity/chewie/pull/599): Uniform controls. Thanks [BuginRug](https://github.com/BuginRug).

**Slight Breaking Change**. Instead of:

```dart
typedef ChewieRoutePageBuilder = Widget Function(
BuildContext context,
Animation<double> animation,
Animation<double> secondaryAnimation,
_ChewieControllerProvider controllerProvider,
);
```

It is now:

```dart
typedef ChewieRoutePageBuilder = Widget Function(
BuildContext context,
Animation<double> animation,
Animation<double> secondaryAnimation,
ChewieControllerProvider controllerProvider,
);
```

TL;DR: We had to make `_ChewieControllerProvider` public.

* 🛠️ Fixed lint and formatting problems
* 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).

## 1.2.3

* ⬆️ Update 'provider' to 6.0.1
- fixes [#568](https://github.com/brianegan/chewie/issues/568)
* ⬆️ Update 'video_player' to 2.2.7
* ⬆️ Update 'wakelock' to 0.5.6
* ⬆️ Update 'lint' to 1.7.2
* ⬆️ Update roadmap
* 🛠️ Fix lint problems
* 💡 Add very_good_analysis package
* 💡 Add analysis_options.yaml for example app

## 1.2.2

* 🛠️ Fix Incorrect use of ParentDataWidget.
- Fixes: [#485](https://github.com/brianegan/chewie/issues/485)

## 1.2.1

* 💡 add `showOptions` flag to show/hide the options-menu
- Fixes: [#491](https://github.com/brianegan/chewie/issues/491)
* ⬆️ update `video_player` to 2.1.5
* 🛠️ fix MaterialUI duration text (RichText)

## 1.2.0

* 🖥 __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)
- Fixes: [#188](https://github.com/brianegan/chewie/issues/478)
* Redesign `MaterialControls` (inspired by Youtube Mobile and Desktop)
* Fix squeeze of `CenterPlayButton`
* 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!

> See [Options](https://github.com/brianegan/chewie#options) to customize your Chewie options
## 1.1.0

* Add subtitle functionality
- Thanks to kirill09: [#188](https://github.com/brianegan/chewie/pull/188) with which we've improved and optimized subtitles

> See readme on how to create subtitles and provide your own subtitleBuilder: [Subtitles](https://github.com/brianegan/chewie#Subtitles)
## 1.0.0

* Migrate to Null Safety
- Thanks to miDeb: [#406](https://github.com/brianegan/chewie/pull/443)

## 0.12.1+1

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

152 changes: 147 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
# chewie
[![Version](https://img.shields.io/badge/pub-v0.12.0-blue)](https://pub.dev/packages/chewie)
[![Version](https://img.shields.io/pub/v/chewie.svg)](https://pub.dev/packages/chewie)
![CI](https://github.com/brianegan/chewie/workflows/CI/badge.svg)
[![Generic badge](https://img.shields.io/badge/platform-android%20|%20ios%20|%20web%20-blue.svg)](https://pub.dev/packages/chewie)

The video player for Flutter with a heart of gold.

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!

## Demo
## Preview

![Demo](https://github.com/brianegan/chewie/raw/master/assets/chewie_demo.gif)
| MaterialControls | MaterialDesktopControls |
| :--------------: | :---------------------: |
| ![](https://github.com/brianegan/chewie/raw/master/assets/MaterialControls.png) | ![](https://github.com/brianegan/chewie/raw/master/assets/MaterialDesktopControls.png) |

### CupertinoControls
![](https://github.com/brianegan/chewie/raw/master/assets/CupertinoControls.png)

## Installation

Expand Down Expand Up @@ -51,6 +56,116 @@ void dispose() {
}
```

## Options

![](https://github.com/brianegan/chewie/raw/master/assets/Options.png)

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`.

To add additional options just add these lines to your `ChewieController`:

```dart
additionalOptions: (context) {
return <OptionItem>[
OptionItem(
onTap: () => debugPrint('My option works!'),
iconData: Icons.chat,
title: 'My localized title',
),
OptionItem(
onTap: () =>
debugPrint('Another option working!'),
iconData: Icons.chat,
title: 'Another localized title',
),
];
},
```

If you don't like to show your options with the default `showModalBottomSheet` just override the View with the `optionsBuilder` method:

```dart
optionsBuilder: (context, defaultOptions) async {
await showDialog<void>(
context: context,
builder: (ctx) {
return AlertDialog(
content: ListView.builder(
itemCount: defaultOptions.length,
itemBuilder: (_, i) => ActionChip(
label: Text(defaultOptions[i].title),
onPressed: () =>
defaultOptions[i].onTap!(),
),
),
);
},
);
},
```

Your `additionalOptions` are already included here (if you provided `additionalOptions`)!

Last but not least: What is an option without proper translation. To add your strings to them just add:

```dart
optionsTranslation: OptionsTranslation(
playbackSpeedButtonText: 'Wiedergabegeschwindigkeit',
subtitlesButtonText: 'Untertitel',
cancelButtonText: 'Abbrechen',
),
```

## Subtitles

> Since version 1.1.0 chewie supports subtitles. Here you can see how to use them
You can provide an `List<Subtitle>` and customize your subtitles with the `subtitleBuilder` function.

Just add subtitles as following code is showing into your `ChewieController`:

```dart
ChewieController(
videoPlayerController: _videoPlayerController,
autoPlay: true,
looping: true,
subtitle: Subtitles([
Subtitle(
index: 0,
start: Duration.zero,
end: const Duration(seconds: 10),
text: 'Hello from subtitles',
),
Subtitle(
index: 1,
start: const Duration(seconds: 10),
end: const Duration(seconds: 20),
text: 'Whats up? :)',
),
]),
subtitleBuilder: (context, subtitle) => Container(
padding: const EdgeInsets.all(10.0),
child: Text(
subtitle,
style: const TextStyle(color: Colors.white),
),
),
);
```

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.

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:

```dart
Subtitle(
index: 0,
start: Duration.zero,
end: const Duration(seconds: 10),
text: 'Hello from subtitles',
),
```

## Example

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

## iOS warning
## Roadmap

- [x] MaterialUI
- [x] MaterialDesktopUI
- [x] CupertinoUI
- [x] Options with translations
- [x] Subtitles
- [x] CustomControls
- [x] Auto-Rotate on FullScreen depending on Source Aspect-Ratio
- [x] Live-Stream and UI
- [x] AutoPlay
- [x] Placeholder
- [x] Looping
- [x] Start video at
- [x] Custom Progress-Bar colors
- [x] Custom Overlay
- [x] Allow Sleep (Wakelock)
- [x] Playbackspeed Control
- [x] Custom Route-Pagebuilder
- [x] Custom Device-Orientation and SystemOverlay before and after fullscreen
- [x] Custom ErrorBuilder
- [ ] Support different resolutions of video
- [ ] Re-design State-Manager with Provider
- [ ] Screen-Mirroring / Casting (Google Chromecast)


## iOS warning
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`
Please refer to this [issue](https://github.com/flutter/flutter/issues/14647).

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).


```
Expand Down
4 changes: 3 additions & 1 deletion analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ include: package:lint/analysis_options_package.yaml
analyzer:
strong-mode:
implicit-dynamic: false
exclude:
- lib/generated_plugin_registrant.dart

linter:
rules:
close_sinks: true
sort_constructors_first: true

sort_pub_dependencies: false
Binary file added assets/CupertinoControls.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/MaterialControls.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/MaterialDesktopControls.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/Options.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/chewie_demo.gif
Binary file not shown.
12 changes: 12 additions & 0 deletions example/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
include: package:lint/analysis_options_package.yaml

analyzer:
strong-mode:
implicit-dynamic: false
exclude:
- lib/generated_plugin_registrant.dart

linter:
rules:
close_sinks: true
sort_constructors_first: true
11 changes: 4 additions & 7 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,17 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 29
compileSdkVersion 31

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}

lintOptions {
disable 'InvalidPackage'
}

defaultConfig {
applicationId "com.example.chewieexample"
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.example"
minSdkVersion 21
targetSdkVersion 29
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
Expand Down
2 changes: 1 addition & 1 deletion example/android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.chewieexample">
package="com.example.example">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
Expand Down
8 changes: 3 additions & 5 deletions example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.chewieexample">

<uses-permission android:name="android.permission.INTERNET"/>

package="com.example.example">
<application
android:label="chewie_example"
android:label="example"
android:usesCleartextTraffic="true"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.chewieexample
package com.example.example

import io.flutter.embedding.android.FlutterActivity

Expand Down
Original file line number Diff line number Diff line change
@@ -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:colorBackground" />

<!-- You can insert your own image assets here -->
<!-- <item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
</layer-list>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="?android:colorBackground" />
<item android:drawable="@android:color/white" />

<!-- You can insert your own image assets here -->
<!-- <item>
Expand Down
2 changes: 1 addition & 1 deletion example/android/app/src/profile/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.chewieexample">
package="com.example.example">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
Expand Down
Loading

0 comments on commit 2e3d579

Please sign in to comment.