Youtube_player_flutter: [BUG] 缺少所需的客户端权利:MediaPlayback

创建于 2021-06-30  ·  4评论  ·  资料来源: sarbagyastha/youtube_player_flutter

描述错误
每次打开播放器时,我都会在控制台中打印如下错误:

2021-06-30 09:24:44.141532+0200 Media Creations[39379:12785401] [ProcessSuspension] 0x10c4dd0b0 - ProcessAssertion: Failed to acquire RBS MediaPlayback assertion 'WebKit Media Playback' for process with PID 39379, error: Error Domain=RBSAssertionErrorDomain Code=3 "Required client entitlement is missing" UserInfo={RBSAssertionAttribute=<RBSDomainAttribute| domain:"com.apple.webkit" name:"MediaPlayback" sourceEnvironment:"(null)">, NSLocalizedFailureReason=Required client entitlement is missing}

我的 YoutubePlayerController 如下所示:

final YoutubePlayerController _controller = YoutubePlayerController(
      initialVideoId: videoId,
      flags: YoutubePlayerFlags(
        enableCaption: false,
        hideThumbnail: true,
        forceHD: true,
        autoPlay: false,
        startAt: startAt,
      ),
    );

重现
在 IOS 上打开 YoutubePlayerFlutter

预期行为
打开播放器没有任何错误

截图
如果适用,请添加屏幕截图以帮助解释您的问题。

技术细节:

  • 设备:iPhone 10
  • 操作系统:iOS 14.6
  • 版本颤振 2.2.2

附加上下文
这是我的 YoutubePlayer 代码:

return OrientationBuilder(
      builder: (_, __) => YoutubePlayer(
        key: UniqueKey(),
        showVideoProgressIndicator: true,
        onReady: _controller.play,
        controller: _controller,
        controlsTimeOut: const Duration(seconds: 2),
        actionsPadding: const EdgeInsets.only(bottom: 10),
        progressIndicatorColor: _theme.primaryColor,
        onEnded: (_) => _controller.pause(),
        bottomActions: [
          Padding(
            padding: const EdgeInsets.only(
              left: VideoFullScreenButton.paddingSize +
                  VideoFullScreenButton.size * 2,
              right: VideoFullScreenButton.paddingSize,
            ),
            child: CurrentPosition(),
          ),
          ProgressBar(
            colors: ProgressBarColors(
              playedColor: _theme.primaryColor,
              handleColor: _theme.primaryColor,
            ),
            isExpanded: true,
          ),
          GestureDetector(
            onTap: () => launch(
              Strings.youtubeUrlFromId(
                videoId,
                seconds: _controller.value.position.inSeconds,
              ),
            ),
            child: const Padding(
              padding: EdgeInsets.only(
                left: VideoFullScreenButton.paddingSize,
                right: VideoFullScreenButton.paddingSize,
              ),
              child: FaIcon(
                FontAwesomeIcons.externalLinkAlt,
                color: Colors.white,
                size: VideoFullScreenButton.size,
              ),
            ),
          ),
          VideoFullScreenButton(
            preloadedFullScreen: isFullScreen,
            key: UniqueKey(),
            onTap: (isFullScreen) => _onVideoFullScreenTap(
              isFullScreen,
              context,
              _controller,
            ),
          ),
        ],
      ),
    );

我的项目中缺少什么吗? 如有询问,我会立即回复。

最有用的评论

我也有同样的问题

所有4条评论

我也有同样的问题

此警告是否涉及 Info.plist?

@PcolBP您找到任何解决方案了吗?

不幸的是,不适用于 YoutubePlayerFlutter。 对于那个项目,我切换到了 YoutubePlayerIframe,因为与 YoutubePlayerFlutter 相比,它提供了更好的性能,并且从那时起没有打印错误。

此页面是否有帮助?
0 / 5 - 0 等级