Skip to content

Commit

Permalink
Merge commit '43ab7d69ebadd251002bb1529ba724afe41a82e4' into custom-lg
Browse files Browse the repository at this point in the history
* commit '43ab7d69ebadd251002bb1529ba724afe41a82e4':
  Chewie, version 1.7.0. Adds pull request fluttercommunity#754.
  Example app's minimum Dart and Flutter SDKs are set to 2.18 and 3.10 respectively.
  Set Dart minimum SDK to version 2.18.
  Updated wakelock_plus to version 1.1.0. Also updated Flutter minimum SDK to version 3.3.0.
  Upgraded the example Android app to the latest supported Android and Gradle versions respectively.
  Improve README
  • Loading branch information
lg8294 committed Nov 3, 2023
2 parents 9141d95 + 43ab7d6 commit b390a83
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 27 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.7.0
* 🛠️ [#754](https://github.com/fluttercommunity/chewie/pull/754): Upgraded `wakelock_plus` to version `1.1.0`. Thanks [diegotori](https://github.com/diegotori).
* **BREAKING CHANGE**: Library now requires at least Dart and Flutter versions `2.18` and `3.3.0` respectively.

## 1.6.0+1
* Added Flutter Community Banner to `README.md`. Thanks [diegotori](https://github.com/diegotori).

Expand Down
34 changes: 21 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ The [`video_player`](https://pub.dartlang.org/packages/video_player) plugin prov

## Installation

In your `pubspec.yaml` file within your Flutter Project:
In your `pubspec.yaml` file within your Flutter Project add `chewie` and `video_player` under dependencies:

```yaml
dependencies:
chewie: <latest_version>
video_player: <latest_version>
```
## Use it
## Using it
```dart
import 'package:chewie/chewie.dart';
Expand All @@ -49,7 +49,7 @@ final playerWidget = Chewie(
);
```

Please make sure to dispose both controller widgets after use. For example by overriding the dispose method of the a `StatefulWidget`:
Please make sure to dispose both controller widgets after use. For example, by overriding the dispose method of the a `StatefulWidget`:
```dart
@override
void dispose() {
Expand All @@ -63,9 +63,9 @@ void dispose() {

![](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`.
Chewie has some options which control the video. These options appear by default in a `showModalBottomSheet` (similar to YT). By default, Chewie passes `Playback speed` and `Subtitles` options as an `OptionItem`.

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

```dart
additionalOptions: (context) {
Expand All @@ -77,15 +77,17 @@ additionalOptions: (context) {
),
OptionItem(
onTap: () =>
debugPrint('Another option working!'),
debugPrint('Another option that works!'),
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:
### Customizing the modal sheet

If you don't like the default `showModalBottomSheet` for showing your options, you can override the View with the `optionsBuilder` method:

```dart
optionsBuilder: (context, defaultOptions) async {
Expand All @@ -109,7 +111,11 @@ optionsBuilder: (context, defaultOptions) async {

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:
### Translations

What is an option without proper translation?

To add your translation strings add:

```dart
optionsTranslation: OptionsTranslation(
Expand All @@ -121,11 +127,11 @@ optionsTranslation: OptionsTranslation(

## Subtitles

> Since version 1.1.0 chewie supports subtitles. Here you can see how to use them
> 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`:
Add subtitles to your `ChewieController` like the following example:

```dart
ChewieController(
Expand Down Expand Up @@ -156,9 +162,9 @@ ChewieController(
);
```

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 `index` attribute is for if you want to structure your subtitles in your database and provide your indexes here. `end` and `text` are 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:
The Duration defines which part of your video your subtitles should start and end. For example, if your video is 10 minutes long and you want to add a subtitle between: `00:00` and `00:10`'th of a second:

```dart
Subtitle(
Expand All @@ -174,7 +180,8 @@ Subtitle(
Please run the app in the [`example/`](https://github.com/brianegan/chewie/tree/master/example) folder to start playing!

## Migrating from Chewie < 0.9.0
Instead of passing the `VideoPlayerController` and your options to the `Chewie` widget you now pass them to the `ChewieController` and pass that latter to the `Chewie` widget.

Instead of passing the `VideoPlayerController` and your options to the `Chewie` widget you now pass them to the `ChewieController` and pass that later to the `Chewie` widget.

```dart
final playerWidget = Chewie(
Expand Down Expand Up @@ -225,6 +232,7 @@ final playerWidget = Chewie(


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

Expand Down
6 changes: 4 additions & 2 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 31
namespace "com.example.example"

compileSdkVersion 33

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
Expand All @@ -36,7 +38,7 @@ android {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.example"
minSdkVersion 21
targetSdkVersion 30
targetSdkVersion 33
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
Expand Down
3 changes: 2 additions & 1 deletion example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
android:windowSoftInputMode="adjustResize"
android:exported="true">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
Expand Down
10 changes: 5 additions & 5 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
buildscript {
ext.kotlin_version = '1.6.10'
ext.kotlin_version = '1.7.22'
repositories {
google()
jcenter()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.android.tools.build:gradle:7.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}

Expand All @@ -24,6 +24,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.2-all.zip
3 changes: 2 additions & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ version: 1.0.0
publish_to: none

environment:
sdk: '>=2.12.0-0 <3.0.0'
sdk: '>=2.18.0 <4.0.0'
flutter: ">=3.10.0"

dependencies:
chewie:
Expand Down
8 changes: 4 additions & 4 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
name: chewie
description: A video player for Flutter with Cupertino and Material play controls
version: 1.6.0+1
version: 1.7.0
homepage: https://github.com/fluttercommunity/chewie

environment:
sdk: '>=2.17.0 <4.0.0'
flutter: ">=2.11.0"
sdk: '>=2.18.0 <4.0.0'
flutter: ">=3.3.0"

dependencies:
cupertino_icons: ^1.0.5
flutter:
sdk: flutter
provider: ^6.0.5
video_player: ^2.7.0
wakelock_plus: ^1.0.0+2
wakelock_plus: ^1.1.0

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit b390a83

Please sign in to comment.