startVideoOrientationService method

Future<BoolMsg> startVideoOrientationService()

开始监听设备旋转方向,开启之后,如果设备自动旋转打开,播放器会自动根据当前设备方向来旋转视频方向。

该接口目前只适用安卓端,IOS端会自动开启该能力

在调用该接口前,请务必向用户告知隐私风险。 如有需要,请确认是否有获取旋转sensor的权限。 @return true : 开启成功 false : 开启失败,如开启过早,还未等到上下文初始化、获取sensor失败等原因

Implementation

Future<BoolMsg> startVideoOrientationService() async {
  final String pigeonVar_channelName = 'dev.flutter.pigeon.super_player.TXFlutterSuperPlayerPluginAPI.startVideoOrientationService$pigeonVar_messageChannelSuffix';
  final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
    pigeonVar_channelName,
    pigeonChannelCodec,
    binaryMessenger: pigeonVar_binaryMessenger,
  );
  final List<Object?>? pigeonVar_replyList =
      await pigeonVar_channel.send(null) as List<Object?>?;
  if (pigeonVar_replyList == null) {
    throw _createConnectionError(pigeonVar_channelName);
  } else if (pigeonVar_replyList.length > 1) {
    throw PlatformException(
      code: pigeonVar_replyList[0]! as String,
      message: pigeonVar_replyList[1] as String?,
      details: pigeonVar_replyList[2],
    );
  } else if (pigeonVar_replyList[0] == null) {
    throw PlatformException(
      code: 'null-error',
      message: 'Host platform returned null value for non-null return value.',
    );
  } else {
    return (pigeonVar_replyList[0] as BoolMsg?)!;
  }
}