Giter VIP home page Giter VIP logo

flutteryoutube's Introduction

flutter_youtube

This plugin will no longer get updates migrate to ext_video_player plugin to play videos as normal video.

Flutter Plugin to play youtube Videos using youtube player api

Notice

Please use ext_video_player plugin to play videos as normal video.

flutter_youtube will no longer get updates

Supported

  • Android
  • iOS

How to Use

dependencies:
  flutter_youtube: "^2.0.0+1"

Imports

import 'package:flutter_youtube/flutter_youtube.dart';

Code

FlutterYoutube.playYoutubeVideoByUrl(
  apiKey: "<API_KEY>",
  videoUrl: "<Youtube Video URL>",
  autoPlay: true, //default falase
  fullScreen: true //default false
);

Video End Listener

Note Right now only supported in android

FlutterYoutube.onVideoEnded.listen((onData) {
  //perform your action when video playing is done
});
Key Value Default
apiKey String (Not Null)
videoUrl String (Not Null)
videoId String (Not Null)
autoPlay Boolean (Optional) false
fullScreen Boolean (Optional) false

API Key

your API key is what you need to use so your application can submit API requests to youtube. For that you are gonna need a Google Account to access the Google API Console, request an API key, and register your application. After that create a project in the Google Developers Console and obtain authorization credentials so your application can submit API requests. More here https://developers.google.com/youtube/v3/getting-started

flutteryoutube's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flutteryoutube's Issues

On pressing back button App crashes

Hi,

Here is the log when i press back button from the youtube page

any advice?

E/AndroidRuntime( 9945): Process: com.example.challenges, PID: 9945
E/AndroidRuntime( 9945): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=111, result=0, data=null} to activity {com.example.challenges/com.example.challenges.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Intent.getStringExtra(java.lang.String)' on a null object reference
E/AndroidRuntime( 9945): at android.app.ActivityThread.deliverResults(ActivityThread.java:4382)
E/AndroidRuntime( 9945): at android.app.ActivityThread.handleSendResult(ActivityThread.java:4426)
E/AndroidRuntime( 9945): at android.app.ActivityThread.-wrap20(Unknown Source:0)
E/AndroidRuntime( 9945): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1685)
E/AndroidRuntime( 9945): at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime( 9945): at android.os.Looper.loop(Looper.java:164)
E/AndroidRuntime( 9945): at android.app.ActivityThread.main(ActivityThread.java:6626)
E/AndroidRuntime( 9945): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 9945): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
E/AndroidRuntime( 9945): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:811)
E/AndroidRuntime( 9945): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Intent.getStringExtra(java.lang.String)' on a null object reference
E/AndroidRuntime( 9945): at com.cueclad.flutterrazorpay.FlutterRazorpayPlugin.onActivityResult(FlutterRazorpayPlugin.java:75)
E/AndroidRuntime( 9945): at io.flutter.app.FlutterPluginRegistry.onActivityResult(FlutterPluginRegistry.java:210)
E/AndroidRuntime( 9945): at io.flutter.app.FlutterActivityDelegate.onActivityResult(FlutterActivityDelegate.java:139)
E/AndroidRuntime( 9945): at io.flutter.app.FlutterActivity.onActivityResult(FlutterActivity.java:138)
E/AndroidRuntime( 9945): at android.app.Activity.dispatchActivityResult(Activity.java:7305)
E/AndroidRuntime( 9945): at android.app.ActivityThread.deliverResults(ActivityThread.java:4378)

Android dependency 'com.android.support:support-compat' has different version for the compile

I've one project with firebase plugin, but when I add this depedency and try to compile I got this problem


* What went wrong:
Execution failed for task ':app:preDebugBuild'.
> Android dependency 'com.android.support:support-compat' has different version for the compile (26.1.0) and runtime (27.1.1) classpath. You should manually set the same version via DependencyResolution

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 3s
Finished with error: Gradle task assembleDebug failed with exit code 1

My app/build.gradle just implemented firebase core
implementation 'com.google.firebase:firebase-core:16.0.1'

and on the end of file applied the plugin
apply plugin: 'com.google.gms.google-services'

and on build.gradle
classpath 'com.google.gms:google-services:4.0.1'

Adicional info

compileSdkVersion 27
minSdkVersion 16
targetSdkVersion 27

