|
6 | 6 | import 'dart:async'; |
7 | 7 | import 'dart:io'; |
8 | 8 |
|
| 9 | +import 'package:device_info_plus_tizen/device_info_plus_tizen.dart'; |
9 | 10 | import 'package:flutter/foundation.dart'; |
10 | 11 | import 'package:flutter/material.dart'; |
11 | 12 | import 'package:flutter/services.dart'; |
| 13 | +import 'package:flutter_tizen/flutter_tizen.dart'; |
12 | 14 |
|
13 | 15 | import 'src/closed_caption_file.dart'; |
14 | 16 | import 'src/drm_configs.dart'; |
@@ -369,8 +371,27 @@ class VideoPlayerController extends ValueNotifier<VideoPlayerValue> { |
369 | 371 | final MethodChannel _channel = |
370 | 372 | const MethodChannel('dev.flutter.videoplayer.drm'); |
371 | 373 |
|
| 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 | + |
372 | 391 | /// Attempts to open the given [dataSource] and load metadata about the video. |
373 | 392 | Future<void> initialize() async { |
| 393 | + await _checkPlatformAndApiVersion(); |
| 394 | + |
374 | 395 | final bool allowBackgroundPlayback = |
375 | 396 | videoPlayerOptions?.allowBackgroundPlayback ?? false; |
376 | 397 | if (!allowBackgroundPlayback) { |
|
0 commit comments