Skip to content

Commit 788df8f

Browse files
committed
Support Tizen10.0 publishing
1 parent 7d0b876 commit 788df8f

20 files changed

+124
-120
lines changed

packages/video_player_avplay/example/tizen/tizen-manifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<manifest package="org.tizen.video_player_avplay_example" version="1.0.0" api-version="6.0" xmlns="http://tizen.org/ns/packages">
2+
<manifest package="org.tizen.video_player_avplay_example" version="1.0.0" api-version="9.0" xmlns="http://tizen.org/ns/packages">
33
<profile name="tv"/>
44
<ui-application appid="org.tizen.video_player_avplay_example" exec="Runner.dll" type="dotnet" multiple="false" taskmanage="true" nodisplay="false">
55
<label>video_player_avplay_example</label>

packages/video_player_avplay/lib/video_player.dart

Lines changed: 123 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,18 @@ class VideoPlayerValue {
6969

7070
/// Returns an instance for a video that hasn't been loaded.
7171
VideoPlayerValue.uninitialized()
72-
: this(
73-
duration: DurationRange(Duration.zero, Duration.zero),
74-
isInitialized: false,
75-
);
72+
: this(
73+
duration: DurationRange(Duration.zero, Duration.zero),
74+
isInitialized: false,
75+
);
7676

7777
/// Returns an instance with the given [errorDescription].
7878
VideoPlayerValue.erroneous(String errorDescription)
79-
: this(
80-
duration: DurationRange(Duration.zero, Duration.zero),
81-
isInitialized: false,
82-
errorDescription: errorDescription,
83-
);
79+
: this(
80+
duration: DurationRange(Duration.zero, Duration.zero),
81+
isInitialized: false,
82+
errorDescription: errorDescription,
83+
);
8484

8585
/// This constant is just to indicate that parameter is not passed to [copyWith]
8686
/// workaround for this issue https://github.com/dart-lang/language/issues/2009
@@ -269,23 +269,23 @@ class VideoPlayerValue {
269269

270270
@override
271271
int get hashCode => Object.hash(
272-
duration,
273-
size,
274-
position,
275-
caption,
276-
captionOffset,
277-
tracks,
278-
buffered,
279-
isInitialized,
280-
isPlaying,
281-
isLooping,
282-
isBuffering,
283-
volume,
284-
playbackSpeed,
285-
errorDescription,
286-
adInfo,
287-
isCompleted,
288-
);
272+
duration,
273+
size,
274+
position,
275+
caption,
276+
captionOffset,
277+
tracks,
278+
buffered,
279+
isInitialized,
280+
isPlaying,
281+
isLooping,
282+
isBuffering,
283+
volume,
284+
playbackSpeed,
285+
errorDescription,
286+
adInfo,
287+
isCompleted,
288+
);
289289
}
290290

291291
/// Controls a platform video player, and provides updates when the state is
@@ -309,17 +309,17 @@ class VideoPlayerController extends ValueNotifier<VideoPlayerValue> {
309309
this.package,
310310
this.closedCaptionFile,
311311
this.videoPlayerOptions,
312-
}) : dataSourceType = DataSourceType.asset,
313-
formatHint = null,
314-
httpHeaders = const <String, String>{},
315-
drmConfigs = null,
316-
playerOptions = const <String, dynamic>{},
317-
streamingProperty = null,
318-
super(
319-
VideoPlayerValue(
320-
duration: DurationRange(Duration.zero, Duration.zero),
321-
),
322-
);
312+
}) : dataSourceType = DataSourceType.asset,
313+
formatHint = null,
314+
httpHeaders = const <String, String>{},
315+
drmConfigs = null,
316+
playerOptions = const <String, dynamic>{},
317+
streamingProperty = null,
318+
super(
319+
VideoPlayerValue(
320+
duration: DurationRange(Duration.zero, Duration.zero),
321+
),
322+
);
323323