Flutter info

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v1.0.0, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.3)
[✓] Android Studio (version 3.2)
[✓] IntelliJ IDEA Ultimate Edition (version 2018.3)
[✓] Connected device (1 available)

• No issues found!

error while Embedding Live Video in iOS

I got this error while playing in iOS. video Player open after the Loading, it closes.

[XCDYouTubeKit] Video operation finished with error: The operation couldn’t be completed. (XCDYouTubeVideoErrorDomain error -2.)
Domain: XCDYouTubeVideoErrorDomain
Code: -2
User Info: {
}

no sound

on latest iOS when running the examples, i dont get any sound. Apart from that, the useFullscreen is also not working.

Video not works in iOS

I'm trying to play video

FlutterYoutube.playYoutubeVideoById(
  apiKey: <my api key>,
  videoId: 'CLXt3yh2g0s',
);

Android works well, but in iOS it closes player after a second. Here are logs

[XCDYouTubeKit] Video operation finished with error: This video is unavailable.
Domain: XCDYouTubeVideoErrorDomain
Code:   150
User Info: {
    AllowedCountries = "{(\n    Hungary,\n    Vietnam,\n    \"New Caledonia\",\n    Burundi,\n    Andorra,\n    \"Pitcairn Islands\",\n    Guinea,\n    \"Norfolk Island\",\n    Togo,\n    Eritrea,\n    Zambia,\n    Syria,\n    Mongolia,\n    Thailand,\n    Netherlands,\n    \"French Guiana\",\n    India,\n    Sudan,\n    Nicaragua,\n    Tanzania,\n    Algeria,\n    Grenada,\n    Venezuela,\n    \"Dominican Republic\",\n    Turkey,\n    \"New Zealand\",\n    Serbia,\n    Japan,\n    Monaco,\n    Finland,\n    Paraguay,\n    Lithuania,\n    Suriname,\n    Dominica,\n    Mauritania,\n    Armenia,\n    Panama,\n    \"St. Martin\",\n    Guernsey,\n    Cambodia,\n    \"Western Sahara\",\n    Azerbaijan,\n    Gabon,\n    Macedonia,\n    Tonga,\n    Bhutan,\n    Lebanon,\n    \"Hong Kong\",\n    \"Svalbard & Jan Mayen\",\n    \"Falkland Islands\",\n    Montserrat,\n    \"Cura\\U00e7ao\"<…>
    [C1.1 B3A3DAF3-0D30-499D-8D39-04D938C4C582 10.0.0.9:59352<->74.125.131.198:443]
    Connected Path: satisfied (Path is satisfied), interface: en0
    Duration: 2.199s, DNS @0.003s took 0.060s, TCP @0.071s took 0.040s, TLS took 0.152s
    bytes in/out: 473777/1301, packets in/out: 366/16, rtt: 0.055s, retransmitted packets: 0, out-of-order packets: 0

FlutterYoutube fails to build when using OneSignal

After installing the onesignal plugin and following the instructions to enable push notifications, app builds fail with the following error:

Error output from Xcode build:
↳
    ** BUILD FAILED **
    
Xcode's output:
↳
    === BUILD TARGET Pods-Runner OF PROJECT Pods WITH CONFIGURATION Release ===
    ld: '/Volumes/Jeff/Development/@Flutter/church_app_flutter/org.jeffmikels.innovation/build/ios/Release-iphoneos/XCDYouTubeKit/libXCDYouTubeKit.a(XCDYouTubeClient.o)' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. file '/Volumes/Jeff/Development/@Flutter/church_app_flutter/org.jeffmikels.innovation/build/ios/Release-iphoneos/XCDYouTubeKit/libXCDYouTubeKit.a' for architecture arm64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    === BUILD TARGET Pods-Runner OF PROJECT Pods WITH CONFIGURATION Release ===
    ld: '/Volumes/Jeff/Development/@Flutter/church_app_flutter/org.jeffmikels.innovation/build/ios/Release-iphoneos/XCDYouTubeKit/libXCDYouTubeKit.a(XCDYouTubeClient.o)' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. file '/Volumes/Jeff/Development/@Flutter/church_app_flutter/org.jeffmikels.innovation/build/ios/Release-iphoneos/XCDYouTubeKit/libXCDYouTubeKit.a' for architecture armv7
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
Encountered error while building for device.

Crash on devices IOS 13

Hi, I'm having this issue.
It's because MPMoviePlayerViewController was removed from iOS 13 completely. We have to use AVPlayerViewController instead.
This is the logs

[+1556 ms] [DEVICE LOG] 2019-08-22 16:10:46.849785+0700 localhost Runner[48682]: (CoreFoundation) *** Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: 'MPMoviePlayerViewController is no longer available. Use AVPlayerViewController in AVKit.'
[ ] [DEVICE LOG] *** First throw call stack:
[ ] [DEVICE LOG] (
[ ] [DEVICE LOG] 0 CoreFoundation 0x00007fff23af9c3e __exceptionPreprocess + 350
[ ] [DEVICE LOG] 1 libobjc.A.dylib 0x00007fff50131de0 objc_exception_throw + 48
[ ] [DEVICE LOG] 2 CoreFoundation 0x00007fff23af9a7c +[NSException raise:format:] + 188
[ ] [DEVICE LOG] 3 MediaPlayer 0x00007fff27646fb9 -[MPMoviePlayerViewController initWithContentURL:] + 94
[ ] [DEVICE LOG] 4 XCDYouTubeKit 0x000000010b528cbf -[XCDYouTubeVideoPlayerViewController initWithVideoIdentifier:] +
495
[ ] [DEVICE LOG] 5 flutter_youtube 0x000000010b59721d +[FlutterYoutubePlugin playVideo:] + 77
[ ] [DEVICE LOG] 6 flutter_youtube 0x000000010b5970d3 __46+[FlutterYoutubePlugin registerWithRegistrar:]_block_invoke +
643
[ ] [DEVICE LOG] 7 Flutter 0x000000010948ac79 __45-<…>
[ +10 ms] *** First throw call stack:
[ ] (
[ ] 0 CoreFoundation 0x00007fff23af9c3e __exceptionPreprocess + 350
[ ] 1 libobjc.A.dylib 0x00007fff50131de0 objc_exception_throw + 48
[ ] 2 CoreFoundation 0x00007fff23af9a7c +[NSException raise:format:] + 188
[ ] 3 MediaPlayer 0x00007fff27646fb9 -[MPMoviePlayerViewController initWithContentURL:] + 94
[ ] 4 XCDYouTubeKit 0x000000010b528cbf -[XCDYouTubeVideoPlayerViewController initWithVideoIdentifier:] + 495
[ ] 5 flutter_youtube 0x000000010b59721d +[FlutterYoutubePlugin playVideo:] + 77
[ ] 6 flutter_youtube 0x000000010b5970d3 __46+[FlutterYoutubePlugin registerWithRegistrar:]_block_invoke + 643
[ ] 7 Flutter 0x000000010948ac79 __45-<…>
[ +129 ms] Service protocol connection closed.
[ ] Lost connection to device.
[ +1 ms] DevFS: Deleting filesystem on the device

How to play multiple videos?

Is there any way to play two videos after one another?
Basically I just want to play another video when first video ended.
Is there any way to do it with this widget?
@ponnamkarthik

Getting error on exiting the video

Whenever videos is exited from full screen getting this error, and app restarts, let me know how to resolve this issue.

Error Trace:
D/FlutterNativeView(28944): FlutterView.send called on a detached view, channel=PonnamKarthik/flutter_youtube_stream
I/flutter (28944): ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
I/flutter (28944): The following message was thrown during layout:
I/flutter (28944): A RenderFlex overflowed by 74 pixels on the bottom.
I/flutter (28944):
I/flutter (28944): The overflowing RenderFlex has an orientation of Axis.vertical.
I/flutter (28944): The edge of the RenderFlex that is overflowing has been marked in the rendering with a yellow and
I/flutter (28944): black striped pattern. This is usually caused by the contents being too big for the RenderFlex.
I/flutter (28944): Consider applying a flex factor (e.g. using an Expanded widget) to force the children of the
I/flutter (28944): RenderFlex to fit within the available space instead of being sized to their natural size.
I/flutter (28944): This is considered an error condition because it indicates that there is content that cannot be
I/flutter (28944): seen. If the content is legitimately bigger than the available space, consider clipping it with a
I/flutter (28944): ClipRect widget before putting it in the flex, or using a scrollable container rather than a Flex,
I/flutter (28944): like a ListView.
I/flutter (28944): The specific RenderFlex in question is:
I/flutter (28944): RenderFlex#f7e41 relayoutBoundary=up1 OVERFLOWING
I/flutter (28944): creator: Column ← Container ← Expanded ← Column ← Stack ← Listener ← _GestureSemantics ←
I/flutter (28944): RawGestureDetector ← GestureDetector ← InkWell ← MediaQuery ← LayoutId-[<_ScaffoldSlot.body>] ← ⋯
I/flutter (28944): parentData: offset=Offset(190.0, 0.0); flex=2; fit=FlexFit.tight (can use size)
I/flutter (28944): constraints: BoxConstraints(0.0<=w<=640.0, h=240.0)
I/flutter (28944): size: Size(260.0, 240.0)
I/flutter (28944): direction: vertical
I/flutter (28944): mainAxisAlignment: center
I/flutter (28944): mainAxisSize: max
I/flutter (28944): crossAxisAlignment: center
I/flutter (28944): verticalDirection: down
I/flutter (28944): ◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤

Crashing On Physical iOS Device When WiFi Is Off

I put my app on my physical device (iPhone XR v13.1.3). I have not tested this out on Android yet.

With the WiFi on I tap on one of my containers it passes in the YouTube video id to the playYoutubeVideoById() and it pulls up the player playing the video working just fine. When I do all of those things with the WiFi off, so it's just using cellular data, it does not work.

I don't know if this is just a problem with the package or if I am doing anything wrong in general with just the way I setup my entire app haha.

Has anybody ever even heard of this problem in general with turning on and off the WiFi to make something work/not work?

Crash when vicdeo ends on Android 6.0.1 [youtube.onVideoEnded.listen]

Hi all!

When I test on Android 6.0.1 and listen to youtube.onVideoEnded.listen, after a video ends the whole app crashes with following error:

Caused by: java.lang.RuntimeException: Cannot execute operation because FlutterJNI is not attached to native.
io.flutter.embedding.engine.FlutterJNI.ensureAttachedToNative(FlutterJNI.java:514)
io.flutter.embedding.engine.FlutterJNI.dispatchPlatformMessage(FlutterJNI.java:444)
io.flutter.embedding.engine.dart.DartMessenger.send(DartMessenger.java:74)
io.flutter.embedding.engine.dart.DartExecutor.send(DartExecutor.java:149)
io.flutter.view.FlutterNativeView.send(FlutterNativeView.java:142)
io.flutter.plugin.common.EventChannel$IncomingStreamRequestHandler$EventSinkImplementation.success(EventChannel.java:213)
io.github.ponnamkarthik.flutteryoutube.FlutterYoutubePlugin$1.onActivityResult(FlutterYoutubePlugin.java:41)
io.flutter.app.FlutterPluginRegistry.onActivityResult(FlutterPluginRegistry.java:218)
io.flutter.app.FlutterActivityDelegate.onActivityResult(FlutterActivityDelegate.java:143)
io.flutter.app.FlutterActivity.onActivityResult(FlutterActivity.java:142)
android.app.Activity.dispatchActivityResult(Activity.java:6456)
android.app.ActivityThread.deliverResults(ActivityThread.java:3729)

Gradle: Configuration 'compile' is obsolete

> Configure project :flutter_youtube
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

No audio on IOS 12

I don't know if this is just Flutter or this package but it seams like there is no audio on a IOS 12 running device.

autoplay feature

There should be a way to automatically play videos when the activity is launched

Android crash when launch video

My app crash when i do FlutterYoutube.playYoutubeVideoById on Android device, but it works fine on IOS device.

the log shows something like:

D/AndroidRuntime( 4571): Shutting down VM
E/AndroidRuntime( 4571): FATAL EXCEPTION: main
E/AndroidRuntime( 4571): Process: com.example.youtube, PID: 4571
E/AndroidRuntime( 4571): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.youtube/io.github.ponnamkarthik.flutteryoutube.PlayerActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.ActionBar.hide()' on a null object reference
E/AndroidRuntime( 4571): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2665)
E/AndroidRuntime( 4571): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
E/AndroidRuntime( 4571): at android.app.ActivityThread.-wrap12(ActivityThread.java)
E/AndroidRuntime( 4571): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
E/AndroidRuntime( 4571): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 4571): at android.os.Looper.loop(Looper.java:154)
E/AndroidRuntime( 4571): at android.app.ActivityThread.main(ActivityThread.java:6119)
E/AndroidRuntime( 4571): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 4571): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
E/AndroidRuntime( 4571): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
E/AndroidRuntime( 4571): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.ActionBar.hide()' on a null object reference
E/AndroidRuntime( 4571): at io.github.ponnamkarthik.flutteryoutube.PlayerActivity.onCreate(PlayerActivity.java:33)
E/AndroidRuntime( 4571): at android.app.Activity.performCreate(Activity.java:6679)
E/AndroidRuntime( 4571): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
E/AndroidRuntime( 4571): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
E/AndroidRuntime( 4571): ... 9 more

