Skip to content

Commit af9f4a3

Browse files
authored
[video_player_avplay] Add check platform and api version (#793)
1 parent b38874d commit af9f4a3

File tree

4 files changed

+29
-2
lines changed

4 files changed

+29
-2
lines changed

packages/video_player_avplay/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.5.11
2+
3+
* Add check platform and api version.
4+
15
## 0.5.10
26

37
* Add setDisplayRotate API

packages/video_player_avplay/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ To use this package, add `video_player_avplay` as a dependency in your `pubspec.
1212

1313
```yaml
1414
dependencies:
15-
video_player_avplay: ^0.5.10
15+
video_player_avplay: ^0.5.11
1616
```
1717
1818
Then you can import `video_player_avplay` in your Dart code:

packages/video_player_avplay/lib/video_player.dart

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
import 'dart:async';
77
import 'dart:io';
88

9+
import 'package:device_info_plus_tizen/device_info_plus_tizen.dart';
910
import 'package:flutter/foundation.dart';
1011
import 'package:flutter/material.dart';
1112
import 'package:flutter/services.dart';
13+
import 'package:flutter_tizen/flutter_tizen.dart';
1214

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

374+
Future<void> _checkPlatformAndApiVersion() async {
375+
final DeviceInfoPluginTizen deviceInfoPlugin = DeviceInfoPluginTizen();
376+
final TizenDeviceInfo deviceInfo = await deviceInfoPlugin.tizenInfo;
377+
378+
if ((deviceInfo.platformVersion != null &&
379+
deviceInfo.platformVersion!.isNotEmpty) &&
380+
apiVersion != 'none' &&
381+
(deviceInfo.platformVersion != apiVersion)) {
382+
throw Exception(
383+
'The current TizenOS version(${deviceInfo.platformVersion}) '
384+
'and the app API version($apiVersion) are different. '
385+
'The avplay plugin does not guarantee compatibility with '
386+
'other versions. Therefore, please set the "api-version" '
387+
'in tizen-manifest.xml to match the TizenOS version and rebuild.');
388+
}
389+
}
390+
372391
/// Attempts to open the given [dataSource] and load metadata about the video.
373392
Future<void> initialize() async {
393+
await _checkPlatformAndApiVersion();
394+
374395
final bool allowBackgroundPlayback =
375396
videoPlayerOptions?.allowBackgroundPlayback ?? false;
376397
if (!allowBackgroundPlayback) {

packages/video_player_avplay/pubspec.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: video_player_avplay
22
description: Flutter plugin for displaying inline video on Tizen TV devices.
33
homepage: https://github.com/flutter-tizen/plugins
44
repository: https://github.com/flutter-tizen/plugins/tree/master/packages/video_player_avplay
5-
version: 0.5.10
5+
version: 0.5.11
66

77
environment:
88
sdk: ">=3.1.0 <4.0.0"
@@ -16,8 +16,10 @@ flutter:
1616
fileName: video_player_tizen_plugin.h
1717

1818
dependencies:
19+
device_info_plus_tizen: ^1.2.0
1920
flutter:
2021
sdk: flutter
22+
flutter_tizen: ^0.2.4
2123
html: ^0.15.0
2224
plugin_platform_interface: ^2.1.0
2325

0 commit comments

Comments
 (0)