324324
/// Constructs a [VideoPlayerController] playing a video from obtained from
325325
/// the network.
@@ -339,13 +339,13 @@ class VideoPlayerController extends ValueNotifier<VideoPlayerValue> {
339339
this.drmConfigs,
340340
this.playerOptions,
341341
this.streamingProperty,
342-
}) : dataSourceType = DataSourceType.network,
343-
package = null,
344-
super(
345-
VideoPlayerValue(
346-
duration: DurationRange(Duration.zero, Duration.zero),
347-
),
348-
);
342+
}) : dataSourceType = DataSourceType.network,
343+
package = null,
344+
super(
345+
VideoPlayerValue(
346+
duration: DurationRange(Duration.zero, Duration.zero),
347+
),
348+
);
349349

350350
/// Constructs a [VideoPlayerController] playing a video from a file.
351351
///
@@ -355,19 +355,19 @@ class VideoPlayerController extends ValueNotifier<VideoPlayerValue> {
355355
File file, {
356356
this.closedCaptionFile,
357357
this.videoPlayerOptions,
358-
}) : dataSource = 'file://${file.path}',
359-
dataSourceType = DataSourceType.file,
360-
package = null,
361-
formatHint = null,
362-
httpHeaders = const <String, String>{},
363-
drmConfigs = null,
364-
playerOptions = const <String, dynamic>{},
365-
streamingProperty = null,
366-
super(
367-
VideoPlayerValue(
368-
duration: DurationRange(Duration.zero, Duration.zero),
369-
),
370-
);
358+
}) : dataSource = 'file://${file.path}',
359+
dataSourceType = DataSourceType.file,
360+
package = null,
361+
formatHint = null,
362+
httpHeaders = const <String, String>{},
363+
drmConfigs = null,
364+
playerOptions = const <String, dynamic>{},
365+
streamingProperty = null,
366+
super(
367+
VideoPlayerValue(
368+
duration: DurationRange(Duration.zero, Duration.zero),
369+
),
370+
);
371371

372372
/// Constructs a [VideoPlayerController] playing a video from a contentUri.
373373
///
@@ -377,23 +377,23 @@ class VideoPlayerController extends ValueNotifier<VideoPlayerValue> {
377377
Uri contentUri, {
378378
this.closedCaptionFile,
379379
this.videoPlayerOptions,
380-
}) : assert(
381-
defaultTargetPlatform == TargetPlatform.android,
382-
'VideoPlayerController.contentUri is only supported on Android.',
383-
),
384-
dataSource = contentUri.toString(),
385-
dataSourceType = DataSourceType.contentUri,
386-
package = null,
387-
formatHint = null,
388-
httpHeaders = const <String, String>{},
389-
drmConfigs = null,
390-
playerOptions = const <String, dynamic>{},
391-
streamingProperty = null,
392-
super(
393-
VideoPlayerValue(
394-
duration: DurationRange(Duration.zero, Duration.zero),
395-
),
396-
);
380+
}) : assert(
381+
defaultTargetPlatform == TargetPlatform.android,
382+
'VideoPlayerController.contentUri is only supported on Android.',
383+
),
384+
dataSource = contentUri.toString(),
385+
dataSourceType = DataSourceType.contentUri,
386+
package = null,
387+
formatHint = null,
388+
httpHeaders = const <String, String>{},
389+
drmConfigs = null,
390+
playerOptions = const <String, dynamic>{},
391+
streamingProperty = null,
392+
super(
393+
VideoPlayerValue(
394+
duration: DurationRange(Duration.zero, Duration.zero),
395+
),
396+
);
397397

398398
/// The URI to the video file. This will be in different formats depending on
399399
/// the [DataSourceType] of the original video.
@@ -462,41 +462,41 @@ class VideoPlayerController extends ValueNotifier<VideoPlayerValue> {
462462
'dev.flutter.videoplayer.drm',
463463
);
464464

