ijashuzain / y_player

A flutter package to integrate Youtube Player in your flutter project without any YouTube branding
MIT License
1 stars 0 forks source link

Video doesn't work, only audio works. #6

Open rakib205 opened 4 hours ago

rakib205 commented 4 hours ago

Only a blank screen with audio. Video is not showing.

Code

import 'package:y_player/y_player.dart';

class YoutubePlayerWidget extends StatefulWidget {
  const YoutubePlayerWidget({super.key, required this.videoUrl, this.thumbnailUrl});

  final String videoUrl;
  final String? thumbnailUrl;

  @override
  State<YoutubePlayerWidget> createState() => _YoutubePlayerWidgetState();
}

class _YoutubePlayerWidgetState extends State<YoutubePlayerWidget> {
  @override
  Widget build(BuildContext context) {
    return YPlayer(
      youtubeUrl: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
      onStateChanged: (status) {
        debugPrint('Player Status: $status');
      },
      onProgressChanged: (position, duration) {
        debugPrint('Progress: ${position.inSeconds}/${duration.inSeconds}');
      },
      onControllerReady: (controller) {
        debugPrint('Controller is ready!');
      },
    );
  }
}

Flutter Doctor Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.24.1, on macOS 13.6 22G120 darwin-arm64, locale en-BD) [✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1) [✓] Xcode - develop for iOS and macOS (Xcode 15.0) [✓] Chrome - develop for the web [✓] Android Studio (version 2024.1) [✓] Android Studio (version 2022.1) [✓] VS Code (version 1.92.2) [✓] Connected device (5 available) [✓] Network resources

Preview Screenshot_1728534740

ijashuzain commented 4 hours ago

Do you using latest version ? y_player: ^2.0.1

rakib205 commented 4 hours ago

Yes, I am using the latest version 2.0.1. Logs: I/flutter (24317): YPlayerController: Track changed: Track(video: VideoTrack(auto, null, null, image: null, albumart: null, codec: null, decoder: null, w: null, h: null, channelscount: null, channels: null, samplerate: null, fps: null, bitrate: null, rotate: null, par: null, audiochannels: null), audio: AudioTrack(https://rr6---sn-fja-q5jl.googlevideo.com/videoplayback?expire=1728557781&ei=dV4HZ_iLOfq19fwPlKaW6AY&ip=103.85.242.199&id=o-AAp-cXkGP9xaq-EdT66X83ijePlvz6unsuRUD07XxYYX&itag=251&source=youtube&requiressl=yes&xpc=EgVo2aDSNQ%3D%3D&met=1728536181%2C&mh=7c&mm=31%2C29&mn=sn-fja-q5jl%2Csn-h5576nsl&ms=au%2Crdu&mv=m&mvi=6&pl=24&rms=au%2Cau&initcwndbps=1113750&vprv=1&svpuc=1&mime=audio%2Fwebm&rqh=1&gir=yes&clen=3437753&dur=212.061&lmt=1717047822556748&mt=1728535496&fvip=1&keepalive=yes&fexp=51300760&c=IOS&txp=4532434&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cxpc%2Cvprv%2Csvpuc%2Cmime%2Crqh%2Cgir%2Cclen%2Cdur%2Clmt&sig=AJfQdSswRAIgKM0Se9dz2rUrUxBTXtm-knnTLYQ4zNieUVo9zsybzAMCIDu7QBZfM58jawZLjrUoqEm1TygkTyyw7g I/flutter (24317): YPlayerController: Available tracks: Tracks(video: [VideoTrack(auto, null, null, image: null, albumart: null, codec: null, decoder: null, w: null, h: null, channelscount: null, channels: null, samplerate: null, fps: null, bitrate: null, rotate: null, par: null, audiochannels: null), VideoTrack(no, null, null, image: null, albumart: null, codec: null, decoder: null, w: null, h: null, channelscount: null, channels: null, samplerate: null, fps: null, bitrate: null, rotate: null, par: null, audiochannels: null)], audio: [AudioTrack(auto, null, null, image: null, albumart: null, codec: null, decoder: null, w: null, h: null, channelscount: null, channels: null, samplerate: null, fps: null, bitrate: null, rotate: null, par: null, audiochannels: null), AudioTrack(no, null, null, image: null, albumart: null, codec: null, decoder: null, w: null, h: null, channelscount: null, channels: null, samplerate: null, fps: null, bitrate: null, rotate: null, par: null, audiochannels: null), AudioTrack(1, external, auto, image: f I/media_kit(24317): com.alexmercerind.media_kit_video.VideoOutputManager.createSurface: -5476376637611211472 I/flutter (24317): {wid: 20882} I/flutter (24317): YPlayerController: Available tracks: Tracks(video: [VideoTrack(auto, null, null, image: null, albumart: null, codec: null, decoder: null, w: null, h: null, channelscount: null, channels: null, samplerate: null, fps: null, bitrate: null, rotate: null, par: null, audiochannels: null), VideoTrack(no, null, null, image: null, albumart: null, codec: null, decoder: null, w: null, h: null, channelscount: null, channels: null, samplerate: null, fps: null, bitrate: null, rotate: null, par: null, audiochannels: null), VideoTrack(1, null, null, image: false, albumart: false, codec: h264, decoder: null, w: 1920, h: 1080, channelscount: null, channels: null, samplerate: null, fps: 25.0, bitrate: null, rotate: null, par: null, audiochannels: null)], audio: [AudioTrack(auto, null, null, image: null, albumart: null, codec: null, decoder: null, w: null, h: null, channelscount: null, channels: null, samplerate: null, fps: null, bitrate: null, rotate: null, par: null, audiochannels: null), AudioTrack(no, null, null, image: nul

ijashuzain commented 4 hours ago

Can you share the video link you are using ?

rakib205 commented 4 hours ago

I just tested the video you provided in the description. https://www.youtube.com/watch?v=dQw4w9WgXcQ

ijashuzain commented 2 hours ago

I think this issue related to impeller on android. Also it will not work in emulators.