youtube_player_flutter: ^8.1.1 Full screen is not working

250 views Asked by At

I am fetching the data from Youtube via links with youtube_player_flutter: ^8.1.1 package. all functions are working good but when I click on full screen button so its stucked and video are stopped. (Access denied finding property "vendor.camera.aux.packagelist") this error fired(in console) from the time of execution of this page. this error displayed in device when i open in full screen : An error occurred. Please try again later. (playback ID : ...) find attached screen shots of error. error in console : (E/OpenGLRenderer(27611): JankTracker::calculateLegacyJank expectedDequeueDuration > 0 expectedDequeueDuration=743941, DequeueBufferDuration=2316145, forgiveAmount=743941, totalDuration=12145972 D/.mahuva_azadar(27611): PlayerBase::~PlayerBase())

enter image description here

following are my code:-

class _LiveProgramState extends State<LiveProgram> {

  String? title;

  late YoutubePlayerController _youtubePlayerController;
  void initState(){
    super.initState();
    _youtubePlayerController = YoutubePlayerController(initialVideoId: '');
  }

 @override
  void deactive() {
    _youtubePlayerController.pause();
    super.deactivate();
    print("deactivate");
  }

  @override
  void dipose() {
    _youtubePlayerController.dispose();
    print("dispose");
    super.dispose();
  }

@override
  Widget build(BuildContext context) {
    return YoutubePlayerBuilder(
      player: YoutubePlayer(
        controller: _youtubePlayerController,
      ),
      builder: (context,player){
        return SafeArea(
          child: Scaffold(
            appBar: AppBar(title: Text("Live Program",
              style: TextStyle(
                  fontWeight: FontWeight.bold,
                  fontSize: 25
              ),),
              centerTitle: true,
              backgroundColor: Color(hexColors('006064')),
            ),
            body: FutureBuilder<LinkModel>(
              future: getAllLinks(),
              builder: (context, snapshot){
                if(snapshot.hasData){
                  return ListView.builder(
                      itemCount: snapshot.data!.data!.length,
                      itemBuilder: (context, index){
                        var allItem = snapshot.data!.data![index];
                        return Container(
                          margin: EdgeInsets.all(8),
                          child: Card(
                            color: Color(hexColors("03A9F4")),
                            elevation: 6,
                            shape: RoundedRectangleBorder(
                                borderRadius:
                                BorderRadius.circular(10.0)),
                            child: Column(
                              children: [
                                YoutubePlayer(
                                  controller: _youtubePlayerController = YoutubePlayerController(
                                    initialVideoId: YoutubePlayer.convertUrlToId(allItem.link!).toString(),
                                    flags: YoutubePlayerFlags(
                                      autoPlay: false,
                                    ),
                                  ),
                                  //   ..addListener(() {
                                  //   if(mounted){
                                  //     setState(() {});
                                  //   }
                                  // }),
                                  showVideoProgressIndicator: true,
                                ),
                                Row(
                                  children: [
                                    Expanded(
                                      child: Padding(
                                        padding: const EdgeInsets.only(left: 5.0),
                                        child: Text("Channel Name:-  ${allItem.channelName!}",
                                          style: TextStyle(
                                              fontWeight: FontWeight.bold,
                                              color: Colors.white
                                          ),
                                        ),
                                      ),
                                    ),
                                  ],
                                ),
                                Row(
                                  children: [
                                    Expanded(
                                      child: Padding(
                                        padding: const EdgeInsets.only(left: 5),
                                        child: Text("City : ${allItem.city!}",
                                          style: TextStyle(
                                              fontWeight: FontWeight.bold,
                                              color: Colors.white
                                          ),),
                                      ),
                                    ),
                                  ],
                                ),
                                // Text(_youtubePlayerController.metadata.title.isEmpty? 'Loading Title.....' :
                                // "Title: " +_youtubePlayerController.metadata.title,
                                //   textAlign: TextAlign.left,
                                //   style: TextStyle(
                                //       color: Colors.white,
                                //       fontSize: 15,
                                //       fontWeight: FontWeight.w700,
                                //       fontStyle: FontStyle.italic),
                                // ),

                                //SizedBox(height: 10,),
                                Padding(
                                  padding: const EdgeInsets.all(8.0),
                                  child: Row(
                                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                    children: [
                                      Text(allItem.username.toString(),
                                        style: TextStyle(color: Colors.white),),
                                      Text(allItem.postDateTime.toString(),
                                        style: TextStyle(color: Colors.white),),
                                    ],
                                  ),
                                )
                              ],
                            ),

                          ),
                        );
                      });
                }else if(snapshot.connectionState == ConnectionState.waiting){
                  return Center(
                    child: CircularProgressIndicator(),
                  );
                }else if (snapshot.hasError) {
                  return Center(
                    child: Text("No Data !"),
                  );
                }
                else {
                  return Center(
                    child: Text("No Data"),
                  );
                }
              },
            ),
          ),
        );
      },
    );
  }
0

There are 0 answers