465-
Future<void> _checkPlatformAndApiVersion() async {
466-
final DeviceInfoPluginTizen deviceInfoPlugin = DeviceInfoPluginTizen();
467-
final TizenDeviceInfo deviceInfo = await deviceInfoPlugin.tizenInfo;
468-
469-
if ((deviceInfo.platformVersion != null &&
470-
deviceInfo.platformVersion!.isNotEmpty) &&
471-
tizen.apiVersion != 'none') {
472-
if (deviceInfo.platformVersion != tizen.apiVersion) {
473-
final double? platformVersion = double.tryParse(
474-
deviceInfo.platformVersion!,
475-
);
476-
final double? apiVersion = double.tryParse(tizen.apiVersion);
477-
if (platformVersion != null && apiVersion != null) {
478-
if (platformVersion == 6.0 || platformVersion == 10.0) {
479-
throw Exception(
480-
'The current TizenOS version is $platformVersion and the app API version($apiVersion). The app API version must also be $platformVersion. '
481-
'The avplay plugin, with an apiVersion of $apiVersion does not guarantee compatibility with other TizenOS versions. Therefore '
482-
'Please set the "api-version" in tizen-manifest.xml to $platformVersion and rebuild.',
483-
);
484-
} else if ((platformVersion >= 6.5 && platformVersion <= 9.0) &&
485-
(apiVersion == 6.0 || apiVersion == 10.0)) {
486-
throw Exception(
487-
'The current TizenOS version is $platformVersion and the app API version($apiVersion). The app API version must be at least 6.5. '
488-
'The avplay plugin, with an apiVersion of $apiVersion does not guarantee compatibility with other TizenOS versions. Therefore '
489-
'Please set the "api-version" in tizen-manifest.xml to a minimum of 6.5 and rebuild.',
490-
);
491-
}
492-
}
493-
}
494-
}
495-
}
465+
// Future<void> _checkPlatformAndApiVersion() async {
466+
// final DeviceInfoPluginTizen deviceInfoPlugin = DeviceInfoPluginTizen();
467+
// final TizenDeviceInfo deviceInfo = await deviceInfoPlugin.tizenInfo;
468+
469+
// if ((deviceInfo.platformVersion != null &&
470+
// deviceInfo.platformVersion!.isNotEmpty) &&
471+
// tizen.apiVersion != 'none') {
472+
// if (deviceInfo.platformVersion != tizen.apiVersion) {
473+
// final double? platformVersion = double.tryParse(
474+
// deviceInfo.platformVersion!,
475+
// );
476+
// final double? apiVersion = double.tryParse(tizen.apiVersion);
477+
// if (platformVersion != null && apiVersion != null) {
478+
// if (platformVersion == 6.0 || platformVersion == 10.0) {
479+
// throw Exception(
480+
// 'The current TizenOS version is $platformVersion and the app API version($apiVersion). The app API version must also be $platformVersion. '
481+
// 'The avplay plugin, with an apiVersion of $apiVersion does not guarantee compatibility with other TizenOS versions. Therefore '
482+
// 'Please set the "api-version" in tizen-manifest.xml to $platformVersion and rebuild.',
483+
// );
484+
// } else if ((platformVersion >= 6.5 && platformVersion <= 9.0) &&
485+
// (apiVersion == 6.0 || apiVersion == 10.0)) {
486+
// throw Exception(
487+
// 'The current TizenOS version is $platformVersion and the app API version($apiVersion). The app API version must be at least 6.5. '
488+
// 'The avplay plugin, with an apiVersion of $apiVersion does not guarantee compatibility with other TizenOS versions. Therefore '
489+
// 'Please set the "api-version" in tizen-manifest.xml to a minimum of 6.5 and rebuild.',
490+
// );
491+
// }
492+
// }
493+
// }
494+
// }
495+
// }
496496

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

501501
final bool allowBackgroundPlayback =
502502
videoPlayerOptions?.allowBackgroundPlayback ?? false;
@@ -542,7 +542,8 @@ class VideoPlayerController extends ValueNotifier<VideoPlayerValue> {
542542
);
543543
}
544544

