【问题标题】:How to keep the video resolution fixed in youtube video player in flutter?如何在颤动中保持 youtube 视频播放器中的视频分辨率固定?
【发布时间】:2021-10-25 23:08:27
【问题描述】:

我想在代码中手动将视频分辨率固定为 240p。但是我该怎么做呢? 以及实际上playbackQuality 是如何工作的?每当我使用播放质量时,它都不会显示任何属性。是为了修复视频质量吗?我没有找到任何解决方案。

class _VideoScreenState extends State<VideoScreen> {
  YoutubePlayerController _controller;

  String _videoId = YoutubePlayer.convertUrlToId(
      'https://www.youtube.com/watch?v=YE7VzlLtp-4');

  @override
  void initState() {
    super.initState();
    YoutubePlayerValue(
      playbackRate: PlaybackRate.normal,
    );
    _controller = YoutubePlayerController(
      initialVideoId: _videoId,
      flags: YoutubePlayerFlags(
        loop: true,
        autoPlay: true,
        forceHD: false,
        enableCaption: false,
        hideControls: true,
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(
          'Youtube Video Player',
          style: TextStyle(
              color: Colors.blueAccent,
              fontSize: 22.0,
              fontWeight: FontWeight.bold),
        ),
        backgroundColor: Colors.white,
        elevation: 0.0,
      ),
      body: Container(
        padding: EdgeInsets.symmetric(horizontal: 12.0),
        child: YoutubePlayer(
          controller: _controller,
          aspectRatio: 16 / 9,
          onReady: () {
            print('The Video ID : $_videoId');
          },
        ),
      ),
    );
  }
} 

【问题讨论】:

    标签: flutter videoquality youtube-player-flutter


    【解决方案1】:

    根据an issue on youtube_player_flutter's repository,无法更改质量。

    【讨论】:

    • 那么我应该使用哪个包来制作具有固定分辨率的 youtube 视频播放器?
    猜你喜欢
    • 2022-06-21
    • 2014-05-01
    • 2021-10-10
    • 1970-01-01
    • 2020-03-02
    • 2017-06-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多