我正在使用这个颤振插件 - youtube_player_flutter v7.0.0+7。
播放器在纵向模式下工作正常,但在单击全屏图标时会崩溃。请看下面的代码:
return YoutubePlayerBuilder(
onExitFullScreen: () {
SystemChrome.setPreferredOrientations(DeviceOrientation.values);
},
player: YoutubePlayer(
controller: _controller,
showVideoProgressIndicator: true,
progressIndicatorColor: Colors.blueAccent,
onReady: () {
_isPlayerReady = true;
},
onEnded: (data) {
// _controller
// .load(_ids[(_ids.indexOf(data.videoId) + 1) % _ids.length]);
_showSnackBar('Next Video Started!');
},
),
builder: (context, player) => Scaffold(
key: _scaffoldKey,
appBar: AppBar(
title: Text(
widget.content.title,
style: TextStyle(color: Colors.white),
),
),
body: ListView(
children: [
player,
Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [],
),
),
],
),
),
);
}