PlatformException(error, Unable to find explicit activity class

When this plug-in is run, the following message is displayed
Please tell me the solution.

Unhandled Exception: PlatformException(error, Unable to find explicit activity class {naton.slkdflsdkflk00945.natinio_rebuilding/### io.github.ponnamkarthik.flutteryoutube.PlayerActivity}; have you declared this activity in your AndroidManifest.xml?, null)

Version 1.1.3 android is broken (missing ; in java)

Following error happens with the newest version 1.1.3

/opt/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_youtube-1.1.3/android/src/main/java/io/github/ponnamkarthik/flutteryoutube/FlutterYoutubePlugin.java:20: error: ';' expected
  private static final int YOUTUBE_PLAYER_RESULT = 6646

Somehow it seems like that file is totally different from what is currently on github here: https://github.com/PonnamKarthik/FlutterYoutube/blob/master/android/src/main/java/io/github/ponnamkarthik/flutteryoutube/FlutterYoutubePlugin.java

So I guess you probably released 1.1.3 by accident while still working on it?

Current workaround

Force version 1.1.2 in pubspec.yaml

flutter_youtube: "1.1.2" # instead fo "^1.1.2" to force 1.1.2 until 1.1.3 is fixed

flutter_yotube plugin incompatible with cloud_firestore on AndroidXproject

Steps to reproduce:
set up dart file from example, start with cloud_firestore - apk generation successful
add flutter_youtube: ^2.0.0 to pubspec, get dependencies and execute - errors; no apk created

https://codelabs.developers.google.com/codelabs/flutter-firebase/#10
pubspec.yaml
dependencies:
flutter:
sdk: flutter
cloud_firestore: ^0.12.9+3
flutter_youtube: ^2.0.0

Launching lib/testFireBase.dart on Redmi Note 6 Pro in debug mode...
Initializing gradle...
Resolving dependencies...
Running Gradle task 'assembleDebug'...

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:preDebugBuild'.

Android dependency 'androidx.lifecycle:lifecycle-runtime' has different version for the compile (2.0.0) and runtime (2.1.0) classpath. You should manually set the same version via DependencyResolution

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 13s


The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
See https://goo.gl/CP92wY for more information on the problem and how to fix it.


Finished with error: Gradle task assembleDebug failed with exit code 1

Please ensure plugin is compatible with cloud_firestore as it will be useful for apps that use cloud_firestore and play youtube videos!

Thank you for fixing the bug.

Best Regards!

Crash when video ends if onVideoEnded stream is not listened to

How to reproduce :
final youtube = FlutterYoutube(); youtube.playYoutubeVideoById( apiKey: apiKey, videoId: id, fullScreen: false, autoPlay: true, );
Basically the same code as in the README example.

However it does not crash if we listen to the onVideoEnded stream

Error Player not run

I'm getting this error when i try to reproduce a video.
Maybe the ios lib is not updated?

[XCDYouTubeKit] JavaScript exception: TypeError: window.matchMedia is not a function.
(In 'window.matchMedia("(max-width: 656px)")', 'window.matchMedia' is undefined)
[XCDYouTubeKit] JavaScript exception: TypeError: window.matchMedia is not a function.
(In 'window.matchMedia("(max-width: 656px)")', 'window.matchMedia' is undefined)
[XCDYouTubeKit] No signature function in player script
[XCDYouTubeKit] Video operation finished with error: The operation couldn’t be completed. (XCDYouTubeVideoErrorDomain error -2.)Domain: XCDYouTubeVideoErrorDomain Code: -2

Call back after video is played

First of all, thanks for such a wonderful library.

But there a few things which I think are essential.

There should be some way to receive callback once a video is done playing.

Also, there should be options to hide seekbar and other options.

This plugin puts the developer in violation of Youtube ToS on iOS

This plugin uses https://github.com/0xced/XCDYouTubeKit on iOS, which contains the following warning in its readme:

XCDYouTubeKit is against the YouTube Terms of Service. The only official way of playing a YouTube video inside an app is with a web view and the iframe player API. Unfortunately, this is very slow and quite ugly, so I wrote this player to give users a better viewing experience.

Because this plugin uses the official Youtube player module on android (com.google.android.youtube.player.YouTubePlayer) I had assumed something similar was the case on iOS, and used this plugin with this in mind, however about a week ago, playback broke for many videos (see issue 0xced/XCDYouTubeKit#419). Because it is not an officially supported player, this results in both terms of service violation and instability, risks, etc (when you have a live iOS app and it stops working, you can't just push a quick update - it needs to be approved by apple/etc).

While there isn't much that can be done about it, at least a warning should be shown in the README.

Only playing in full screen

I have added this much code to integrate it. I am checking in iOS 12.4 The issue I am facing is when I call this, it always open it in the full screen. I have seen the default is fullScreen = false, Still, I have added fullScreen: false to specify not open in full screen still it opens in full screen.

    FlutterYoutube.playYoutubeVideoByUrl(
      apiKey: "AIzaSyDS6Aoo-Srrs5tHVfw6fcGfTaif-kWxtnA",
      videoUrl: "https://www.youtube.com/watch?v=ZtfItHwFlZ8",
      fullScreen: false
    );

Does anyone have a solution for this?

No implementation found for method playYoutubeVideo on channel PonnamKarthik/flutter_youtube

I get this error when trying to start a simple Youtube video

Performing hot reload... Reloaded 3 of 675 libraries in 1,720ms. E/flutter ( 6127): [ERROR:flutter/shell/common/shell.cc(178)] Dart Error: Unhandled exception: E/flutter ( 6127): MissingPluginException(No implementation found for method playYoutubeVideo on channel PonnamKarthik/flutter_youtube) E/flutter ( 6127): #0 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:314:7) E/flutter ( 6127): <asynchronous suspension> E/flutter ( 6127): #1 FlutterYoutube.playYoutubeVideoById (package:flutter_youtube/flutter_youtube.dart:97:14) E/flutter ( 6127): #2 _YouTubeShowResults.build (package:quick_song/search_results_widget.dart:19:24) E/flutter ( 6127): #3 StatefulElement.build (package:flutter/src/widgets/framework.dart:4047:27) E/flutter ( 6127): #4 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3941:15) E/flutter ( 6127): #5 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5) E/flutter ( 6127): #6 StatefulElement.update (package:flutter/src/widgets/framework.dart:4120:5) E/flutter ( 6127): #7 Element.updateChild (package:flutter/src/widgets/framework.dart:2893:15) E/flutter ( 6127): #8 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5134:14) E/flutter ( 6127): #9 Element.updateChild (package:flutter/src/widgets/framework.dart:2893:15) E/flutter ( 6127): #10 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16) E/flutter ( 6127): #11 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5) E/flutter ( 6127): #12 StatelessElement.update (package:flutter/src/widgets/framework.dart:4016:5) E/flutter ( 6127): #13 Element.updateChild (package:flutter/src/widgets/framework.dart:2893:15) E/flutter ( 6127): #14 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5134:14) E/flutter ( 6127): #15 Element.updateChild (package:flutter/src/widgets/framework.dart:2893:15) E/flutter ( 6127): #16 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5134:14) E/flutter ( 6127): #17 Element.updateChild (package:flutter/src/widgets/framework.dart:2893:15) E/flutter ( 6127): #18 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5134:14) E/flutter ( 6127): #19 Element.updateChild (package:flutter/src/widgets/framework.dart:2893:15) E/flutter ( 6127): #20 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5134:14) E/flutter ( 6127): #21 Element.updateChild (package:flutter/src/widgets/framework.dart:2893:15) E/flutter ( 6127): #22 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16) E/flutter ( 6127): #23 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5) E/flutter ( 6127): #24 StatefulElement.update (package:flutter/src/widgets/framework.dart:4120:5) E/flutter ( 6127): #25 Element.updateChild (package:flutter/src/widgets/framework.dart:2893:15) E/flutter ( 6127): #26 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16) E/flutter ( 6127): #27 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5) E/flutter ( 6127): #28 StatelessElement.update (package:flutter/src/widgets/framework.dart:4016:5) E/flutter ( 6127): #29 Element.updateChild (package:flutter/src/widgets/framework.dart:2893:15) E/flutter ( 6127): #30 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16) E/flutter ( 6127): #31 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5) E/flutter ( 6127): #32 StatefulElement.update (package:flutter/src/widgets/framework.dart:4120:5) E/flutter ( 6127): #33 Element.updateChild (package:flutter/src/widgets/framework.dart:2893:15) E/flutter ( 6127): #34 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5134:14) E/flutter ( 6127): #35 Element.updateChild (package:flutter/src/widgets/framework.dart:2893:15) E/flutter ( 6127): #36 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16) E/flutter ( 6127): #37 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5) E/flutter ( 6127): #38 ProxyElement.update (package:flutter/src/widgets/framework.dart:4254:5) E/flutter ( 6127): #39 _InheritedNotifierElement.update (package:flutter/src/widgets/inherited_notifier.dart:94:11) E/flutter ( 6127): #40 Element.updateChild (package:flutter/src/widgets/framework.dart:2893:15) E/flutter ( 6127): #41 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5134:14) E/flutter ( 6127): #42 Element.updateChild (package:flutter/src/widgets/framework.dart:2893:15) E/flutter ( 6127): #43 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16) E/flutter ( 6127): #44 Element.rebuild (p

source code:
Widget build(BuildContext context){ return Container( child: FlutterYoutube.playYoutubeVideoById( apiKey: "API_KEY", videoId: widget.searchId, autoPlay: true, //default falase fullScreen: true //default false ) ) }

Error with 1.3.5

When building with the latest version, I get the following error:

Compiler message:
../../.pub-cache/hosted/pub.dartlang.org/flutter_youtube-1.3.5/lib/flutter_youtube.dart:61:22: Error: Method not found: 'parseColorToHex'.
'appBarColor': parseColorToHex(appBarColor),
^^^^^^^^^^^^^^^
../../.pub-cache/hosted/pub.dartlang.org/flutter_youtube-1.3.5/lib/flutter_youtube.dart:62:26: Error: Method not found: 'parseColorToHex'.
'backgroundColor': parseColorToHex(backgroundColor),
^^^^^^^^^^^^^^^
../../.pub-cache/hosted/pub.dartlang.org/flutter_youtube-1.3.5/lib/flutter_youtube.dart:88:22: Error: Method not found: 'parseColorToHex'.
'appBarColor': parseColorToHex(appBarColor),
^^^^^^^^^^^^^^^
../../.pub-cache/hosted/pub.dartlang.org/flutter_youtube-1.3.5/lib/flutter_youtube.dart:89:26: Error: Method not found: 'parseColorToHex'.
'backgroundColor': parseColorToHex(backgroundColor),

Build error by Flutter v1.9.1+hotfix.4

Running flutter doctor...
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.9.1+hotfix.4, on Mac OS X 10.14.6 18G103, locale zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 11.1)
[✓] Android Studio (version 3.5)
[✓] VS Code (version 1.39.1)
[✓] Connected device (1 available)

Build Error:
Static method 'playYoutubeVideoByUrl' can't be accessed through an instance.
Try using the class 'FlutterYoutube' to access the method.

Embed config is not supported in RemoteEmbeddedPlayer

W/YouTubeAndroidPlayerAPI( 4924): Forcefully created overlay:adyo@42e9ecb0 helper:Lazy@42ea0408 view:null status: ....... {...}
E/YouTubeAndroidPlayerAPI( 4924): Embed config is not supported in RemoteEmbeddedPlayer.

Physical Device

  • Android 4.4.4 KTU84P
  • HM NOTE 1LTE

Video not playing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.