545-
_playerId = (await _videoPlayerPlatform.create(dataSourceDescription)) ??
545+
_playerId =
546+
(await _videoPlayerPlatform.create(dataSourceDescription)) ??
546547
kUninitializedPlayerId;
547548
_creatingCompleter!.complete(null);
548549
final Completer<void> initializingCompleter = Completer<void>();
@@ -605,8 +606,8 @@ class VideoPlayerController extends ValueNotifier<VideoPlayerValue> {
605606
case VideoEventType.subtitleUpdate:
606607
final List<SubtitleAttribute> subtitleAttributes =
607608
SubtitleAttribute.fromEventSubtitleAttrList(
608-
event.subtitleAttributes,
609-
);
609+
event.subtitleAttributes,
610+
);
610611
final Caption caption = Caption(
611612
number: 0,
612613
start: value.position,
@@ -886,8 +887,8 @@ class VideoPlayerController extends ValueNotifier<VideoPlayerValue> {
886887
return '';
887888
}
888889

889-
final Future<String> streamingProperty =
890-
_videoPlayerPlatform.getStreamingProperty(_playerId, type);
890+
final Future<String> streamingProperty = _videoPlayerPlatform
891+
.getStreamingProperty(_playerId, type);
891892
await streamingProperty.then((String result) {
892893
// ignore: avoid_print
893894
print('[getStreamingProperty()] type: $type, result: $result');
@@ -913,7 +914,8 @@ class VideoPlayerController extends ValueNotifier<VideoPlayerValue> {
913914
type == StreamingPropertyType.dashToken ||
914915
type == StreamingPropertyType.openHttpHeader)) {
915916
throw Exception(
916-
'setStreamingProperty().$type only support for dash format!');
917+
'setStreamingProperty().$type only support for dash format!',
918+
);
917919
}
918920
return _videoPlayerPlatform.setStreamingProperty(_playerId, type, value);
919921
}
@@ -989,8 +991,9 @@ class VideoPlayerController extends ValueNotifier<VideoPlayerValue> {
989991
return;
990992
}
991993

992-
final DataSource? dataSource =
993-
(_onRestoreDataSource != null) ? _onRestoreDataSource!() : null;
994+
final DataSource? dataSource = (_onRestoreDataSource != null)
995+
? _onRestoreDataSource!()
996+
: null;
994997
final int resumeTime = (_onRestoreTime != null) ? _onRestoreTime!() : -1;
995998

996999
await _videoPlayerPlatform.restore(
@@ -1017,8 +1020,8 @@ class VideoPlayerController extends ValueNotifier<VideoPlayerValue> {
10171020
return <DashPlayerProperty, Object>{};
10181021
}
10191022

1020-
final Future<Map<DashPlayerProperty, Object>> data =
1021-
_videoPlayerPlatform.getData(playerId, keys);
1023+
final Future<Map<DashPlayerProperty, Object>> data = _videoPlayerPlatform
1024+
.getData(playerId, keys);
10221025
await data.then((Object result) {
10231026
// ignore: avoid_print
10241027
print('[getData()] result: \n$result');
@@ -1259,8 +1262,8 @@ class _VideoPlayerState extends State<VideoPlayer> {
12591262
}
12601263

12611264
Rect _getCurrentRect() {
1262-
final RenderObject? renderObject =
1263-
_videoBoxKey.currentContext?.findRenderObject();
1265+
final RenderObject? renderObject = _videoBoxKey.currentContext
1266+
?.findRenderObject();
12641267
if (renderObject == null) {
12651268
return Rect.zero;
12661269
}
@@ -1572,7 +1575,8 @@ class ClosedCaption extends StatelessWidget {
15721575
return const SizedBox.shrink();
15731576
}
15741577

1575-
final TextStyle effectiveTextStyle = textStyle ??
1578+
final TextStyle effectiveTextStyle =
1579+
textStyle ??
15761580
DefaultTextStyle.of(
15771581
context,
15781582
).style.copyWith(fontSize: 36.0, color: Colors.white);
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-20 KB
Binary file not shown.
Binary file not shown.
3.99 KB
Binary file not shown.

0 commit comments

Comments
 (0)