Skip to content

Commit 4c8790f

Browse files
committed
Support Tizen10.0 publishing
1 parent 7d0b876 commit 4c8790f

21 files changed

+127
-124
lines changed

packages/video_player_avplay/example/pubspec.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ dependencies:
1111
sdk: flutter
1212
http: ^0.13.0
1313
video_player_avplay:
14-
path: ../
14+
git:
15+
url: https://github.com/flutter-tizen/plugins.git
16+
path: packages/video_player_avplay
17+
ref: video_player_avplay_tizen10_publish
1518

1619
dev_dependencies:
1720
flutter_driver:

packages/video_player_avplay/lib/video_player.dart

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

9-
import 'package:device_info_plus_tizen/device_info_plus_tizen.dart';
109
import 'package:flutter/foundation.dart';
1110
import 'package:flutter/material.dart';
1211
import 'package:flutter/services.dart';
13-
import 'package:flutter_tizen/flutter_tizen.dart' as tizen;
1412

1513
import 'src/ad_info_from_dash.dart';
1614
import 'src/closed_caption_file.dart';
@@ -69,18 +67,18 @@ class VideoPlayerValue {
6967

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

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

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

270268
@override
271269
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-
);
270+
duration,
271+
size,
272+
position,
273+
caption,
274+
captionOffset,
275+
tracks,
276+
buffered,
277+
isInitialized,
278+
isPlaying,
279+
isLooping,
280+
isBuffering,
281+
volume,
282+
playbackSpeed,
283+
errorDescription,
284+
adInfo,
285+
isCompleted,
286+
);
289287
}
290288

291289
/// Controls a platform video player, and provides updates when the state is
@@ -309,17 +307,17 @@ class VideoPlayerController extends ValueNotifier<VideoPlayerValue> {
309307
this.package,
310308
this.closedCaptionFile,
311309
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-
);
310+
}) : dataSourceType = DataSourceType.asset,
311+
formatHint = null,
312+
httpHeaders = const <String, String>{},
313+
drmConfigs = null,
314+
playerOptions = const <String, dynamic>{},
315+
streamingProperty = null,
316+
super(
317+
VideoPlayerValue(
318+
duration: DurationRange(Duration.zero, Duration.zero),
319+
),
320+
);
323321

324322
/// Constructs a [VideoPlayerController] playing a video from obtained from
325323
/// the network.
@@ -339,13 +337,13 @@ class VideoPlayerController extends ValueNotifier<VideoPlayerValue> {
339337
this.drmConfigs,
340338
this.playerOptions,
341339
this.streamingProperty,
342-
}) : dataSourceType = DataSourceType.network,
343-
package = null,
344-
super(
345-
VideoPlayerValue(
346-
duration: DurationRange(Duration.zero, Duration.zero),
347-
),
348-
);
340+
}) : dataSourceType = DataSourceType.network,
341+
package = null,
342+
super(
343+
VideoPlayerValue(
344+
duration: DurationRange(Duration.zero, Duration.zero),
345+
),
346+
);
349347

350348
/// Constructs a [VideoPlayerController] playing a video from a file.
351349
///
@@ -355,19 +353,19 @@ class VideoPlayerController extends ValueNotifier<VideoPlayerValue> {
355353
File file, {
356354
this.closedCaptionFile,
357355
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-
);
356+
}) : dataSource = 'file://${file.path}',
357+
dataSourceType = DataSourceType.file,
358+
package = null,
359+
formatHint = null,
360+
httpHeaders = const <String, String>{},
361+
drmConfigs = null,
362+
playerOptions = const <String, dynamic>{},
363+
streamingProperty = null,
364+
super(
365+
VideoPlayerValue(
366+
duration: DurationRange(Duration.zero, Duration.zero),
367+
),
368+
);
371369

372370
/// Constructs a [VideoPlayerController] playing a video from a contentUri.
373371
///
@@ -377,23 +375,23 @@ class VideoPlayerController extends ValueNotifier<VideoPlayerValue> {
377375
Uri contentUri, {
378376
this.closedCaptionFile,
379377
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-
);
378+
}) : assert(
379+
defaultTargetPlatform == TargetPlatform.android,
380+
'VideoPlayerController.contentUri is only supported on Android.',
381+
),
382+
dataSource = contentUri.toString(),
383+
dataSourceType = DataSourceType.contentUri,
384+
package = null,
385+
formatHint = null,
386+
httpHeaders = const <String, String>{},
387+
drmConfigs = null,
388+
playerOptions = const <String, dynamic>{},
389+
streamingProperty = null,
390+
super(
391+
VideoPlayerValue(
392+
duration: DurationRange(Duration.zero, Duration.zero),
393+
),
394+
);
397395

398396
/// The URI to the video file. This will be in different formats depending on
399397
/// the [DataSourceType] of the original video.
@@ -462,41 +460,41 @@ class VideoPlayerController extends ValueNotifier<VideoPlayerValue> {
462460
'dev.flutter.videoplayer.drm',
463461
);
464462

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

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

