Blame view

lib/common/utils/video_rendering_preference.dart 748 Bytes
dbca8811   吴启风   fix: 修复视频兼容性并增加渲染...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
  import 'package:flutter/foundation.dart';
  import 'package:video_player/video_player.dart';
  import 'package:wow_english/utils/sp_util.dart';
  
  /// User-selectable Android video output path for device compatibility testing.
  class VideoRenderingPreference {
    static const _usePlatformViewKey = 'video_player_use_platform_view';
  
    static bool get usesPlatformView =>
        SpUtil.getInstance().get<bool>(_usePlatformViewKey) ?? false;
  
    static VideoViewType get viewType =>
        defaultTargetPlatform == TargetPlatform.android && usesPlatformView
            ? VideoViewType.platformView
            : VideoViewType.textureView;
  
    static Future<void> setUsesPlatformView(bool value) =>
        SpUtil.getInstance().setData(_usePlatformViewKey, value);
  }