Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[video_player_avplay] Add check platform and api version #793

Merged
merged 3 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading