newtaDev / pod_player

Video player for flutter web & mobile devices, Play video from youtube or vimeo or network in flutter using pod player
https://pub.dev/packages/pod_player
MIT License
104 stars 200 forks source link

Only 360p available in live YouTube videos. #163

Open Aryan20apr opened 11 months ago

Aryan20apr commented 11 months ago

While playing recorded videos from YouTube, I am able to select from 360p, 480p and 720p. But in live video from YouTube, only 360p is available. Here is my code-

 class PodYouTubePlayerScreen extends StatefulWidget {
  const PodYouTubePlayerScreen({super.key, required this.video});
  final Videos video;
  @override
  PodYouTubePlayerScreenState createState() => PodYouTubePlayerScreenState();
}

class PodYouTubePlayerScreenState extends State<PodYouTubePlayerScreen> {

  late final PodPlayerController controller;
  @override
  void initState() {

     controller = PodPlayerController(
    playVideoFrom: PlayVideoFrom.youtube(widget.video.link!,live: widget.video.isLive??false,videoPlayerOptions: VideoPlayerOptions()),
    podPlayerConfig: const PodPlayerConfig(
      autoPlay: true,
      isLooping: false,
      videoQualityPriority: [1080,720, 480,360]
    ),

  )..initialise();

    super.initState();

  }

  @override
  Widget build(BuildContext context) {
    return SafeArea(

      child: Scaffold(

            appBar: AppBar(
              title: Text('${widget.video.title}'),
            ),
            body:Column(mainAxisAlignment: MainAxisAlignment.spaceBetween,children: [
              //  _videoLink.isNotEmpty
              // ? SizedBox(
              //   width: MediaQuery.of(context).size.width,

              //   child:

           PodVideoPlayer(controller: controller),

            if(widget.video.isLive!=null && widget.video.isLive!)
              Expanded(child: Padding(
                padding: const EdgeInsets.only(top:4.0),
                child: ChatView(video: widget.video,),
              ))
            ])
          )

      );

  }

  @override
  void dispose() {
    controller.dispose();
    super.dispose();
  }
}
newtaDev commented 11 months ago

The quality of YouTube videos are provided by youtube_explode_darthttps://pub.dev/packages/youtube_explode_dart package that we are using to extract videos Its not controlled by us