501499
final bool allowBackgroundPlayback =
502500
videoPlayerOptions?.allowBackgroundPlayback ?? false;
@@ -542,7 +540,8 @@ class VideoPlayerController extends ValueNotifier<VideoPlayerValue> {
542540
);
543541
}
544542

545-
_playerId = (await _videoPlayerPlatform.create(dataSourceDescription)) ??
543+
_playerId =
544+
(await _videoPlayerPlatform.create(dataSourceDescription)) ??
546545
kUninitializedPlayerId;
547546
_creatingCompleter!.complete(null);
548547
final Completer<void> initializingCompleter = Completer<void>();
@@ -605,8 +604,8 @@ class VideoPlayerController extends ValueNotifier<VideoPlayerValue> {
605604
case VideoEventType.subtitleUpdate:
606605
final List<SubtitleAttribute> subtitleAttributes =
607606
SubtitleAttribute.fromEventSubtitleAttrList(
608-
event.subtitleAttributes,
609-
);
607+
event.subtitleAttributes,
608+
);
610609
final Caption caption = Caption(
611610
number: 0,
612611
start: value.position,
@@ -886,8 +885,8 @@ class VideoPlayerController extends ValueNotifier<VideoPlayerValue> {
886885
return '';
887886
}
888887

889-
final Future<String> streamingProperty =
890-
_videoPlayerPlatform.getStreamingProperty(_playerId, type);
888+
final Future<String> streamingProperty = _videoPlayerPlatform
889+
.getStreamingProperty(_playerId, type);
891890
await streamingProperty.then((String result) {
892891
// ignore: avoid_print
893892
print('[getStreamingProperty()] type: $type, result: $result');
@@ -913,7 +912,8 @@ class VideoPlayerController extends ValueNotifier<VideoPlayerValue> {
913912
type == StreamingPropertyType.dashToken ||
914913
type == StreamingPropertyType.openHttpHeader)) {
915914
throw Exception(
916-
'setStreamingProperty().$type only support for dash format!');
915+
'setStreamingProperty().$type only support for dash format!',
916+
);
917917
}
918918
return _videoPlayerPlatform.setStreamingProperty(_playerId, type, value);
919919
}
@@ -989,8 +989,9 @@ class VideoPlayerController extends ValueNotifier<VideoPlayerValue> {
989989
return;
990990
}
991991

992-
final DataSource? dataSource =
993-
(_onRestoreDataSource != null) ? _onRestoreDataSource!() : null;
992+
final DataSource? dataSource = (_onRestoreDataSource != null)
993+
? _onRestoreDataSource!()
994+
: null;
994995
final int resumeTime = (_onRestoreTime != null) ? _onRestoreTime!() : -1;
995996

996997
await _videoPlayerPlatform.restore(
@@ -1017,8 +1018,8 @@ class VideoPlayerController extends ValueNotifier<VideoPlayerValue> {
10171018
return <DashPlayerProperty, Object>{};
10181019
}
10191020

1020-
final Future<Map<DashPlayerProperty, Object>> data =
1021-
_videoPlayerPlatform.getData(playerId, keys);
1021+
final Future<Map<DashPlayerProperty, Object>> data = _videoPlayerPlatform
1022+
.getData(playerId, keys);
10221023
await data.then((Object result) {
10231024
// ignore: avoid_print
10241025
print('[getData()] result: \n$result');
@@ -1259,8 +1260,8 @@ class _VideoPlayerState extends State<VideoPlayer> {
12591260
}
12601261

12611262
Rect _getCurrentRect() {
1262-
final RenderObject? renderObject =
1263-
_videoBoxKey.currentContext?.findRenderObject();
1263+
final RenderObject? renderObject = _videoBoxKey.currentContext
1264+
?.findRenderObject();
12641265
if (renderObject == null) {
12651266
return Rect.zero;
12661267
}
@@ -1572,7 +1573,8 @@ class ClosedCaption extends StatelessWidget {
15721573
return const SizedBox.shrink();
15731574
}
15741575

1575-
final TextStyle effectiveTextStyle = textStyle ??
1576+
final TextStyle effectiveTextStyle =
1577+
textStyle ??
15761578
DefaultTextStyle.of(
15771579
context,
15781580
).style.copyWith(fontSize: 36.0, color: Colors.white);

packages/video_player_avplay/pubspec.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@ flutter:
1616
fileName: video_player_tizen_plugin.h
1717

1818
dependencies:
19-
device_info_plus_tizen: ^1.2.0
2019
flutter:
2120
sdk: flutter
22-
flutter_tizen: ^0.2.4
2321
html: ^0.15.0
2422
plugin_platform_interface: ^2.1.0
2523

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.

0 commit comments

Comments
 (0)