Youtube_player_flutter: [Android] Infinite loading when opening video for the first time

Created on 17 Jul 2020  ·  5Comments  ·  Source: sarbagyastha/youtube_player_flutter

Describe the bug
The loading indicator rotating infinitely if the video is opened for the first time. The errors "Unsupported profile 2" etc occurs only the first time player displayed.

To Reproduce

  1. Open the flutter app on android 7.
  2. Open the video screen. Indicator loading. Video not played.
  3. Close the video screen.
  4. Open the same screen. Video loaded and playing.

Expected behavior
Video should be played every time.

Technical Details:

  • Device and OS: TV boxes: Android 7.1.2
  • Version 7.0.0+7

Flutter doctor:

[√] Flutter (Channel stable, v1.17.3, on Microsoft Windows [Version 10.0.18363.959], locale uk-UA)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.0)
[√] Android Studio (version 4.0)
[!] IntelliJ IDEA Community Edition (version 2018.3)
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[√] Connected device (1 available)

Output when initializing player the first time:

I/art (29950): Do partial code cache collection, code=24KB, data=29KB
I/art (29950): After code cache collection, code=20KB, data=27KB
I/art (29950): Increasing code cache capacity to 128KB
W/cr_AwContents(29950): onDetachedFromWindow called when already detached. Ignoring
I/cr_Ime (29950): ImeThread is not enabled.
E/libEGL (29950): validate_display:99 error 3008 (EGL_BAD_DISPLAY)
W/VideoCapabilities(29950): Unrecognized profile/level 1/32 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 2 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 2 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 2 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 2 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 2 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 2 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 2 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 2 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 4 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 4 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 4 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 4 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 4 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 4 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 4 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 4 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 8 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 8 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 8 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 8 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 8 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 8 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 8 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 8 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 16 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 16 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 16 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 16 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 16 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 16 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 16 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 16 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 32 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 32 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 32 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 32 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 32 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 32 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 32 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 32 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 64 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 64 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 64 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 64 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 64 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 64 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 64 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 64 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 128 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 128 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 128 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 128 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 128 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 128 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 128 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 128 for video/mp4v-es
I/VideoCapabilities(29950): Unsupported profile 256 for video/mp4v-es
W/VideoCapabilities(29950): Unrecognized profile/level 0/0 for video/mpeg2
W/VideoCapabilities(29950): Unrecognized profile/level 0/2 for video/mpeg2
W/VideoCapabilities(29950): Unrecognized profile/level 0/3 for video/mpeg2
I/VideoCapabilities(29950): Unsupported profile 2 for video/mpeg2
I/VideoCapabilities(29950): Unsupported profile 2 for video/mpeg2
I/VideoCapabilities(29950): Unsupported profile 2 for video/mpeg2
I/VideoCapabilities(29950): Unsupported profile 2 for video/mpeg2
I/VideoCapabilities(29950): Unsupported profile 3 for video/mpeg2
I/VideoCapabilities(29950): Unsupported profile 3 for video/mpeg2
I/VideoCapabilities(29950): Unsupported profile 3 for video/mpeg2
I/VideoCapabilities(29950): Unsupported profile 3 for video/mpeg2
I/VideoCapabilities(29950): Unsupported profile 4 for video/mpeg2
I/VideoCapabilities(29950): Unsupported profile 4 for video/mpeg2
I/VideoCapabilities(29950): Unsupported profile 4 for video/mpeg2
I/VideoCapabilities(29950): Unsupported profile 4 for video/mpeg2
I/VideoCapabilities(29950): Unsupported profile 5 for video/mpeg2
I/VideoCapabilities(29950): Unsupported profile 5 for video/mpeg2
I/VideoCapabilities(29950): Unsupported profile 5 for video/mpeg2
I/VideoCapabilities(29950): Unsupported profile 5 for video/mpeg2
W/VideoCapabilities(29950): Unsupported mime video/vc1
W/Utils (29950): could not parse long range '1-'
W/VideoCapabilities(29950): Unsupported mime video/wvc1
W/Utils (29950): could not parse long range '1-'
W/VideoCapabilities(29950): Unsupported mime video/wmv3
W/VideoCapabilities(29950): Unsupported mime video/x-ms-wmv
W/VideoCapabilities(29950): Unsupported mime video/mjpeg
W/AudioCapabilities(29950): Unsupported mime audio/aac-adif
W/AudioCapabilities(29950): Unsupported mime audio/aac-latm
W/AudioCapabilities(29950): Unsupported mime audio/adts
W/AudioCapabilities(29950): Unsupported mime audio/wma
W/AudioCapabilities(29950): Unsupported mime audio/wmapro
W/AudioCapabilities(29950): Unsupported mime audio/truehd
W/AudioCapabilities(29950): Unsupported mime audio/ffmpeg
W/AudioCapabilities(29950): Unsupported mime audio/ac3
W/AudioCapabilities(29950): Unsupported mime audio/eac3
W/AudioCapabilities(29950): Unsupported mime audio/dtshd
W/AudioCapabilities(29950): Unsupported mime audio/mpeg-L2
W/VideoCapabilities(29950): Unrecognized level 16 for video/x-vnd.on2.vp8
W/VideoCapabilities(29950): Unrecognized level 32 for video/x-vnd.on2.vp8
W/VideoCapabilities(29950): Unrecognized level 64 for video/x-vnd.on2.vp8
W/VideoCapabilities(29950): Unrecognized level 128 for video/x-vnd.on2.vp8
W/VideoCapabilities(29950): Unrecognized level 256 for video/x-vnd.on2.vp8
W/VideoCapabilities(29950): Unrecognized level 512 for video/x-vnd.on2.vp8
W/VideoCapabilities(29950): Unrecognized level 1024 for video/x-vnd.on2.vp8
W/VideoCapabilities(29950): Unrecognized level 2048 for video/x-vnd.on2.vp8
W/VideoCapabilities(29950): Unrecognized level 4096 for video/x-vnd.on2.vp8
W/VideoCapabilities(29950): Unrecognized level 8192 for video/x-vnd.on2.vp8
W/VideoCapabilities(29950): Unrecognized level 16384 for video/x-vnd.on2.vp8
W/VideoCapabilities(29950): Unrecognized level 32768 for video/x-vnd.on2.vp8
W/VideoCapabilities(29950): Unsupported mime video/x-vnd.on2.vp6
W/VideoCapabilities(29950): Unsupported mime video/x-vnd.on2.vp6a
W/VideoCapabilities(29950): Unsupported mime video/x-vnd.on2.vp6f
W/VideoCapabilities(29950): Unsupported mime video/rm10
W/VideoCapabilities(29950): Unsupported mime video/rm20
W/VideoCapabilities(29950): Unsupported mime video/rm40
W/VideoCapabilities(29950): Unsupported mime video/wmv2
W/VideoCapabilities(29950): Unsupported mime video/wmv1
I/VideoCapabilities(29950): Unsupported profile 4 for video/mp4v-es
W/cr_BindingManager(29950): Cannot call determinedVisibility() - never saw a connection for the pid: 29950

Code:

class PlayerViewState extends ErrorHandlerState<PlayerView> {
  YoutubePlayerController _youtubeController;

  @override
  void initState() {
    super.initState();
    SystemChrome.setPreferredOrientations([
      DeviceOrientation.landscapeRight,
      DeviceOrientation.landscapeLeft,
    ]);
    _youtubeController = YoutubePlayerController(initialVideoId: "t99KH0TR-J4");
    _youtubeController.addListener(() {
      print(_youtubeController.value.playerState);
    });
  }

  @override
  void dispose() {
    _youtubeController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: AppColors.black,
      body: Center(
        child: YoutubePlayer(
          controller: _youtubeController,
          onReady: (){

          },
        ),
      ),
    );
  }
}
bug youtube_player_flutter

Most helpful comment

Same problem here, youtube_player_flutter: ^7.0.0+7, Android 6.0.1

How to fix it?

All 5 comments

Can you test with example app, if the same issue exist there ?

The problem is that this occurs not always in all cases. I tried the example app. Tried to kill the app and opened again. Seems that example app is working well.
Than I copied my code into the example app. Replaced your "_MyHomePageState createState() => _MyHomePageState();" to "PlayerViewState createState() => PlayerViewState();"
Just to check if it depends on my app and its libs. And the result the same as in my app. After the example app killed for a few times, when opening it again - infinite loader. Seems the problem is in the next code running on android 7 tv box.

Example app changed code:

/// Homepage
class MyHomePage extends StatefulWidget {
  @override
  PlayerViewState createState() => PlayerViewState();
}

class PlayerViewState extends State<MyHomePage> {
  YoutubePlayerController _youtubeController;

  @override
  void initState() {
    super.initState();
    SystemChrome.setPreferredOrientations([
      DeviceOrientation.landscapeRight,
      DeviceOrientation.landscapeLeft,
    ]);
    _youtubeController = YoutubePlayerController(initialVideoId: "t99KH0TR-J4");
    _youtubeController.addListener(() {
      print(_youtubeController.value.playerState);
    });
  }

  @override
  void dispose() {
    _youtubeController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: YoutubePlayer(
          controller: _youtubeController,
        ),
      ),
    );
  }
}

i'm also facing same issue on my android 7.1 smartphone

Same problem here, API 22 (Samsung J5), only occurs the first time.

W/ResourceType(14933): Failure getting entry for 0x01080946 (t=7 e=2374) (error -75)
I/art (14933): Rejecting re-init on previously-failed class java.lang.Class
I/art (14933): Rejecting re-init on previously-failed class java.lang.Class
I/art (14933): Rejecting re-init on previously-failed class java.lang.Class
I/art (14933): Rejecting re-init on previously-failed class java.lang.Class
D/ConnectivityManager(14933): requestNetwork; CallingUid : 10147, CallingPid : 14933
D/ConnectivityManager.CallbackHandler(14933): CM callback handler got msg 524290
I/art (14933): Rejecting re-init on previously-failed class java.lang.Class
I/art (14933): Rejecting re-init on previously-failed class java.lang.Class
D/Activity(14933): registerForContextMenu with mFeatureContextMenuListener
W/cr_media(14933): Requires BLUETOOTH permission
D/PhoneWindow(14933): FMB installDecor mIsFloating : false
D/PhoneWindow(14933): FMB installDecor flags : -2139028216
D/PhoneWindow(14933): FMB isFloatingMenuEnabled mFloatingMenuBtn : null
D/PhoneWindow(14933): FMB isFloatingMenuEnabled return false
E/libEGL (14933): validate_display:255 error 3008 (EGL_BAD_DISPLAY)
W/AudioCapabilities(14933): Unsupported mime audio/mpeg-L1
W/AudioCapabilities(14933): Unsupported mime audio/mpeg-L2
W/AudioCapabilities(14933): Unsupported mime audio/x-ms-wma
W/AudioCapabilities(14933): Unsupported mime audio/x-ima
W/VideoCapabilities(14933): Unrecognized profile/level 32768/2 for video/mp4v-es
W/VideoCapabilities(14933): Unrecognized profile/level 32768/2 for video/mp4v-es
W/VideoCapabilities(14933): Unsupported mime video/wvc1
W/VideoCapabilities(14933): Unsupported mime video/x-ms-wmv
W/VideoCapabilities(14933): Unsupported mime video/x-ms-wmv7
W/VideoCapabilities(14933): Unsupported mime video/x-ms-wmv8
W/VideoCapabilities(14933): Unsupported mime video/mp43
I/VideoCapabilities(14933): Unsupported profile 4 for video/mp4v-es
I/VideoCapabilities(14933): Unsupported profile 4 for video/mp4v-es
W/VideoCapabilities(14933): Unsupported mime video/sorenson
W/cr_MediaCodecUtil(14933): HW encoder for video/avc is not available on this device.
E/chromium(14933): [ERROR:gl_surface_egl.cc(292)] eglChooseConfig failed with error EGL_BAD_ATTRIBUTE

Same problem here, youtube_player_flutter: ^7.0.0+7, Android 6.0.1

How to fix it?

Was this page helpful?
0 / 5 - 0 ratings