Open shailendra-rajpoot opened 4 years ago
are you doing work on this or not ?????
+1
+1
mirkarpude i m not getting you plz clear your thought
The controller is not ready for method calls. this message show in the device where is show only buffering and this code working fine in other device
my code is here
class _YoutubeVideoPlayerState extends State
_YoutubeVideoPlayerState(this.paymentStatus,this.videoId,this.videoStatus);
Future
@override void initState() { super.initState(); getSharedPrefs(); _controller = YoutubePlayerController( initialVideoId: videoId.trim(), flags: const YoutubePlayerFlags( autoPlay: true, disableDragSeek: false, loop: false, isLive: true, forceHD: false, enableCaption: false, ), )..addListener(listener); _playerState = PlayerState.unknown; }
void listener() { if (_isPlayerReady && mounted && !_controller.value.isFullScreen) { setState(() { _playerState = _controller.value.playerState; }); } }
@override void deactivate() { // Pauses video while navigating to next page. _controller.pause(); super.deactivate(); }
@override void dispose() { _controller.dispose(); super.dispose(); }
@override
Widget build(BuildContext context) {
return YoutubePlayerBuilder(
onExitFullScreen: () {
// The player forces portraitUp after exiting fullscreen. This overrides the behaviour.
SystemChrome.setPreferredOrientations(DeviceOrientation.values);
},
player: YoutubePlayer(
controller: _controller,
showVideoProgressIndicator: false,
// progressIndicatorColor: Colors.blueAccent,
onReady: () {
_isPlayerReady = true;
print("ready");
},
),
///////////////////////////////////////////////////////////
builder: (context, player) => Scaffold(
appBar: AppBar(
automaticallyImplyLeading: true,
leading: IconButton(icon: Icon(Icons.arrow_back),
onPressed: () => Navigator.pop(context, false),
),
title: Row(
mainAxisAlignment: MainAxisAlignment.start,
children:
),
):
(videoStatus=="free" || paymentStatus=="success") ?
ListView(
//shrinkWrap: true,
//crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
player,
Column(
children: <Widget>[
Container(
padding: EdgeInsets.only(top: 30,left: 10,bottom: 10,right: 10),
//width: MediaQuery.of(context).size.width,
child: Form(
key: doubtFormKey,
child: TextFormField(
keyboardType: TextInputType.multiline,
maxLines: 4,
autofocus: false,
//autovalidate: true,
decoration: InputDecoration(
// hintText: 'Mobile',
labelText: 'Ask doubt ?',
//contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
border: OutlineInputBorder(borderRadius: BorderRadius.circular(10.0)),
),
validator: (String value) {
return value.isEmpty ? "Please enter doubt" : null;
},
onSaved: (String value) {
doubt=value;
},
)
),
),
Container(
height: 40,
width: 100,
child: FlatButton(
color: MyColor.themeColor,
child: const Text('SEND',style: TextStyle(color: MyColor.white),),
onPressed: () {
//Navigator.pop(context);
if(doubtFormKey.currentState.validate()) {
doubtFormKey.currentState.save();
print("called");
sendDoubt();
}
}),
),
SizedBox(height: 20,)
],
),
],
):
Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text("Buy premium to watch live class...",style: TextStyle(fontSize: 16,color: Colors.black,fontWeight: FontWeight.bold)),
SizedBox(height: 10,),
FlatButton(
color: MyColor.themeColor,
child: Text(
' Make payment',
style: TextStyle(color: MyColor.white),
),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute<dynamic>(
builder: (BuildContext context) => Membership(),
),
);
},
)
],
)
)
)
)
);
}
void sendDoubt() { Fluttertoast.showToast( msg: "Doubt send successfully", toastLength: Toast.LENGTH_SHORT, gravity: ToastGravity.CENTER, backgroundColor: Colors.black, textColor: Colors.white, fontSize: 16.0 ); doubtFormKey.currentState.reset(); print("path="+"https://jeevandangwalior.com/admin/public/chatRoom/addChat.php?name="+"studentName"+"&id="+global.teacher_id+"&message="+doubt); try { Dio().get("https://www.jeevandangwalior.com/admin/public/chatRoom/addChat.php?name=" + studentName + '&message=' + doubt+ "&id=" + global.teacher_id).then((response) async{
});
}
catch(error){
print("error"+error);
}
}
}
@shailendra-rajpoot did you find a solution to this? If not can you help sharing the logs.
plz plz bro give update of the depandancy so many issue is coming in live video plz update