Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add YT suppport to chewie #505

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/src/chewie_player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import 'package:provider/provider.dart';
import 'package:video_player/video_player.dart';
import 'package:ext_video_player/ext_video_player.dart';
import 'package:wakelock/wakelock.dart';
import 'package:chewie/src/models/subtitle_model.dart';

Expand Down Expand Up @@ -474,7 +474,7 @@ class ChewieController extends ChangeNotifier {
await videoPlayerController.setLooping(looping);

if ((autoInitialize || autoPlay) &&
!videoPlayerController.value.isInitialized) {
!videoPlayerController.value.initialized) {
await videoPlayerController.initialize();
}

Expand Down
4 changes: 2 additions & 2 deletions lib/src/cupertino/cupertino_controls.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:video_player/video_player.dart';
import 'package:ext_video_player/ext_video_player.dart';
import 'package:chewie/src/models/subtitle_model.dart';

class CupertinoControls extends StatefulWidget {
Expand Down Expand Up @@ -655,7 +655,7 @@ class _CupertinoControlsState extends State<CupertinoControls>
} else {
_cancelAndRestartTimer();

if (!controller.value.isInitialized) {
if (!controller.value.initialized) {
controller.initialize().then((_) {
controller.play();
});
Expand Down
2 changes: 1 addition & 1 deletion lib/src/cupertino/cupertino_progress_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:chewie/src/chewie_progress_colors.dart';
import 'package:chewie/src/progress_bar.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:video_player/video_player.dart';
import 'package:ext_video_player/ext_video_player.dart';

class CupertinoVideoProgressBar extends StatelessWidget {
CupertinoVideoProgressBar(
Expand Down
5 changes: 2 additions & 3 deletions lib/src/material/material_controls.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ import 'package:chewie/src/material/widgets/options_dialog.dart';
import 'package:chewie/src/notifiers/index.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:video_player/video_player.dart';
import 'package:chewie/src/models/subtitle_model.dart';

import 'package:ext_video_player/ext_video_player.dart';
import 'widgets/playback_speed_dialog.dart';

class MaterialControls extends StatefulWidget {
Expand Down Expand Up @@ -496,7 +495,7 @@ class _MaterialControlsState extends State<MaterialControls>
} else {
_cancelAndRestartTimer();

if (!controller.value.isInitialized) {
if (!controller.value.initialized) {
controller.initialize().then((_) {
controller.play();
});
Expand Down
4 changes: 2 additions & 2 deletions lib/src/material/material_desktop_controls.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import 'package:chewie/src/material/widgets/options_dialog.dart';
import 'package:chewie/src/notifiers/index.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:video_player/video_player.dart';
import 'package:ext_video_player/ext_video_player.dart';
import 'package:chewie/src/models/subtitle_model.dart';

import 'widgets/playback_speed_dialog.dart';
Expand Down Expand Up @@ -501,7 +501,7 @@ class _MaterialDesktopControlsState extends State<MaterialDesktopControls>
} else {
_cancelAndRestartTimer();

if (!controller.value.isInitialized) {
if (!controller.value.initialized) {
controller.initialize().then((_) {
controller.play();
});
Expand Down
2 changes: 1 addition & 1 deletion lib/src/material/material_progress_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:chewie/src/chewie_progress_colors.dart';
import 'package:chewie/src/progress_bar.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:video_player/video_player.dart';
import 'package:ext_video_player/ext_video_player.dart';

class MaterialVideoProgressBar extends StatelessWidget {
MaterialVideoProgressBar(
Expand Down
2 changes: 1 addition & 1 deletion lib/src/player_with_controls.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:chewie/src/notifiers/index.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:video_player/video_player.dart';
import 'package:ext_video_player/ext_video_player.dart';

class PlayerWithControls extends StatelessWidget {
const PlayerWithControls({Key? key}) : super(key: key);
Expand Down
10 changes: 5 additions & 5 deletions lib/src/progress_bar.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:chewie/src/chewie_progress_colors.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:video_player/video_player.dart';
import 'package:ext_video_player/ext_video_player.dart';

class VideoProgressBar extends StatefulWidget {
VideoProgressBar(
Expand Down Expand Up @@ -67,7 +67,7 @@ class _VideoProgressBarState extends State<VideoProgressBar> {
Widget build(BuildContext context) {
return GestureDetector(
onHorizontalDragStart: (DragStartDetails details) {
if (!controller.value.isInitialized) {
if (!controller.value.initialized) {
return;
}
_controllerWasPlaying = controller.value.isPlaying;
Expand All @@ -78,7 +78,7 @@ class _VideoProgressBarState extends State<VideoProgressBar> {
widget.onDragStart?.call();
},
onHorizontalDragUpdate: (DragUpdateDetails details) {
if (!controller.value.isInitialized) {
if (!controller.value.initialized) {
return;
}
_seekToRelativePosition(details.globalPosition);
Expand All @@ -93,7 +93,7 @@ class _VideoProgressBarState extends State<VideoProgressBar> {
widget.onDragEnd?.call();
},
onTapDown: (TapDownDetails details) {
if (!controller.value.isInitialized) {
if (!controller.value.initialized) {
return;
}
_seekToRelativePosition(details.globalPosition);
Expand Down Expand Up @@ -153,7 +153,7 @@ class _ProgressBarPainter extends CustomPainter {
),
colors.backgroundPaint,
);
if (!value.isInitialized) {
if (!value.initialized) {
return;
}
final double playedPartPercent =
Expand Down
5 changes: 3 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: chewie
description: A video player for Flutter with Cupertino and Material play controls
version: 1.2.2
version: 1.2.4
homepage: https://github.com/brianegan/chewie

environment:
Expand All @@ -12,8 +12,9 @@ dependencies:
flutter:
sdk: flutter
provider: ^5.0.0
video_player: ^2.1.5
wakelock: ^0.5.2
ext_video_player: ^0.0.6


dev_dependencies:
flutter_test:
Expand Down