From c98c9c3f5e86a551c47ba441b30af445169496bc Mon Sep 17 00:00:00 2001 From: adarshrawat8304 Date: Sun, 7 Jul 2024 02:26:54 +0000 Subject: [PATCH] fix: video player infinite loading fix #1 --- lib/src/common_widgets/video_player_page.dart | 7 +- macos/Flutter/GeneratedPluginRegistrant.swift | 2 - pubspec.lock | 64 ++----------------- pubspec.yaml | 4 +- 4 files changed, 11 insertions(+), 66 deletions(-) diff --git a/lib/src/common_widgets/video_player_page.dart b/lib/src/common_widgets/video_player_page.dart index 72fc092..205a4af 100644 --- a/lib/src/common_widgets/video_player_page.dart +++ b/lib/src/common_widgets/video_player_page.dart @@ -20,7 +20,7 @@ class VideoPlayerPage extends StatelessWidget { ); } - YoutubePlayerController _controller = YoutubePlayerController( + YoutubePlayerController controller = YoutubePlayerController( initialVideoId: videoId, flags: const YoutubePlayerFlags( autoPlay: true, @@ -34,13 +34,16 @@ class VideoPlayerPage extends StatelessWidget { ), body: Center( child: YoutubePlayer( - controller: _controller, + controller: controller, showVideoProgressIndicator: true, progressIndicatorColor: Colors.blueAccent, progressColors: const ProgressBarColors( playedColor: Colors.blue, handleColor: Colors.blueAccent, ), + onReady: () { + controller.addListener(() {}); + }, ), ), ); diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 7c83586..e1295ab 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -10,7 +10,6 @@ import firebase_analytics import firebase_auth import firebase_core import firebase_crashlytics -import flutter_inappwebview_macos import google_sign_in_ios import path_provider_foundation import sqflite @@ -23,7 +22,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { FLTFirebaseAuthPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAuthPlugin")) FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin")) FLTFirebaseCrashlyticsPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCrashlyticsPlugin")) - InAppWebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "InAppWebViewFlutterPlugin")) FLTGoogleSignInPlugin.register(with: registry.registrar(forPlugin: "FLTGoogleSignInPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) diff --git a/pubspec.lock b/pubspec.lock index ee43aec..a97398b 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -346,58 +346,10 @@ packages: dependency: "direct main" description: name: flutter_inappwebview - sha256: "3e9a443a18ecef966fb930c3a76ca5ab6a7aafc0c7b5e14a4a850cf107b09959" + sha256: d198297060d116b94048301ee6749cd2e7d03c1f2689783f52d210a6b7aba350 url: "https://pub.dev" source: hosted - version: "6.0.0" - flutter_inappwebview_android: - dependency: transitive - description: - name: flutter_inappwebview_android - sha256: d247f6ed417f1f8c364612fa05a2ecba7f775c8d0c044c1d3b9ee33a6515c421 - url: "https://pub.dev" - source: hosted - version: "1.0.13" - flutter_inappwebview_internal_annotations: - dependency: transitive - description: - name: flutter_inappwebview_internal_annotations - sha256: "5f80fd30e208ddded7dbbcd0d569e7995f9f63d45ea3f548d8dd4c0b473fb4c8" - url: "https://pub.dev" - source: hosted - version: "1.1.1" - flutter_inappwebview_ios: - dependency: transitive - description: - name: flutter_inappwebview_ios - sha256: f363577208b97b10b319cd0c428555cd8493e88b468019a8c5635a0e4312bd0f - url: "https://pub.dev" - source: hosted - version: "1.0.13" - flutter_inappwebview_macos: - dependency: transitive - description: - name: flutter_inappwebview_macos - sha256: b55b9e506c549ce88e26580351d2c71d54f4825901666bd6cfa4be9415bb2636 - url: "https://pub.dev" - source: hosted - version: "1.0.11" - flutter_inappwebview_platform_interface: - dependency: transitive - description: - name: flutter_inappwebview_platform_interface - sha256: "545fd4c25a07d2775f7d5af05a979b2cac4fbf79393b0a7f5d33ba39ba4f6187" - url: "https://pub.dev" - source: hosted - version: "1.0.10" - flutter_inappwebview_web: - dependency: transitive - description: - name: flutter_inappwebview_web - sha256: d8c680abfb6fec71609a700199635d38a744df0febd5544c5a020bd73de8ee07 - url: "https://pub.dev" - source: hosted - version: "1.0.8" + version: "5.8.0" flutter_launcher_icons: dependency: "direct main" description: @@ -552,14 +504,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.19.0" - js: - dependency: transitive - description: - name: js - sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 - url: "https://pub.dev" - source: hosted - version: "0.6.7" json_annotation: dependency: transitive description: @@ -1089,10 +1033,10 @@ packages: dependency: "direct main" description: name: youtube_player_flutter - sha256: "899f1fd15e924eb41150c78c5e2adfd7310100c26b2e1996c148d79e42737d72" + sha256: "72d487e1a1b9155a2dc9d448c137380791101a0ff623723195275ac275ac6942" url: "https://pub.dev" source: hosted - version: "9.0.1" + version: "8.1.2" sdks: dart: ">=3.4.0 <4.0.0" flutter: ">=3.22.0" diff --git a/pubspec.yaml b/pubspec.yaml index c6708ad..227b2d8 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -30,7 +30,7 @@ dependencies: flutter_email_sender: ^6.0.2 shimmer: ^3.0.0 cloud_firestore: ^5.0.0 - youtube_player_flutter: ^9.0.0 + youtube_player_flutter: ^8.1.0 cached_network_image: ^3.3.1 video_player: ^2.8.6 intl: ^0.19.0 @@ -38,7 +38,7 @@ dependencies: google_sign_in: ^6.2.1 firebase_crashlytics: ^4.0.2 firebase_analytics: ^11.1.0 - flutter_inappwebview: ^6.0.0 + flutter_inappwebview: ^5.8.0 dev_dependencies: flutter_test: