sarbagyastha / youtube_player_flutter

A Flutter plugin for inline playback or streaming of YouTube videos using the official iFrame Player API.
https://youtube.sarbagyastha.com.np
BSD 3-Clause "New" or "Revised" License
698 stars 801 forks source link

[BUG] Full screen option is not working... #241

Open AshutoshPatole opened 4 years ago

AshutoshPatole commented 4 years ago

I implemented this into one of my application and the full screen didn't worked. I even tried the example snippet provided in example/lib/main.dart but same log happened

This is the log

I/PressGestureDetector( 5303): ORIENTATION_LANDSCAPE W/libEGL ( 5303): EGLNativeWindowType 0x7204703010 disconnect failed D/mali_winsys( 5303): EGLint new_window_surface(egl_winsys_display , void , EGLSurface, EGLConfig, egl_winsys_surface *, egl_color_buffer_format , EGLBoolean) returns 0x3000 W/PlatformViewsController( 5303): Creating a virtual display of size: [2040, 1080] may result in problems(https://github.com/flutter/flutter/issues/2897).It is larger than the device screen size: [1080, 2040].

Device: Honor 9i Android 8.0

sarbagyastha commented 4 years ago

Is it crashing or just not switching to fullscreen ?

AshutoshPatole commented 4 years ago

No it doesn't crash the application but it doesn't switch to full screen.. thanks for the quick reply

sarbagyastha commented 4 years ago

Can you describe more on what exactly happens on switching to fullscreen mode? Also are you wrapping your player with YoutubePlayerBuilder ?

AshutoshPatole commented 4 years ago

yup i wrapped the youtube player inside youtube player builder and i even used your example code and it gave me the same error

when i click on the full screen button, it fills out the screen with black for a fraction of second and then gets to its original portrait mode and the youtube player pauses

rafaelmaeuer commented 4 years ago

After the update to v7, fullscreen doesn't work anymore. I wrapped the component in YoutubePlayerBuilder but it doesn't help. This is from the error-log:

Tried calling: value
#0      Object.noSuchMethod  (dart:core-patch/object_patch.dart:53:5)
#1      _YoutubePlayerBuilderState.didChangeMetrics 
package:youtube_player_flutter/…/widgets/youtube_player_builder.dart:58
#2      WidgetsBinding.handleMetricsChanged 
package:flutter/…/widgets/binding.dart:538
#3      _rootRun  (dart:async/zone.dart:1184:13)
#4      _CustomZone.run  (dart:async/zone.dart:1077:19)
#5      _CustomZone.runGuarded  (dart:async/zone.dart:979:7)
#6      _invoke  (dart:ui/hooks.dart:261:10)
#7      _updateWindowMetrics  (dart:ui/hooks.dart:64:3)
vipinnegi90 commented 4 years ago

@AshutoshPatole are you playing the video on a Dialog? Because that exactly happened to me when I tried from Dialog. After I switched to a dedicated layout for playing videos it worked just fine. Here is my code:

`import 'package:flutter/material.dart'; import 'package:youtube_player_flutter/youtube_player_flutter.dart';

class VideoView extends StatelessWidget { final String videoId; VideoView({this.videoId}); @override Widget build(BuildContext context) { YoutubePlayerController _controller = YoutubePlayerController( initialVideoId: videoId, flags: YoutubePlayerFlags( autoPlay: true, ), ); return Center( child: YoutubePlayerBuilder( player: YoutubePlayer( controller: _controller, // showVideoProgressIndicator: true, ), builder: (context , player ) { return Column( children: [ player, ], ); }, ), ); } } `

AshutoshPatole commented 4 years ago

@vipinnegi90 no I'm not using a dialog to show the youtube and i tried your code too but it didn't worked and threw the same errors. is there anything with my code? but id did worked perfectly before updating to v7.x.x anyway I'm pasting a detailed log text to clear this issue.

Edit 1: I just noticed that this error has nothing to do with my code. I created a new flutter project and added just flutter_youtube_player dependency and copied the code provided in examples just to make sure that it works but again it threw the same error. I even tried this in 2 different phones.

honor 9i => android 8.0 asus zenfone maxpro m1 => android 9.0

@sarbagyastha please fix this issue and ping me if you need any more information from me.


Performing hot reload...
Syncing files to device RNE L22...
Reloaded 0 of 797 libraries in 486ms.
V/AudioManager(10229): playSoundEffect   effectType: 0
E/BufferQueueProducer(10229): [] Can not get hwsched service
D/HwCust  (10229): Create obj success use class android.app.HwCustHwWallpaperManagerImpl
D/HwRTBlurUtils(10229): check blur style for HwPhoneWindow, themeResId : 0x0103023e, context : android.app.Presentation$3@ad0bded, Nhwext : 0, get Blur : disable with , null
D/HwRTBlurUtils(10229): check blur style for HwPhoneWindow, themeResId : 0x0103023e, context : android.app.Presentation$3@ad0bded, Nhwext : 0, get Blur : disable with , null
D/OpenGLRenderer(10229):   HWUI Binary is  enabled
D/OpenGLRenderer(10229):   HWUI Binary is  enabled
I/PressGestureDetector(10229): HiTouch restricted: AboardArea.
D/mali_winsys(10229): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, egl_color_buffer_format *, EGLBoolean) returns 0x3000
D/        (10229): TrackPlayerBase::~TrackPlayerBase()
D/        (10229): PlayerBase::~PlayerBase()
W/InputMethodManager(10229): startInputReason = 3
V/AudioManager(10229): getProperty  key: android.media.property.OUTPUT_SAMPLE_RATE
V/AudioManager(10229): getProperty  key: android.media.property.OUTPUT_SAMPLE_RATE
E/BufferQueueProducer(10229): [] Can not get hwsched service
D/        (10229): PlayerBase::PlayerBase()
D/        (10229): TrackPlayerBase::TrackPlayerBase()
I/libOpenSLES(10229): Emulating old channel mask behavior (ignoring positional mask 0x3, using default mask 0x3 based on channel count of 2)
I/cr_MediaCodecBridge(10229): create MediaCodec video decoder, mime video/avc
D/AudioTrack(10229): OFFLOAD 0,mNotificationFrames 0,mStreamType =3,mOriginalSampleRate 48000,mAfSampleRate 48000,mTransfer 1
D/AudioTrack(10229): Client defaulted notificationFrames to 962 for frameCount 1924
I/OMXClient(10229): Treble IOmx obtained
I/ACodec  (10229): In onAllocateComponent create compenent, codec name: OMX.IMG.MSVDX.Decoder.AVC
I/MediaCodec(10229): MediaCodec will operate in async mode
D/SurfaceUtils(10229): connecting to surface 0x72048ef010, reason connectToSurface
I/MediaCodec(10229): [OMX.IMG.MSVDX.Decoder.AVC] setting surface generation to 10474506
D/SurfaceUtils(10229): disconnecting from surface 0x72048ef010, reason connectToSurface(reconnect)
D/SurfaceUtils(10229): connecting to surface 0x72048ef010, reason connectToSurface(reconnect)
W/HwExtendedUtils(10229): hw configLocalPlayBack err = -1010
E/ACodec  (10229): [OMX.IMG.MSVDX.Decoder.AVC] setPortMode on output to DynamicANWBuffer failed w/ err -1010
W/ACodec  (10229): [OMX.IMG.MSVDX.Decoder.AVC] prepareForAdaptivePlayback failed w/ err -1010
I/HwExtendedCodec(10229): mime is [video/avc] at setVideoFormat
I/ACodec  (10229): onStart
I/HwExtendedUtils(10229): error setConfig queuesToNativeWindow (err -1010)
D/SurfaceUtils(10229): disconnecting from surface 0x72048ef010, reason setNativeWindowSizeFormatAndUsage
D/SurfaceUtils(10229): connecting to surface 0x72048ef010, reason setNativeWindowSizeFormatAndUsage
D/SurfaceUtils(10229): set up nativeWindow 0x72048ef010 for 960x720, color 0x300, rotation 0, usage 0x20002900
W/GrallocMapperPassthrough(10229): buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough(10229): buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough(10229): buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough(10229): buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough(10229): buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough(10229): buffer descriptor with invalid usage bits 0x2000
I/HwExtendedUtils(10229): error setConfig queuesToNativeWindow (err -1010)
D/SurfaceUtils(10229): disconnecting from surface 0x72048ef010, reason setNativeWindowSizeFormatAndUsage
D/SurfaceUtils(10229): connecting to surface 0x72048ef010, reason setNativeWindowSizeFormatAndUsage
D/SurfaceUtils(10229): set up nativeWindow 0x72048ef010 for 960x720, color 0x300, rotation 0, usage 0x20002900
W/GrallocMapperPassthrough(10229): buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough(10229): buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough(10229): buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough(10229): buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough(10229): buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough(10229): buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough(10229): buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough(10229): buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough(10229): buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough(10229): buffer descriptor with invalid usage bits 0x2000
V/AudioManager(10229): requestAudioFocus  streamType: 3  durationHint: 1
V/AudioManager(10229): registerAudioFocusListener...
E/chromium(10229): [ERROR:web_contents_delegate.cc(218)] WebContentsDelegate::CheckMediaAccessPermission: Not supported.
E/chromium(10229): [ERROR:web_contents_delegate.cc(218)] WebContentsDelegate::CheckMediaAccessPermission: Not supported.
W/cr_media(10229): Requires MODIFY_AUDIO_SETTINGS and RECORD_AUDIO. No audio device will be available for recording
I/CameraManagerGlobal(10229): do not need hide aux camera, device number: 2
I/chatty  (10229): uid=10314(u0_a314) ThreadPoolSingl identical 10 lines
I/CameraManagerGlobal(10229): do not need hide aux camera, device number: 2
V/AudioManager(10229): playSoundEffect   effectType: 0
I/PressGestureDetector(10229): ORIENTATION_LANDSCAPE
I/PressGestureDetector(10229): ORIENTATION_LANDSCAPE
W/libEGL  (10229): EGLNativeWindowType 0x720487b010 disconnect failed
D/mali_winsys(10229): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, egl_color_buffer_format *, EGLBoolean) returns 0x3000
W/libEGL  (10229): EGLNativeWindowType 0x720487c010 disconnect failed
D/mali_winsys(10229): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, egl_color_buffer_format *, EGLBoolean) returns 0x3000
W/libEGL  (10229): EGLNativeWindowType 0x720487b010 disconnect failed
D/mali_winsys(10229): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, egl_color_buffer_format *, EGLBoolean) returns 0x3000
W/libEGL  (10229): EGLNativeWindowType 0x720487b010 disconnect failed
D/mali_winsys(10229): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, egl_color_buffer_format *, EGLBoolean) returns 0x3000
W/libEGL  (10229): EGLNativeWindowType 0x720487c010 disconnect failed
D/mali_winsys(10229): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, egl_color_buffer_format *, EGLBoolean) returns 0x3000
W/PlatformViewsController(10229): Creating a virtual display of size: [2160, 1080] may result in problems(https://github.com/flutter/flutter/issues/2897).It is larger than the device screen size: [1080, 2040].
D/HwCust  (10229): Create obj success use class android.app.HwCustHwWallpaperManagerImpl
D/HwRTBlurUtils(10229): check blur style for HwPhoneWindow, themeResId : 0x0103023e, context : android.app.Presentation$3@a4e8291, Nhwext : 0, get Blur : disable with , null
D/HwRTBlurUtils(10229): check blur style for HwPhoneWindow, themeResId : 0x0103023e, context : android.app.Presentation$3@a4e8291, Nhwext : 0, get Blur : disable with , null
D/OpenGLRenderer(10229):   HWUI Binary is  enabled
I/PressGestureDetector(10229): HiTouch restricted: AboardArea.
D/AudioTrack(10229): stop() called with 561604 frames delivered
D/        (10229): PlayerBase::stop() from IPlayer
W/cr_MediaCodecBridge(10229): Releasing: OMX.IMG.MSVDX.Decoder.AVC
W/ACodec  (10229): forcing OMX state to Idle when received shutdown in ExecutingState
D/SurfaceUtils(10229): disconnecting from surface 0x72048ef010, reason disconnectFromSurface
W/cr_MediaCodecBridge(10229): Codec released
D/mali_winsys(10229): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, egl_color_buffer_format *, EGLBoolean) returns 0x3000
V/AudioManager(10229): requestAudioFocus  streamType: 3  durationHint: 1
V/AudioManager(10229): registerAudioFocusListener...
V/AudioManager(10229): unregisterAudioFocusListener...
I/AudioManager(10229): abandonAudioFocus
W/libEGL  (10229): EGLNativeWindowType 0x720487c010 disconnect failed
D/mali_winsys(10229): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, egl_color_buffer_format *, EGLBoolean) returns 0x3000
D/OpenGLRenderer(10229):   HWUI Binary is  enabled
D/HwCust  (10229): Create obj success use class android.app.HwCustHwWallpaperManagerImpl
D/HwRTBlurUtils(10229): check blur style for HwPhoneWindow, themeResId : 0x0103023e, context : android.app.Presentation$3@fab94ef, Nhwext : 0, get Blur : disable with , null
D/HwRTBlurUtils(10229): check blur style for HwPhoneWindow, themeResId : 0x0103023e, context : android.app.Presentation$3@fab94ef, Nhwext : 0, get Blur : disable with , null
D/OpenGLRenderer(10229):   HWUI Binary is  enabled
I/PressGestureDetector(10229): HiTouch restricted: AboardArea.
I/zygote64(10229): Do partial code cache collection, code=1006KB, data=604KB
I/zygote64(10229): After code cache collection, code=1006KB, data=604KB
I/zygote64(10229): Increasing code cache capacity to 3MB
D/mali_winsys(10229): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, egl_color_buffer_format *, EGLBoolean) returns 0x3000
D/OpenGLRenderer(10229):   HWUI Binary is  enabled
V/AudioManager(10229): getProperty  key: android.media.property.OUTPUT_SAMPLE_RATE
V/AudioManager(10229): getProperty  key: android.media.property.OUTPUT_SAMPLE_RATE
E/BufferQueueProducer(10229): [] Can not get hwsched service
I/cr_MediaCodecBridge(10229): create MediaCodec video decoder, mime video/avc
I/OMXClient(10229): Treble IOmx obtained
I/ACodec  (10229): In onAllocateComponent create compenent, codec name: OMX.IMG.MSVDX.Decoder.AVC
I/MediaCodec(10229): MediaCodec will operate in async mode
D/SurfaceUtils(10229): connecting to surface 0x72048ef010, reason connectToSurface
I/MediaCodec(10229): [OMX.IMG.MSVDX.Decoder.AVC] setting surface generation to 10474507
D/SurfaceUtils(10229): disconnecting from surface 0x72048ef010, reason connectToSurface(reconnect)
D/SurfaceUtils(10229): connecting to surface 0x72048ef010, reason connectToSurface(reconnect)
W/HwExtendedUtils(10229): hw configLocalPlayBack err = -1010
E/ACodec  (10229): [OMX.IMG.MSVDX.Decoder.AVC] setPortMode on output to DynamicANWBuffer failed w/ err -1010
W/ACodec  (10229): [OMX.IMG.MSVDX.Decoder.AVC] prepareForAdaptivePlayback failed w/ err -1010
I/HwExtendedCodec(10229): mime is [video/avc] at setVideoFormat
I/ACodec  (10229): onStart
I/HwExtendedUtils(10229): error setConfig queuesToNativeWindow (err -1010)
D/SurfaceUtils(10229): disconnecting from surface 0x72048ef010, reason setNativeWindowSizeFormatAndUsage
D/SurfaceUtils(10229): connecting to surface 0x72048ef010, reason setNativeWindowSizeFormatAndUsage
D/SurfaceUtils(10229): set up nativeWindow 0x72048ef010 for 960x720, color 0x300, rotation 0, usage 0x20002900
W/GrallocMapperPassthrough(10229): buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough(10229): buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough(10229): buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough(10229): buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough(10229): buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough(10229): buffer descriptor with invalid usage bits 0x2000
I/HwExtendedUtils(10229): error setConfig queuesToNativeWindow (err -1010)
D/SurfaceUtils(10229): disconnecting from surface 0x72048ef010, reason setNativeWindowSizeFormatAndUsage
D/SurfaceUtils(10229): connecting to surface 0x72048ef010, reason setNativeWindowSizeFormatAndUsage
D/SurfaceUtils(10229): set up nativeWindow 0x72048ef010 for 960x720, color 0x300, rotation 0, usage 0x20002900
W/GrallocMapperPassthrough(10229): buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough(10229): buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough(10229): buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough(10229): buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough(10229): buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough(10229): buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough(10229): buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough(10229): buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough(10229): buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough(10229): buffer descriptor with invalid usage bits 0x2000
sarbagyastha commented 4 years ago

@AshutoshPatole Could you please test with these apks ?

AshutoshPatole commented 4 years ago

@sarbagyastha yup it works perfectly but why didn't this worked when i copied the same code and tried to run in debug mode? not even in a new project that contained just the youtube player

sarbagyastha commented 4 years ago

Please provide a reproducible example so that i can test. Could't see anything suspicious in the log.

vipinnegi90 commented 4 years ago

@AshutoshPatole What is the flutter version you're compiling with?

AshutoshPatole commented 4 years ago

@vipinnegi90 flutter1.17.2 dart 2.8.3

vipinnegi90 commented 4 years ago

@AshutoshPatole I believe that's a typo for v1.17.1. Upgrade to v1.17.2 and try.

AshutoshPatole commented 4 years ago

@sarbagyastha

updated Logs: The error comes after pressing on the full screen button

V/AudioManager(21942): playSoundEffect   effectType: 0
V/AudioManager(21942): playSoundEffect   effectType: 0
E/BufferQueueProducer(21942): [] Can not get hwsched service
D/HwCust  (21942): Create obj success use class android.app.HwCustHwWallpaperManagerImpl
D/HwRTBlurUtils(21942): check blur style for HwPhoneWindow, themeResId : 0x0103023e, context : android.app.Presentation$3@ebf21c8, Nhwext : 0, get Blur : disable with , null
D/HwRTBlurUtils(21942): check blur style for HwPhoneWindow, themeResId : 0x0103023e, context : android.app.Presentation$3@ebf21c8, Nhwext : 0, get Blur : disable with , null
D/OpenGLRenderer(21942):   HWUI Binary is  enabled
D/OpenGLRenderer(21942):   HWUI Binary is  enabled
I/PressGestureDetector(21942): HiTouch restricted: AboardArea.
D/mali_winsys(21942): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, egl_color_buffer_format *, EGLBoolean) returns 0x3000
I/zygote64(21942): Do full code cache collection, code=495KB, data=379KB
I/zygote64(21942): After code cache collection, code=473KB, data=297KB
W/InputMethodManager(21942): startInputReason = 3
V/AudioManager(21942): getProperty  key: android.media.property.OUTPUT_SAMPLE_RATE
V/AudioManager(21942): getProperty  key: android.media.property.OUTPUT_SAMPLE_RATE
D/        (21942): PlayerBase::PlayerBase()
D/        (21942): TrackPlayerBase::TrackPlayerBase()
I/libOpenSLES(21942): Emulating old channel mask behavior (ignoring positional mask 0x3, using default mask 0x3 based on channel count of 2)
D/AudioTrack(21942): OFFLOAD 0,mNotificationFrames 0,mStreamType =3,mOriginalSampleRate 48000,mAfSampleRate 44100,mTransfer 1
D/AudioTrack(21942): Client defaulted notificationFrames to 8811 for frameCount 26433
E/chromium(21942): [ERROR:web_contents_delegate.cc(218)] WebContentsDelegate::CheckMediaAccessPermission: Not supported.
E/chromium(21942): [ERROR:web_contents_delegate.cc(218)] WebContentsDelegate::CheckMediaAccessPermission: Not supported.
I/CameraManagerGlobal(21942): do not need hide aux camera, device number: 2
W/cr_media(21942): Requires MODIFY_AUDIO_SETTINGS and RECORD_AUDIO. No audio device will be available for recording
I/CameraManagerGlobal(21942): do not need hide aux camera, device number: 2
I/chatty  (21942): uid=10314(u0_a314) ThreadPoolSingl identical 7 lines
I/CameraManagerGlobal(21942): do not need hide aux camera, device number: 2
I/CameraManagerGlobal(21942): do not need hide aux camera, device number: 2
I/CameraManagerGlobal(21942): do not need hide aux camera, device number: 2
V/AudioManager(21942): playSoundEffect   effectType: 0
I/PressGestureDetector(21942): ORIENTATION_LANDSCAPE
W/libEGL  (21942): EGLNativeWindowType 0x7a3b7f2010 disconnect failed
D/mali_winsys(21942): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, egl_color_buffer_format *, EGLBoolean) returns 0x3000
W/libEGL  (21942): EGLNativeWindowType 0x7a3b7f2010 disconnect failed
D/mali_winsys(21942): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, egl_color_buffer_format *, EGLBoolean) returns 0x3000
W/libEGL  (21942): EGLNativeWindowType 0x7a3b7f3010 disconnect failed
D/mali_winsys(21942): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, egl_color_buffer_format *, EGLBoolean) returns 0x3000
W/PlatformViewsController(21942): Creating a virtual display of size: [2160, 1080] may result in problems(https://github.com/flutter/flutter/issues/2897).It is larger than the device screen size: [1080, 2040].
D/HwCust  (21942): Create obj success use class android.app.HwCustHwWallpaperManagerImpl
D/HwRTBlurUtils(21942): check blur style for HwPhoneWindow, themeResId : 0x0103023e, context : android.app.Presentation$3@97af80e, Nhwext : 0, get Blur : disable with , null
D/HwRTBlurUtils(21942): check blur style for HwPhoneWindow, themeResId : 0x0103023e, context : android.app.Presentation$3@97af80e, Nhwext : 0, get Blur : disable with , null
D/OpenGLRenderer(21942):   HWUI Binary is  enabled
I/PressGestureDetector(21942): HiTouch restricted: AboardArea.
D/AudioTrack(21942): stop() called with 810524 frames delivered
D/        (21942): PlayerBase::stop() from IPlayer
D/mali_winsys(21942): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, egl_color_buffer_format *, EGLBoolean) returns 0x3000

════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
The following assertion was thrown while finalizing the widget tree:
Multiple widgets used the same GlobalKey.

The key [GlobalKey#19eaf] was used by multiple widgets. The parents of those widgets were:
- MediaQuery(MediaQueryData(size: Size(720.0, 360.0), devicePixelRatio: 3.0, textScaleFactor: 1.0, platformBrightness: Brightness.light, padding: EdgeInsets.zero, viewPadding: EdgeInsets.zero, viewInsets: EdgeInsets.zero, physicalDepth: 1.7976931348623157e+308, alwaysUse24HourFormat: false, accessibleNavigation: false, highContrast: false, disableAnimations: false, invertColors: false, boldText: false))
- LayoutBuilder(renderObject: _RenderLayoutBuilder#f8249)
A GlobalKey can only be specified on one widget at a time in the widget tree.
When the exception was thrown, this was the stack: 
#0      GlobalKey._debugVerifyGlobalKeyReservation.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:flutter/src/widgets/framework.dart:246:13)
#1      _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:379:8)
#2      GlobalKey._debugVerifyGlobalKeyReservation.<anonymous closure>.<anonymous closure> (package:flutter/src/widgets/framework.dart:193:19)
#3      _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:379:8)
#4      GlobalKey._debugVerifyGlobalKeyReservation.<anonymous closure> (package:flutter/src/widgets/framework.dart:189:26)
...
════════════════════════════════════════════════════════════════════════════════════════════════════
W/libEGL  (21942): EGLNativeWindowType 0x7a3b7f3010 disconnect failed
D/mali_winsys(21942): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, egl_color_buffer_format *, EGLBoolean) returns 0x3000
D/OpenGLRenderer(21942):   HWUI Binary is  enabled
V/AudioManager(21942): getProperty  key: android.media.property.OUTPUT_SAMPLE_RATE
V/AudioManager(21942): getProperty  key: android.media.property.OUTPUT_SAMPLE_RATE

════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
The following assertion was thrown while finalizing the widget tree:
Multiple widgets used the same GlobalKey.

The key [GlobalKey#19eaf] was used by multiple widgets. The parents of those widgets were:
- MediaQuery(MediaQueryData(size: Size(720.0, 360.0), devicePixelRatio: 3.0, textScaleFactor: 1.0, platformBrightness: Brightness.light, padding: EdgeInsets.zero, viewPadding: EdgeInsets.zero, viewInsets: EdgeInsets.zero, physicalDepth: 1.7976931348623157e+308, alwaysUse24HourFormat: false, accessibleNavigation: false, highContrast: false, disableAnimations: false, invertColors: false, boldText: false))
- MediaQuery(MediaQueryData(size: Size(360.0, 720.0), devicePixelRatio: 3.0, textScaleFactor: 1.0, platformBrightness: Brightness.light, padding: EdgeInsets.zero, viewPadding: EdgeInsets.zero, viewInsets: EdgeInsets.zero, physicalDepth: 1.7976931348623157e+308, alwaysUse24HourFormat: false, accessibleNavigation: false, highContrast: false, disableAnimations: false, invertColors: false, boldText: false))
A GlobalKey can only be specified on one widget at a time in the widget tree.
When the exception was thrown, this was the stack: 
#0      GlobalKey._debugVerifyGlobalKeyReservation.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:flutter/src/widgets/framework.dart:246:13)
#1      _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:379:8)
#2      GlobalKey._debugVerifyGlobalKeyReservation.<anonymous closure>.<anonymous closure> (package:flutter/src/widgets/framework.dart:193:19)
#3      _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:379:8)
#4      GlobalKey._debugVerifyGlobalKeyReservation.<anonymous closure> (package:flutter/src/widgets/framework.dart:189:26)
...
════════════════════════════════════════════════════════════════════════════════════════════════════
D/HwCust  (21942): Create obj success use class android.app.HwCustHwWallpaperManagerImpl
D/HwRTBlurUtils(21942): check blur style for HwPhoneWindow, themeResId : 0x0103023e, context : android.app.Presentation$3@e465ad4, Nhwext : 0, get Blur : disable with , null
D/HwRTBlurUtils(21942): check blur style for HwPhoneWindow, themeResId : 0x0103023e, context : android.app.Presentation$3@e465ad4, Nhwext : 0, get Blur : disable with , null
D/OpenGLRenderer(21942):   HWUI Binary is  enabled
I/PressGestureDetector(21942): HiTouch restricted: AboardArea.
D/AudioTrack(21942): stop() called with 26433 frames delivered
D/        (21942): PlayerBase::stop() from IPlayer
D/mali_winsys(21942): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, egl_color_buffer_format *, EGLBoolean) returns 0x3000
D/OpenGLRenderer(21942):   HWUI Binary is  enabled
V/AudioManager(21942): getProperty  key: android.media.property.OUTPUT_SAMPLE_RATE
V/AudioManager(21942): getProperty  key: android.media.property.OUTPUT_SAMPLE_RATE

════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
The following assertion was thrown while finalizing the widget tree:
Multiple widgets used the same GlobalKey.

The key [GlobalKey#19eaf] was used by multiple widgets. The parents of those widgets were:
- MediaQuery(MediaQueryData(size: Size(720.0, 360.0), devicePixelRatio: 3.0, textScaleFactor: 1.0, platformBrightness: Brightness.light, padding: EdgeInsets.zero, viewPadding: EdgeInsets.zero, viewInsets: EdgeInsets.zero, physicalDepth: 1.7976931348623157e+308, alwaysUse24HourFormat: false, accessibleNavigation: false, highContrast: false, disableAnimations: false, invertColors: false, boldText: false))
- MediaQuery(MediaQueryData(size: Size(360.0, 680.0), devicePixelRatio: 3.0, textScaleFactor: 1.0, platformBrightness: Brightness.light, padding: EdgeInsets.zero, viewPadding: EdgeInsets.zero, viewInsets: EdgeInsets.zero, physicalDepth: 1.7976931348623157e+308, alwaysUse24HourFormat: false, accessibleNavigation: false, highContrast: false, disableAnimations: false, invertColors: false, boldText: false))
A GlobalKey can only be specified on one widget at a time in the widget tree.
When the exception was thrown, this was the stack: 
#0      GlobalKey._debugVerifyGlobalKeyReservation.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:flutter/src/widgets/framework.dart:246:13)
#1      _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:379:8)
#2      GlobalKey._debugVerifyGlobalKeyReservation.<anonymous closure>.<anonymous closure> (package:flutter/src/widgets/framework.dart:193:19)
#3      _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:379:8)
#4      GlobalKey._debugVerifyGlobalKeyReservation.<anonymous closure> (package:flutter/src/widgets/framework.dart:189:26)
...
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
Multiple widgets used the same GlobalKey.
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
The following assertion was thrown while finalizing the widget tree:
Multiple widgets used the same GlobalKey.

The key [GlobalKey#19eaf] was used by multiple widgets. The parents of those widgets were:
- MediaQuery(MediaQueryData(size: Size(720.0, 360.0), devicePixelRatio: 3.0, textScaleFactor: 1.0, platformBrightness: Brightness.light, padding: EdgeInsets.zero, viewPadding: EdgeInsets.zero, viewInsets: EdgeInsets.zero, physicalDepth: 1.7976931348623157e+308, alwaysUse24HourFormat: false, accessibleNavigation: false, highContrast: false, disableAnimations: false, invertColors: false, boldText: false))
- MediaQuery(MediaQueryData(size: Size(360.0, 680.0), devicePixelRatio: 3.0, textScaleFactor: 1.0, platformBrightness: Brightness.light, padding: EdgeInsets.zero, viewPadding: EdgeInsets.zero, viewInsets: EdgeInsets.zero, physicalDepth: 1.7976931348623157e+308, alwaysUse24HourFormat: false, accessibleNavigation: false, highContrast: false, disableAnimations: false, invertColors: false, boldText: false))
A GlobalKey can only be specified on one widget at a time in the widget tree.
When the exception was thrown, this was the stack: 
#0      GlobalKey._debugVerifyGlobalKeyReservation.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:flutter/src/widgets/framework.dart:246:13)
#1      _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:379:8)
#2      GlobalKey._debugVerifyGlobalKeyReservation.<anonymous closure>.<anonymous closure> (package:flutter/src/widgets/framework.dart:193:19)
#3      _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:379:8)
#4      GlobalKey._debugVerifyGlobalKeyReservation.<anonymous closure> (package:flutter/src/widgets/framework.dart:189:26)
...
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
Multiple widgets used the same GlobalKey.
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
The following assertion was thrown while finalizing the widget tree:
Multiple widgets used the same GlobalKey.

The key [GlobalKey#19eaf] was used by multiple widgets. The parents of those widgets were:
- MediaQuery(MediaQueryData(size: Size(720.0, 360.0), devicePixelRatio: 3.0, textScaleFactor: 1.0, platformBrightness: Brightness.light, padding: EdgeInsets.zero, viewPadding: EdgeInsets.zero, viewInsets: EdgeInsets.zero, physicalDepth: 1.7976931348623157e+308, alwaysUse24HourFormat: false, accessibleNavigation: false, highContrast: false, disableAnimations: false, invertColors: false, boldText: false))
- MediaQuery(MediaQueryData(size: Size(360.0, 680.0), devicePixelRatio: 3.0, textScaleFactor: 1.0, platformBrightness: Brightness.light, padding: EdgeInsets.zero, viewPadding: EdgeInsets.zero, viewInsets: EdgeInsets.zero, physicalDepth: 1.7976931348623157e+308, alwaysUse24HourFormat: false, accessibleNavigation: false, highContrast: false, disableAnimations: false, invertColors: false, boldText: false))
A GlobalKey can only be specified on one widget at a time in the widget tree.
When the exception was thrown, this was the stack: 
#0      GlobalKey._debugVerifyGlobalKeyReservation.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:flutter/src/widgets/framework.dart:246:13)
#1      _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:379:8)
#2      GlobalKey._debugVerifyGlobalKeyReservation.<anonymous closure>.<anonymous closure> (package:flutter/src/widgets/framework.dart:193:19)
#3      _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:379:8)
#4      GlobalKey._debugVerifyGlobalKeyReservation.<anonymous closure> (package:flutter/src/widgets/framework.dart:189:26)
...
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
The following assertion was thrown while finalizing the widget tree:
Multiple widgets used the same GlobalKey.

The key [GlobalKey#19eaf] was used by multiple widgets. The parents of those widgets were:
- MediaQuery(MediaQueryData(size: Size(720.0, 360.0), devicePixelRatio: 3.0, textScaleFactor: 1.0, platformBrightness: Brightness.light, padding: EdgeInsets.zero, viewPadding: EdgeInsets.zero, viewInsets: EdgeInsets.zero, physicalDepth: 1.7976931348623157e+308, alwaysUse24HourFormat: false, accessibleNavigation: false, highContrast: false, disableAnimations: false, invertColors: false, boldText: false))
- MediaQuery(MediaQueryData(size: Size(360.0, 680.0), devicePixelRatio: 3.0, textScaleFactor: 1.0, platformBrightness: Brightness.light, padding: EdgeInsets.zero, viewPadding: EdgeInsets.zero, viewInsets: EdgeInsets.zero, physicalDepth: 1.7976931348623157e+308, alwaysUse24HourFormat: false, accessibleNavigation: false, highContrast: false, disableAnimations: false, invertColors: false, boldText: false))
A GlobalKey can only be specified on one widget at a time in the widget tree.
When the exception was thrown, this was the stack: 
#0      GlobalKey._debugVerifyGlobalKeyReservation.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:flutter/src/widgets/framework.dart:246:13)
#1      _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:379:8)
#2      GlobalKey._debugVerifyGlobalKeyReservation.<anonymous closure>.<anonymous closure> (package:flutter/src/widgets/framework.dart:193:19)
#3      _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:379:8)
#4      GlobalKey._debugVerifyGlobalKeyReservation.<anonymous closure> (package:flutter/src/widgets/framework.dart:189:26)
...
════════════════════════════════════════════════════════════════════════════════════════════════════
D/AudioTrack(21942): stop() called with 511038 frames delivered
D/        (21942): PlayerBase::stop() from IPlayer

@vipinnegi90 even after upgrading to 1.17.2 and dart 2.8.3 the problem persists.

The Global keys are in separate files Code:

import 'package:flutter/material.dart';
import 'package:youtube_player_flutter/youtube_player_flutter.dart';

class VideoScreen extends StatefulWidget {
  @override
  _VideoScreenState createState() => _VideoScreenState();
}

class _VideoScreenState extends State<VideoScreen> {
  YoutubePlayerController _controller;

  @override
  void initState() {
    _controller = YoutubePlayerController(
      initialVideoId: 'iLnmTe5Q2Qw',
      flags: YoutubePlayerFlags(
        autoPlay: true,
        mute: true,
      ),
    );
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return YoutubePlayerBuilder(
      player: YoutubePlayer(
        controller: _controller,
        showVideoProgressIndicator: true,
        onReady: () {
          _controller.addListener(() {});
        },
      ),
      builder: (context, player) {
        return Scaffold(
          body: SafeArea(
            child: player,
          ),
        );
      },
    );
  }
}
vipinnegi90 commented 4 years ago

@AshutoshPatole did the issue fix for you?

rafaelmaeuer commented 4 years ago

Why was this issue closed? I still have this problem https://github.com/sarbagyastha/youtube_player_flutter/issues/241#issuecomment-637450169 it seems that there is noSuchMethod on the object when _YoutubePlayerBuilderState.didChangeMetrics is called.

AshutoshPatole commented 4 years ago

@vipinnegi90 yup the issue is fixed.

@rafaelmaeuer for me using stack with youtube_player caused this issue.

emmett-deen commented 4 years ago

@AshutoshPatole did they fix the stack issue? or is that just a limitation now of using this plugin?

emmett-deen commented 4 years ago

This issue should not be closed even the sample with the YoutubePlayerBuilder will not go fullscreen. It just blips the player black and stays the same size

rafaelmaeuer commented 4 years ago

for me the issue persists, although I am not using the player in a stack

AshutoshPatole commented 4 years ago

@emmett-deen It was the exact problem with me too. But the sample code worked just fine when implemented in new project(just the sample code). So i changed the entry point of the app in main.dart to the playerscreen and it worked just fine. Then i focused on the activity which navigated to the playerscreen and got the problem in a stack widget. The stack widget had nothing to do with the playerscreen but i had no idea why it was preventing the player to turn full size.

edit: i forgot to tell you that it is working as expected now

Shajeel-Afzal commented 4 years ago

@AshutoshPatole, I am also facing the same problem. Not sure how to fix it. I have tried adding the example code many times.

AshutoshPatole commented 4 years ago

I'm reopening this issue. Since many people are facing the same problem

DusBekas commented 4 years ago

I think the issue is regarding the device's aspect ratio. It persists only when the aspect ratio is longer than 16:9.

For example, I have no issue when I use Redmi 3S (16:9 ratio). But once I use Galaxy A50 (19.5:9 ratio), it just closes the full screen mode.

samuelfre commented 4 years ago

And I have no issue when I use Galaxy S8. But once I use PIXEL 3, it just closes the full screen mode. :/

codepushr commented 4 years ago

Same for me; The portrait player blinks black for a split second and then remains at the same size, nothing happens.

felipebueno commented 4 years ago

Same problem here. It works only when the player is on a page with no other widgets.

JeevaVGeorge commented 3 years ago

I am also facing the same problem.

dheerajy2310 commented 3 years ago

onEnterFullScreen: () { SystemChrome.setPreferredOrientations([DeviceOrientation.landscapeLeft]); _controller.play(); }, while using the above code in YoutubePlayerBuilder, It is working perfectly for me.

MarijnFK commented 3 years ago

Same issue, the player tries to go fullscreen, but the player is larger then my actual screen:

PlatformViewsController(16046): Creating a virtual display of size: [2201, 1080] may result in problems(https://github.com/flutter/flutter/issues/2897).It is larger than the device screen size: [2075, 1080].

EDIT: Removing my SafeArea fixed the issue. EDIT 2: Removing SafeArea did NOT fix the issue :(

stvhrs commented 3 years ago

After the update to v7, fullscreen doesn't work anymore. I wrapped the component in YoutubePlayerBuilder but it doesn't help. This is from the error-log:

Tried calling: value
#0      Object.noSuchMethod  (dart:core-patch/object_patch.dart:53:5)
#1      _YoutubePlayerBuilderState.didChangeMetrics 
package:youtube_player_flutter/…/widgets/youtube_player_builder.dart:58
#2      WidgetsBinding.handleMetricsChanged 
package:flutter/…/widgets/binding.dart:538
#3      _rootRun  (dart:async/zone.dart:1184:13)
#4      _CustomZone.run  (dart:async/zone.dart:1077:19)
#5      _CustomZone.runGuarded  (dart:async/zone.dart:979:7)
#6      _invoke  (dart:ui/hooks.dart:261:10)
#7      _updateWindowMetrics  (dart:ui/hooks.dart:64:3)

Why was this issue closed? I still have this problem #241 (comment) it seems that there is noSuchMethod on the object when _YoutubePlayerBuilderState.didChangeMetrics is called.

ME to

rafaelmaeuer commented 3 years ago

Today I replaced this lib with youtube_plyr_iframe. Its a fork of youtube_player_iframe that is maintained, up to date and has some major issue fixed. The replacement is quite easy and it just works, including fullscreen from a widget-stack.

ska2519 commented 3 years ago

youtube_player_flutter 8 0 0

youtube_player_flutter 8.0.0 version same bug

AshutoshPatole commented 3 years ago

@sarbagyastha I guess you should definitely look into this issue. I see many issues somewhat similar to this one. Hope this will be fixed soon.

SifatTaj commented 3 years ago

youtube_player_flutter 8 0 0

youtube_player_flutter 8.0.0 version same bug

I am facing the exact same issue. The problem is occurring when I am using the OS navigation bar. If I set the OS navigation to gestures, it works absolutely fine.

jigarfumakiya commented 3 years ago

Any update?. I am facing the same issue.

robertnicjoo commented 2 years ago

Not using SystemChrome.setPreferredOrientations(DeviceOrientation.values); will fix the full screen jumps to portrait however video will be larger than screen size (for instance my video has subtitle on it and half of my subtitle is removed)

Screenshot_1637127104

blueeyestw commented 2 years ago

Not using SystemChrome.setPreferredOrientations(DeviceOrientation.values); will fix the full screen jumps to portrait however video will be larger than screen size (for instance my video has subtitle on it and half of my subtitle is removed)

Screenshot_1637127104

Same issue, the video always fills the screen no matter what aspect ratio you give it. Wrapping it in SizedBox doesn't help either.

31Carlton7 commented 2 years ago

Not using SystemChrome.setPreferredOrientations(DeviceOrientation.values); will fix the full screen jumps to portrait however video will be larger than screen size (for instance my video has subtitle on it and half of my subtitle is removed)

Screenshot_1637127104

I'm experiencing this as well

faisalufaber commented 2 years ago

@override Widget build(BuildContext context) { return OrientationBuilder( builder:(context, orientation) { if(orientation == Orientation.portrait){ SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge); } else { SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky); } return Scaffold( backgroundColor: Colors.black, body: SafeArea( child: Column( mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.start, children: [ if(orientation == Orientation.portrait) const SizedBox( height: 50, child: BackButton(color: Colors.white,), ), Expanded( child: Center( child: Padding( padding: const EdgeInsets.only(left: 8, right: 8, ), child: YoutubePlayer( showVideoProgressIndicator: true, onEnded: (metaData) {}, controller: _youtubeController, aspectRatio: 1.5, progressIndicatorColor: Colors.red, bottomActions: [ const SizedBox(width: 14.0), CurrentPosition(), const SizedBox(width: 8.0), ProgressBar( isExpanded: true, colors: const ProgressBarColors(), ), RemainingDuration(), const PlaybackSpeedButton(), IconButton( icon: Icon( orientation == Orientation.landscape ? Icons.fullscreen_exit : Icons.fullscreen, color: Colors.white, ), onPressed: () { if(orientation == Orientation.landscape){ portraitModeOnly(); } else { landscapeModeOnly(); } }, ), ], ), ), ), ), ], ), ), ); }, ); }

void portraitModeOnly() { SystemChrome.setPreferredOrientations([ DeviceOrientation.portraitUp, DeviceOrientation.portraitDown, ]); }

void landscapeModeOnly() { SystemChrome.setPreferredOrientations([ DeviceOrientation.landscapeLeft, DeviceOrientation.landscapeRight, ]); }

@override void dispose() { if (_youtubeController != null) _youtubeController.dispose(); portraitModeOnly(); super.dispose(); }

This workaround works perfectly.

usaikoo commented 1 year ago

onEnterFullScreen: () { SystemChrome.setPreferredOrientations([DeviceOrientation.landscapeLeft]); _controller.play(); }, while using the above code in YoutubePlayerBuilder, It is working perfectly for me.