diff --git a/packages/video_player_avplay/CHANGELOG.md b/packages/video_player_avplay/CHANGELOG.md index 0a47680f0..377203b7d 100644 --- a/packages/video_player_avplay/CHANGELOG.md +++ b/packages/video_player_avplay/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.8.18 + +* Replace ecore-wl2 code with tizen window manager plugin. + ## 0.8.17 * Resolve `strict_top_level_inference` lint. diff --git a/packages/video_player_avplay/README.md b/packages/video_player_avplay/README.md index 2db4b1913..3773429df 100644 --- a/packages/video_player_avplay/README.md +++ b/packages/video_player_avplay/README.md @@ -12,7 +12,7 @@ To use this package, add `video_player_avplay` as a dependency in your `pubspec. ```yaml dependencies: - video_player_avplay: ^0.8.17 + video_player_avplay: ^0.8.18 ``` Then you can import `video_player_avplay` in your Dart code: diff --git a/packages/video_player_avplay/lib/src/messages.g.dart b/packages/video_player_avplay/lib/src/messages.g.dart index 788cab1fa..e0f01d9a7 100644 --- a/packages/video_player_avplay/lib/src/messages.g.dart +++ b/packages/video_player_avplay/lib/src/messages.g.dart @@ -18,28 +18,29 @@ PlatformException _createConnectionError(String channelName) { bool _deepEquals(Object? a, Object? b) { if (a is List && b is List) { return a.length == b.length && - a.indexed.every( - ((int, dynamic) item) => _deepEquals(item.$2, b[item.$1]), - ); + a.indexed + .every(((int, dynamic) item) => _deepEquals(item.$2, b[item.$1])); } if (a is Map && b is Map) { return a.length == b.length && - a.entries.every( - (MapEntry entry) => - (b as Map).containsKey(entry.key) && - _deepEquals(entry.value, b[entry.key]), - ); + a.entries.every((MapEntry entry) => + (b as Map).containsKey(entry.key) && + _deepEquals(entry.value, b[entry.key])); } return a == b; } class PlayerMessage { - PlayerMessage({required this.playerId}); + PlayerMessage({ + required this.playerId, + }); int playerId; List _toList() { - return [playerId]; + return [ + playerId, + ]; } Object encode() { @@ -48,7 +49,9 @@ class PlayerMessage { static PlayerMessage decode(Object result) { result as List; - return PlayerMessage(playerId: result[0]! as int); + return PlayerMessage( + playerId: result[0]! as int, + ); } @override @@ -69,14 +72,20 @@ class PlayerMessage { } class LoopingMessage { - LoopingMessage({required this.playerId, required this.isLooping}); + LoopingMessage({ + required this.playerId, + required this.isLooping, + }); int playerId; bool isLooping; List _toList() { - return [playerId, isLooping]; + return [ + playerId, + isLooping, + ]; } Object encode() { @@ -109,14 +118,20 @@ class LoopingMessage { } class VolumeMessage { - VolumeMessage({required this.playerId, required this.volume}); + VolumeMessage({ + required this.playerId, + required this.volume, + }); int playerId; double volume; List _toList() { - return [playerId, volume]; + return [ + playerId, + volume, + ]; } Object encode() { @@ -149,14 +164,20 @@ class VolumeMessage { } class PlaybackSpeedMessage { - PlaybackSpeedMessage({required this.playerId, required this.speed}); + PlaybackSpeedMessage({ + required this.playerId, + required this.speed, + }); int playerId; double speed; List _toList() { - return [playerId, speed]; + return [ + playerId, + speed, + ]; } Object encode() { @@ -189,14 +210,20 @@ class PlaybackSpeedMessage { } class TrackMessage { - TrackMessage({required this.playerId, required this.tracks}); + TrackMessage({ + required this.playerId, + required this.tracks, + }); int playerId; List?> tracks; List _toList() { - return [playerId, tracks]; + return [ + playerId, + tracks, + ]; } Object encode() { @@ -229,14 +256,20 @@ class TrackMessage { } class TrackTypeMessage { - TrackTypeMessage({required this.playerId, required this.trackType}); + TrackTypeMessage({ + required this.playerId, + required this.trackType, + }); int playerId; String trackType; List _toList() { - return [playerId, trackType]; + return [ + playerId, + trackType, + ]; } Object encode() { @@ -282,7 +315,11 @@ class SelectedTracksMessage { String trackType; List _toList() { - return [playerId, trackId, trackType]; + return [ + playerId, + trackId, + trackType, + ]; } Object encode() { @@ -316,14 +353,20 @@ class SelectedTracksMessage { } class PositionMessage { - PositionMessage({required this.playerId, required this.position}); + PositionMessage({ + required this.playerId, + required this.position, + }); int playerId; int position; List _toList() { - return [playerId, position]; + return [ + playerId, + position, + ]; } Object encode() { @@ -365,6 +408,7 @@ class CreateMessage { this.drmConfigs, this.playerOptions, this.streamingProperty, + this.windowGeometry, }); String? asset; @@ -383,6 +427,8 @@ class CreateMessage { Map? streamingProperty; + Map? windowGeometry; + List _toList() { return [ asset, @@ -393,6 +439,7 @@ class CreateMessage { drmConfigs, playerOptions, streamingProperty, + windowGeometry, ]; } @@ -415,6 +462,8 @@ class CreateMessage { (result[6] as Map?)?.cast(), streamingProperty: (result[7] as Map?)?.cast(), + windowGeometry: + (result[8] as Map?)?.cast(), ); } @@ -436,12 +485,16 @@ class CreateMessage { } class MixWithOthersMessage { - MixWithOthersMessage({required this.mixWithOthers}); + MixWithOthersMessage({ + required this.mixWithOthers, + }); bool mixWithOthers; List _toList() { - return [mixWithOthers]; + return [ + mixWithOthers, + ]; } Object encode() { @@ -450,7 +503,9 @@ class MixWithOthersMessage { static MixWithOthersMessage decode(Object result) { result as List; - return MixWithOthersMessage(mixWithOthers: result[0]! as bool); + return MixWithOthersMessage( + mixWithOthers: result[0]! as bool, + ); } @override @@ -490,7 +545,13 @@ class GeometryMessage { int height; List _toList() { - return [playerId, x, y, width, height]; + return [ + playerId, + x, + y, + width, + height, + ]; } Object encode() { @@ -526,14 +587,20 @@ class GeometryMessage { } class DurationMessage { - DurationMessage({required this.playerId, this.durationRange}); + DurationMessage({ + required this.playerId, + this.durationRange, + }); int playerId; List? durationRange; List _toList() { - return [playerId, durationRange]; + return [ + playerId, + durationRange, + ]; } Object encode() { @@ -576,7 +643,10 @@ class StreamingPropertyTypeMessage { String streamingPropertyType; List _toList() { - return [playerId, streamingPropertyType]; + return [ + playerId, + streamingPropertyType, + ]; } Object encode() { @@ -623,7 +693,11 @@ class StreamingPropertyMessage { String streamingPropertyValue; List _toList() { - return [playerId, streamingPropertyType, streamingPropertyValue]; + return [ + playerId, + streamingPropertyType, + streamingPropertyValue, + ]; } Object encode() { @@ -671,7 +745,11 @@ class BufferConfigMessage { int bufferConfigValue; List _toList() { - return [playerId, bufferConfigType, bufferConfigValue]; + return [ + playerId, + bufferConfigType, + bufferConfigValue, + ]; } Object encode() { @@ -705,14 +783,20 @@ class BufferConfigMessage { } class RotationMessage { - RotationMessage({required this.playerId, required this.rotation}); + RotationMessage({ + required this.playerId, + required this.rotation, + }); int playerId; int rotation; List _toList() { - return [playerId, rotation]; + return [ + playerId, + rotation, + ]; } Object encode() { @@ -745,14 +829,20 @@ class RotationMessage { } class DisplayModeMessage { - DisplayModeMessage({required this.playerId, required this.displayMode}); + DisplayModeMessage({ + required this.playerId, + required this.displayMode, + }); int playerId; int displayMode; List _toList() { - return [playerId, displayMode]; + return [ + playerId, + displayMode, + ]; } Object encode() { @@ -785,14 +875,20 @@ class DisplayModeMessage { } class DashPropertyTypeListMessage { - DashPropertyTypeListMessage({required this.playerId, required this.typeList}); + DashPropertyTypeListMessage({ + required this.playerId, + required this.typeList, + }); int playerId; List typeList; List _toList() { - return [playerId, typeList]; + return [ + playerId, + typeList, + ]; } Object encode() { @@ -826,14 +922,20 @@ class DashPropertyTypeListMessage { } class DashPropertyMapMessage { - DashPropertyMapMessage({required this.playerId, required this.mapData}); + DashPropertyMapMessage({ + required this.playerId, + required this.mapData, + }); int playerId; Map mapData; List _toList() { - return [playerId, mapData]; + return [ + playerId, + mapData, + ]; } Object encode() { @@ -985,10 +1087,9 @@ class VideoPlayerAvplayApi { /// Constructor for [VideoPlayerAvplayApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. - VideoPlayerAvplayApi({ - BinaryMessenger? binaryMessenger, - String messageChannelSuffix = '', - }) : pigeonVar_binaryMessenger = binaryMessenger, + VideoPlayerAvplayApi( + {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) + : pigeonVar_binaryMessenger = binaryMessenger, pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; final BinaryMessenger? pigeonVar_binaryMessenger; @@ -1031,9 +1132,8 @@ class VideoPlayerAvplayApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send( - [msg], - ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([msg]); final List? pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { @@ -1063,9 +1163,8 @@ class VideoPlayerAvplayApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send( - [msg], - ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([msg]); final List? pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { @@ -1090,9 +1189,8 @@ class VideoPlayerAvplayApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send( - [msg], - ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([msg]); final List? pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { @@ -1117,9 +1215,8 @@ class VideoPlayerAvplayApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send( - [msg], - ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([msg]); final List? pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { @@ -1144,9 +1241,8 @@ class VideoPlayerAvplayApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send( - [msg], - ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([msg]); final List? pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { @@ -1171,9 +1267,8 @@ class VideoPlayerAvplayApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send( - [msg], - ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([msg]); final List? pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { @@ -1198,9 +1293,8 @@ class VideoPlayerAvplayApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send( - [msg], - ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([msg]); final List? pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { @@ -1230,9 +1324,8 @@ class VideoPlayerAvplayApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send( - [msg], - ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([msg]); final List? pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { @@ -1262,9 +1355,8 @@ class VideoPlayerAvplayApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send( - [msg], - ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([msg]); final List? pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { @@ -1294,9 +1386,8 @@ class VideoPlayerAvplayApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send( - [msg], - ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([msg]); final List? pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { @@ -1326,9 +1417,8 @@ class VideoPlayerAvplayApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send( - [msg], - ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([msg]); final List? pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { @@ -1358,9 +1448,8 @@ class VideoPlayerAvplayApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send( - [msg], - ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([msg]); final List? pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { @@ -1390,9 +1479,8 @@ class VideoPlayerAvplayApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send( - [msg], - ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([msg]); final List? pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { @@ -1417,9 +1505,8 @@ class VideoPlayerAvplayApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send( - [msg], - ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([msg]); final List? pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { @@ -1444,9 +1531,8 @@ class VideoPlayerAvplayApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send( - [msg], - ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([msg]); final List? pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { @@ -1471,9 +1557,8 @@ class VideoPlayerAvplayApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send( - [msg], - ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([msg]); final List? pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { @@ -1498,9 +1583,8 @@ class VideoPlayerAvplayApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send( - [msg], - ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([msg]); final List? pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { @@ -1530,9 +1614,8 @@ class VideoPlayerAvplayApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send( - [msg], - ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([msg]); final List? pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { @@ -1562,9 +1645,8 @@ class VideoPlayerAvplayApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send( - [msg], - ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([msg]); final List? pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { @@ -1589,9 +1671,8 @@ class VideoPlayerAvplayApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send( - [msg], - ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([msg]); final List? pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { @@ -1621,9 +1702,8 @@ class VideoPlayerAvplayApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send( - [msg], - ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([msg]); final List? pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { @@ -1653,9 +1733,8 @@ class VideoPlayerAvplayApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send( - [playerId], - ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([playerId]); final List? pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { @@ -1680,9 +1759,8 @@ class VideoPlayerAvplayApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send( - [playerId, msg, resumeTime], - ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([playerId, msg, resumeTime]); final List? pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { @@ -1707,9 +1785,8 @@ class VideoPlayerAvplayApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send( - [msg], - ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([msg]); final List? pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { @@ -1731,8 +1808,7 @@ class VideoPlayerAvplayApi { } Future getData( - DashPropertyTypeListMessage msg, - ) async { + DashPropertyTypeListMessage msg) async { final String pigeonVar_channelName = 'dev.flutter.pigeon.video_player_avplay.VideoPlayerAvplayApi.getData$pigeonVar_messageChannelSuffix'; final BasicMessageChannel pigeonVar_channel = @@ -1741,9 +1817,8 @@ class VideoPlayerAvplayApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send( - [msg], - ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([msg]); final List? pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { @@ -1773,9 +1848,8 @@ class VideoPlayerAvplayApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send( - [playerId, dashToken], - ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([playerId, dashToken]); final List? pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { @@ -1805,9 +1879,8 @@ class VideoPlayerAvplayApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send( - [msg], - ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([msg]); final List? pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { diff --git a/packages/video_player_avplay/lib/src/video_player_tizen.dart b/packages/video_player_avplay/lib/src/video_player_tizen.dart index 6114b2a61..5df865ef4 100644 --- a/packages/video_player_avplay/lib/src/video_player_tizen.dart +++ b/packages/video_player_avplay/lib/src/video_player_tizen.dart @@ -5,6 +5,7 @@ import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart'; +import 'package:tizen_window_manager/tizen_window_manager.dart'; import '../video_player_platform_interface.dart'; import 'messages.g.dart'; @@ -52,10 +53,26 @@ class VideoPlayerTizen extends VideoPlayerPlatform { message.uri = dataSource.uri; } + message.windowGeometry = await _getWindowGeometry(); + final PlayerMessage response = await _api.create(message); return response.playerId; } + Future?> _getWindowGeometry() async { + try { + final Map geometry = await WindowManager.getGeometry(); + return { + 'x': geometry['x'] ?? 0, + 'y': geometry['y'] ?? 0, + 'width': geometry['width'] ?? 0, + 'height': geometry['height'] ?? 0, + }; + } catch (e) { + return null; + } + } + @override Future setLooping(int playerId, bool looping) { return _api.setLooping( @@ -262,7 +279,7 @@ class VideoPlayerTizen extends VideoPlayerPlatform { int playerId, { DataSource? dataSource, int resumeTime = -1, - }) { + }) async { final CreateMessage message = CreateMessage(); if (dataSource != null) { @@ -290,6 +307,8 @@ class VideoPlayerTizen extends VideoPlayerPlatform { } } + message.windowGeometry = await _getWindowGeometry(); + return _api.restore(playerId, message, resumeTime); } diff --git a/packages/video_player_avplay/pigeons/messages.dart b/packages/video_player_avplay/pigeons/messages.dart index 8d22cd469..d383f14ad 100644 --- a/packages/video_player_avplay/pigeons/messages.dart +++ b/packages/video_player_avplay/pigeons/messages.dart @@ -70,6 +70,7 @@ class CreateMessage { Map? drmConfigs; Map? playerOptions; Map? streamingProperty; + Map? windowGeometry; } class MixWithOthersMessage { diff --git a/packages/video_player_avplay/pubspec.yaml b/packages/video_player_avplay/pubspec.yaml index b7abb29a2..4e5554ddc 100644 --- a/packages/video_player_avplay/pubspec.yaml +++ b/packages/video_player_avplay/pubspec.yaml @@ -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/main/packages/video_player_avplay -version: 0.8.17 +version: 0.8.18 environment: sdk: ">=3.1.0 <4.0.0" @@ -22,6 +22,7 @@ dependencies: flutter_tizen: ^0.2.4 html: ^0.15.0 plugin_platform_interface: ^2.1.0 + tizen_window_manager: ^0.2.0 dev_dependencies: flutter_test: diff --git a/packages/video_player_avplay/tizen/src/ecore_wl2_window_proxy.cc b/packages/video_player_avplay/tizen/src/ecore_wl2_window_proxy.cc deleted file mode 100644 index ea6f0ef98..000000000 --- a/packages/video_player_avplay/tizen/src/ecore_wl2_window_proxy.cc +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2023 Samsung Electronics Co., Ltd. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ecore_wl2_window_proxy.h" - -#include - -#include "log.h" - -typedef void (*FuncEcoreWl2WindowGeometryGet)(void *window, int *x, int *y, - int *width, int *height); - -EcoreWl2WindowProxy::EcoreWl2WindowProxy() { - ecore_wl2_window_handle_ = dlopen("libecore_wl2.so.1", RTLD_LAZY); - if (ecore_wl2_window_handle_ == nullptr) { - LOG_ERROR("Failed to open ecore wl2."); - } -} - -void EcoreWl2WindowProxy::ecore_wl2_window_geometry_get(void *window, int *x, - int *y, int *width, - int *height) { - if (!ecore_wl2_window_handle_) { - LOG_ERROR("ecore_wl2_window_handle_ not valid"); - return; - } - - FuncEcoreWl2WindowGeometryGet ecore_wl2_window_geometry_get = - reinterpret_cast( - dlsym(ecore_wl2_window_handle_, "ecore_wl2_window_geometry_get")); - if (!ecore_wl2_window_geometry_get) { - LOG_ERROR("Fail to find ecore_wl2_window_geometry_get."); - return; - } - ecore_wl2_window_geometry_get(window, x, y, width, height); -} - -EcoreWl2WindowProxy::~EcoreWl2WindowProxy() { - if (ecore_wl2_window_handle_) { - dlclose(ecore_wl2_window_handle_); - ecore_wl2_window_handle_ = nullptr; - } -} diff --git a/packages/video_player_avplay/tizen/src/ecore_wl2_window_proxy.h b/packages/video_player_avplay/tizen/src/ecore_wl2_window_proxy.h deleted file mode 100644 index f8545a457..000000000 --- a/packages/video_player_avplay/tizen/src/ecore_wl2_window_proxy.h +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2022 Samsung Electronics Co., Ltd. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef FLUTTER_PLUGIN_ECORE_WL2_WINDOW_PROXY_H_ -#define FLUTTER_PLUGIN_ECORE_WL2_WINDOW_PROXY_H_ - -class EcoreWl2WindowProxy { - public: - EcoreWl2WindowProxy(); - ~EcoreWl2WindowProxy(); - void ecore_wl2_window_geometry_get(void *window, int *x, int *y, int *width, - int *height); - - private: - void *ecore_wl2_window_handle_ = nullptr; -}; - -#endif // FLUTTER_PLUGIN_ECORE_WL2_WINDOW_PROXY_H_ diff --git a/packages/video_player_avplay/tizen/src/media_player.cc b/packages/video_player_avplay/tizen/src/media_player.cc index d819e0405..bd11f7536 100644 --- a/packages/video_player_avplay/tizen/src/media_player.cc +++ b/packages/video_player_avplay/tizen/src/media_player.cc @@ -132,7 +132,7 @@ int64_t MediaPlayer::Create(const std::string &uri, } } - if (!SetDisplay()) { + if (!SetDisplay(create_message.window_geometry())) { LOG_ERROR("[MediaPlayer] Failed to set display."); return -1; } @@ -418,16 +418,31 @@ bool MediaPlayer::IsReady() { return PLAYER_STATE_READY == state; } -bool MediaPlayer::SetDisplay() { +bool MediaPlayer::SetDisplay(const flutter::EncodableMap *window_geometry) { + if (!window_geometry) { + LOG_ERROR("[MediaPlayer] window_geometry is null."); + return false; + } + void *native_window = GetWindowHandle(); if (!native_window) { LOG_ERROR("[MediaPlayer] Could not get a native window handle."); return false; } - int x = 0, y = 0, width = 0, height = 0; - ecore_wl2_window_proxy_->ecore_wl2_window_geometry_get(native_window, &x, &y, - &width, &height); + int64_t x = flutter_common::GetValue(window_geometry, "x", (int64_t)0); + int64_t y = flutter_common::GetValue(window_geometry, "y", (int64_t)0); + int64_t width = + flutter_common::GetValue(window_geometry, "width", (int64_t)0); + int64_t height = + flutter_common::GetValue(window_geometry, "height", (int64_t)0); + + if (width <= 0 || height <= 0) { + LOG_ERROR("[MediaPlayer] Invalid window geometry: width=%d, height=%d.", + width, height); + return false; + } + int ret = media_player_proxy_->player_set_ecore_wl_display( player_, PLAYER_DISPLAY_TYPE_OVERLAY, native_window, x, y, width, height); if (ret != PLAYER_ERROR_NONE) { diff --git a/packages/video_player_avplay/tizen/src/media_player.h b/packages/video_player_avplay/tizen/src/media_player.h index fec64e3e7..a7d4a71d6 100644 --- a/packages/video_player_avplay/tizen/src/media_player.h +++ b/packages/video_player_avplay/tizen/src/media_player.h @@ -51,7 +51,7 @@ class MediaPlayer : public VideoPlayer { private: bool IsLive(); std::pair GetLiveDuration(); - bool SetDisplay(); + bool SetDisplay(const flutter::EncodableMap *window_geometry); bool SetDrm(const std::string &uri, int drm_type, const std::string &license_server_url); bool StopAndDestroy(); diff --git a/packages/video_player_avplay/tizen/src/messages.cc b/packages/video_player_avplay/tizen/src/messages.cc index 123fa4d5e..bd3ef8700 100644 --- a/packages/video_player_avplay/tizen/src/messages.cc +++ b/packages/video_player_avplay/tizen/src/messages.cc @@ -277,7 +277,8 @@ CreateMessage::CreateMessage(const std::string* asset, const std::string* uri, const EncodableMap* http_headers, const EncodableMap* drm_configs, const EncodableMap* player_options, - const EncodableMap* streaming_property) + const EncodableMap* streaming_property, + const EncodableMap* window_geometry) : asset_(asset ? std::optional(*asset) : std::nullopt), uri_(uri ? std::optional(*uri) : std::nullopt), package_name_(package_name ? std::optional(*package_name) @@ -293,7 +294,10 @@ CreateMessage::CreateMessage(const std::string* asset, const std::string* uri, : std::nullopt), streaming_property_(streaming_property ? std::optional(*streaming_property) - : std::nullopt) {} + : std::nullopt), + window_geometry_(window_geometry + ? std::optional(*window_geometry) + : std::nullopt) {} const std::string* CreateMessage::asset() const { return asset_ ? &(*asset_) : nullptr; @@ -395,9 +399,22 @@ void CreateMessage::set_streaming_property(const EncodableMap& value_arg) { streaming_property_ = value_arg; } +const EncodableMap* CreateMessage::window_geometry() const { + return window_geometry_ ? &(*window_geometry_) : nullptr; +} + +void CreateMessage::set_window_geometry(const EncodableMap* value_arg) { + window_geometry_ = + value_arg ? std::optional(*value_arg) : std::nullopt; +} + +void CreateMessage::set_window_geometry(const EncodableMap& value_arg) { + window_geometry_ = value_arg; +} + EncodableList CreateMessage::ToEncodableList() const { EncodableList list; - list.reserve(8); + list.reserve(9); list.push_back(asset_ ? EncodableValue(*asset_) : EncodableValue()); list.push_back(uri_ ? EncodableValue(*uri_) : EncodableValue()); list.push_back(package_name_ ? EncodableValue(*package_name_) @@ -412,6 +429,8 @@ EncodableList CreateMessage::ToEncodableList() const { : EncodableValue()); list.push_back(streaming_property_ ? EncodableValue(*streaming_property_) : EncodableValue()); + list.push_back(window_geometry_ ? EncodableValue(*window_geometry_) + : EncodableValue()); return list; } @@ -451,6 +470,11 @@ CreateMessage CreateMessage::FromEncodableList(const EncodableList& list) { decoded.set_streaming_property( std::get(encodable_streaming_property)); } + auto& encodable_window_geometry = list[8]; + if (!encodable_window_geometry.IsNull()) { + decoded.set_window_geometry( + std::get(encodable_window_geometry)); + } return decoded; } diff --git a/packages/video_player_avplay/tizen/src/messages.h b/packages/video_player_avplay/tizen/src/messages.h index 24505f632..c6a12ef99 100644 --- a/packages/video_player_avplay/tizen/src/messages.h +++ b/packages/video_player_avplay/tizen/src/messages.h @@ -240,7 +240,8 @@ class CreateMessage { const flutter::EncodableMap* http_headers, const flutter::EncodableMap* drm_configs, const flutter::EncodableMap* player_options, - const flutter::EncodableMap* streaming_property); + const flutter::EncodableMap* streaming_property, + const flutter::EncodableMap* window_geometry); const std::string* asset() const; void set_asset(const std::string_view* value_arg); @@ -274,6 +275,10 @@ class CreateMessage { void set_streaming_property(const flutter::EncodableMap* value_arg); void set_streaming_property(const flutter::EncodableMap& value_arg); + const flutter::EncodableMap* window_geometry() const; + void set_window_geometry(const flutter::EncodableMap* value_arg); + void set_window_geometry(const flutter::EncodableMap& value_arg); + private: static CreateMessage FromEncodableList(const flutter::EncodableList& list); flutter::EncodableList ToEncodableList() const; @@ -287,6 +292,7 @@ class CreateMessage { std::optional drm_configs_; std::optional player_options_; std::optional streaming_property_; + std::optional window_geometry_; }; // Generated class from Pigeon that represents data sent in messages. diff --git a/packages/video_player_avplay/tizen/src/plus_player.cc b/packages/video_player_avplay/tizen/src/plus_player.cc index 152a5dc55..43be1db01 100644 --- a/packages/video_player_avplay/tizen/src/plus_player.cc +++ b/packages/video_player_avplay/tizen/src/plus_player.cc @@ -162,7 +162,7 @@ int64_t PlusPlayer::Create(const std::string &uri, } } - if (!SetDisplay()) { + if (!SetDisplay(create_message.window_geometry())) { LOG_ERROR("[PlusPlayer] Fail to set display."); return -1; } @@ -425,15 +425,30 @@ bool PlusPlayer::IsReady() { return plusplayer::State::kReady == GetState(player_); } -bool PlusPlayer::SetDisplay() { +bool PlusPlayer::SetDisplay(const flutter::EncodableMap *window_geometry) { + if (!window_geometry) { + LOG_ERROR("[PlusPlayer] window_geometry is null."); + return false; + } + void *native_window = GetWindowHandle(); if (!native_window) { LOG_ERROR("[PlusPlayer] Could not get a native window handle."); return false; } - int x = 0, y = 0, width = 0, height = 0; - ecore_wl2_window_proxy_->ecore_wl2_window_geometry_get(native_window, &x, &y, - &width, &height); + int64_t x = flutter_common::GetValue(window_geometry, "x", (int64_t)0); + int64_t y = flutter_common::GetValue(window_geometry, "y", (int64_t)0); + int64_t width = + flutter_common::GetValue(window_geometry, "width", (int64_t)0); + int64_t height = + flutter_common::GetValue(window_geometry, "height", (int64_t)0); + + if (width <= 0 || height <= 0) { + LOG_ERROR("[PlusPlayer] Invalid window geometry: width=%d, height=%d.", + width, height); + return false; + } + uint32_t resource_id = FlutterDesktopViewGetResourceId(flutter_view_); if (resource_id == 0) { LOG_ERROR("[PlusPlayer] Fail to get resource id."); diff --git a/packages/video_player_avplay/tizen/src/plus_player.h b/packages/video_player_avplay/tizen/src/plus_player.h index 265cfa71e..a510c1334 100644 --- a/packages/video_player_avplay/tizen/src/plus_player.h +++ b/packages/video_player_avplay/tizen/src/plus_player.h @@ -62,7 +62,7 @@ class PlusPlayer : public VideoPlayer { private: bool IsLive(); std::pair GetLiveDuration(); - bool SetDisplay(); + bool SetDisplay(const flutter::EncodableMap *window_geometry); bool SetDrm(const std::string &uri, int drm_type, const std::string &license_server_url); flutter::EncodableValue ParseVideoTrack(plusplayer::Track video_track); diff --git a/packages/video_player_avplay/tizen/src/video_player.cc b/packages/video_player_avplay/tizen/src/video_player.cc index da1ad5326..de6cbec1e 100644 --- a/packages/video_player_avplay/tizen/src/video_player.cc +++ b/packages/video_player_avplay/tizen/src/video_player.cc @@ -15,9 +15,7 @@ static int64_t player_index = 1; VideoPlayer::VideoPlayer(flutter::BinaryMessenger *messenger, FlutterDesktopViewRef flutter_view) - : ecore_wl2_window_proxy_(std::make_unique()), - binary_messenger_(messenger), - flutter_view_(flutter_view) { + : binary_messenger_(messenger), flutter_view_(flutter_view) { sink_event_pipe_ = ecore_pipe_add( [](void *data, void *buffer, unsigned int nbyte) -> void { auto *self = static_cast(data); diff --git a/packages/video_player_avplay/tizen/src/video_player.h b/packages/video_player_avplay/tizen/src/video_player.h index a3f9aa053..a9a89308e 100644 --- a/packages/video_player_avplay/tizen/src/video_player.h +++ b/packages/video_player_avplay/tizen/src/video_player.h @@ -16,7 +16,6 @@ #include #include -#include "ecore_wl2_window_proxy.h" #include "messages.h" namespace video_player_avplay_tizen { @@ -94,7 +93,6 @@ class VideoPlayer { const std::string &error_message); std::mutex queue_mutex_; - std::unique_ptr ecore_wl2_window_proxy_ = nullptr; flutter::BinaryMessenger *binary_messenger_; bool is_initialized_ = false; FlutterDesktopViewRef flutter_view_;