Skip to content

Commit

Permalink
[video_player_avplay] Add check platform and api version (#793)
Browse files Browse the repository at this point in the history
  • Loading branch information
JSUYA authored Jan 13, 2025
1 parent b38874d commit af9f4a3
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
4 changes: 4 additions & 0 deletions packages/video_player_avplay/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.5.11

* Add check platform and api version.

## 0.5.10

* Add setDisplayRotate API
Expand Down
2 changes: 1 addition & 1 deletion packages/video_player_avplay/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ To use this package, add `video_player_avplay` as a dependency in your `pubspec.

```yaml
dependencies:
video_player_avplay: ^0.5.10
video_player_avplay: ^0.5.11
```
Then you can import `video_player_avplay` in your Dart code:
Expand Down
21 changes: 21 additions & 0 deletions packages/video_player_avplay/lib/video_player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
import 'dart:async';
import 'dart:io';

import 'package:device_info_plus_tizen/device_info_plus_tizen.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_tizen/flutter_tizen.dart';

import 'src/closed_caption_file.dart';
import 'src/drm_configs.dart';
Expand Down Expand Up @@ -369,8 +371,27 @@ class VideoPlayerController extends ValueNotifier<VideoPlayerValue> {
final MethodChannel _channel =
const MethodChannel('dev.flutter.videoplayer.drm');

Future<void> _checkPlatformAndApiVersion() async {
final DeviceInfoPluginTizen deviceInfoPlugin = DeviceInfoPluginTizen();
final TizenDeviceInfo deviceInfo = await deviceInfoPlugin.tizenInfo;

if ((deviceInfo.platformVersion != null &&
deviceInfo.platformVersion!.isNotEmpty) &&
apiVersion != 'none' &&
(deviceInfo.platformVersion != apiVersion)) {
throw Exception(
'The current TizenOS version(${deviceInfo.platformVersion}) '
'and the app API version($apiVersion) are different. '
'The avplay plugin does not guarantee compatibility with '
'other versions. Therefore, please set the "api-version" '
'in tizen-manifest.xml to match the TizenOS version and rebuild.');
}
}

/// Attempts to open the given [dataSource] and load metadata about the video.
Future<void> initialize() async {
await _checkPlatformAndApiVersion();

final bool allowBackgroundPlayback =
videoPlayerOptions?.allowBackgroundPlayback ?? false;
if (!allowBackgroundPlayback) {
Expand Down
4 changes: 3 additions & 1 deletion packages/video_player_avplay/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: video_player_avplay
description: Flutter plugin for displaying inline video on Tizen TV devices.
homepage: https://github.com/flutter-tizen/plugins
repository: https://github.com/flutter-tizen/plugins/tree/master/packages/video_player_avplay
version: 0.5.10
version: 0.5.11

environment:
sdk: ">=3.1.0 <4.0.0"
Expand All @@ -16,8 +16,10 @@ flutter:
fileName: video_player_tizen_plugin.h

dependencies:
device_info_plus_tizen: ^1.2.0
flutter:
sdk: flutter
flutter_tizen: ^0.2.4
html: ^0.15.0
plugin_platform_interface: ^2.1.0

Expand Down

0 comments on commit af9f4a3

Please sign in to comment.