diff --git a/packages/video_player/CHANGELOG.md b/packages/video_player/CHANGELOG.md index 6424d1d42..d9376a3aa 100644 --- a/packages/video_player/CHANGELOG.md +++ b/packages/video_player/CHANGELOG.md @@ -1,3 +1,8 @@ +## 2.5.1 + +* Update pigeon to 22.3.0. +* Temporarily set duration to 1, if duration is 0. + ## 2.5.0 * Update video_player to 2.9.1. diff --git a/packages/video_player/README.md b/packages/video_player/README.md index b426e5e10..ca0acd386 100644 --- a/packages/video_player/README.md +++ b/packages/video_player/README.md @@ -15,7 +15,7 @@ This package is not an _endorsed_ implementation of `video_player`. Therefore, y ```yaml dependencies: video_player: ^2.9.1 - video_player_tizen: ^2.5.0 + video_player_tizen: ^2.5.1 ``` Then you can import `video_player` in your Dart code: diff --git a/packages/video_player/lib/src/messages.g.dart b/packages/video_player/lib/src/messages.g.dart index 34bead95c..1ee8ce7e5 100644 --- a/packages/video_player/lib/src/messages.g.dart +++ b/packages/video_player/lib/src/messages.g.dart @@ -1,6 +1,6 @@ -// Autogenerated from Pigeon (v10.0.0), do not edit directly. +// Autogenerated from Pigeon (v22.3.0), do not edit directly. // See also: https://pub.dev/packages/pigeon -// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import +// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers import 'dart:async'; import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; @@ -8,6 +8,13 @@ import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer; import 'package:flutter/services.dart'; +PlatformException _createConnectionError(String channelName) { + return PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel: "$channelName".', + ); +} + class TextureMessage { TextureMessage({ required this.textureId, @@ -196,31 +203,34 @@ class MixWithOthersMessage { } } -class _TizenVideoPlayerApiCodec extends StandardMessageCodec { - const _TizenVideoPlayerApiCodec(); +class _PigeonCodec extends StandardMessageCodec { + const _PigeonCodec(); @override void writeValue(WriteBuffer buffer, Object? value) { - if (value is CreateMessage) { - buffer.putUint8(128); - writeValue(buffer, value.encode()); - } else if (value is LoopingMessage) { + if (value is int) { + buffer.putUint8(4); + buffer.putInt64(value); + } else if (value is TextureMessage) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else if (value is MixWithOthersMessage) { + } else if (value is LoopingMessage) { buffer.putUint8(130); writeValue(buffer, value.encode()); - } else if (value is PlaybackSpeedMessage) { + } else if (value is VolumeMessage) { buffer.putUint8(131); writeValue(buffer, value.encode()); - } else if (value is PositionMessage) { + } else if (value is PlaybackSpeedMessage) { buffer.putUint8(132); writeValue(buffer, value.encode()); - } else if (value is TextureMessage) { + } else if (value is PositionMessage) { buffer.putUint8(133); writeValue(buffer, value.encode()); - } else if (value is VolumeMessage) { + } else if (value is CreateMessage) { buffer.putUint8(134); writeValue(buffer, value.encode()); + } else if (value is MixWithOthersMessage) { + buffer.putUint8(135); + writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); } @@ -229,20 +239,20 @@ class _TizenVideoPlayerApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: - return CreateMessage.decode(readValue(buffer)!); case 129: - return LoopingMessage.decode(readValue(buffer)!); + return TextureMessage.decode(readValue(buffer)!); case 130: - return MixWithOthersMessage.decode(readValue(buffer)!); + return LoopingMessage.decode(readValue(buffer)!); case 131: - return PlaybackSpeedMessage.decode(readValue(buffer)!); + return VolumeMessage.decode(readValue(buffer)!); case 132: - return PositionMessage.decode(readValue(buffer)!); + return PlaybackSpeedMessage.decode(readValue(buffer)!); case 133: - return TextureMessage.decode(readValue(buffer)!); + return PositionMessage.decode(readValue(buffer)!); case 134: - return VolumeMessage.decode(readValue(buffer)!); + return CreateMessage.decode(readValue(buffer)!); + case 135: + return MixWithOthersMessage.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); } @@ -253,257 +263,285 @@ class TizenVideoPlayerApi { /// Constructor for [TizenVideoPlayerApi]. 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. - TizenVideoPlayerApi({BinaryMessenger? binaryMessenger}) - : _binaryMessenger = binaryMessenger; - final BinaryMessenger? _binaryMessenger; + TizenVideoPlayerApi( + {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) + : pigeonVar_binaryMessenger = binaryMessenger, + pigeonVar_messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + final BinaryMessenger? pigeonVar_binaryMessenger; - static const MessageCodec codec = _TizenVideoPlayerApiCodec(); + static const MessageCodec pigeonChannelCodec = _PigeonCodec(); + + final String pigeonVar_messageChannelSuffix; Future initialize() async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.TizenVideoPlayerApi.initialize', codec, - binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send(null) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.video_player_tizen.TizenVideoPlayerApi.initialize$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send(null) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); } else { return; } } - Future create(CreateMessage arg_msg) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.TizenVideoPlayerApi.create', codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_msg]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + Future create(CreateMessage msg) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.video_player_tizen.TizenVideoPlayerApi.create$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send([msg]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); - } else if (replyList[0] == null) { + } else if (pigeonVar_replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (replyList[0] as TextureMessage?)!; + return (pigeonVar_replyList[0] as TextureMessage?)!; } } - Future dispose(TextureMessage arg_msg) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.TizenVideoPlayerApi.dispose', codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_msg]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + Future dispose(TextureMessage msg) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.video_player_tizen.TizenVideoPlayerApi.dispose$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send([msg]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); } else { return; } } - Future setLooping(LoopingMessage arg_msg) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.TizenVideoPlayerApi.setLooping', codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_msg]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + Future setLooping(LoopingMessage msg) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.video_player_tizen.TizenVideoPlayerApi.setLooping$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send([msg]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); } else { return; } } - Future setVolume(VolumeMessage arg_msg) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.TizenVideoPlayerApi.setVolume', codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_msg]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + Future setVolume(VolumeMessage msg) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.video_player_tizen.TizenVideoPlayerApi.setVolume$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send([msg]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); } else { return; } } - Future setPlaybackSpeed(PlaybackSpeedMessage arg_msg) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.TizenVideoPlayerApi.setPlaybackSpeed', codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_msg]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + Future setPlaybackSpeed(PlaybackSpeedMessage msg) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.video_player_tizen.TizenVideoPlayerApi.setPlaybackSpeed$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send([msg]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); } else { return; } } - Future play(TextureMessage arg_msg) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.TizenVideoPlayerApi.play', codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_msg]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + Future play(TextureMessage msg) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.video_player_tizen.TizenVideoPlayerApi.play$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send([msg]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); } else { return; } } - Future position(TextureMessage arg_msg) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.TizenVideoPlayerApi.position', codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_msg]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + Future position(TextureMessage msg) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.video_player_tizen.TizenVideoPlayerApi.position$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send([msg]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); - } else if (replyList[0] == null) { + } else if (pigeonVar_replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (replyList[0] as PositionMessage?)!; + return (pigeonVar_replyList[0] as PositionMessage?)!; } } - Future seekTo(PositionMessage arg_msg) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.TizenVideoPlayerApi.seekTo', codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_msg]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + Future seekTo(PositionMessage msg) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.video_player_tizen.TizenVideoPlayerApi.seekTo$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send([msg]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); } else { return; } } - Future pause(TextureMessage arg_msg) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.TizenVideoPlayerApi.pause', codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_msg]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + Future pause(TextureMessage msg) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.video_player_tizen.TizenVideoPlayerApi.pause$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send([msg]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); } else { return; } } - Future setMixWithOthers(MixWithOthersMessage arg_msg) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.TizenVideoPlayerApi.setMixWithOthers', codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_msg]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + Future setMixWithOthers(MixWithOthersMessage msg) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.video_player_tizen.TizenVideoPlayerApi.setMixWithOthers$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send([msg]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); } else { return; diff --git a/packages/video_player/pubspec.yaml b/packages/video_player/pubspec.yaml index 6c9a54f41..2eec82c41 100644 --- a/packages/video_player/pubspec.yaml +++ b/packages/video_player/pubspec.yaml @@ -2,7 +2,7 @@ name: video_player_tizen description: Tizen implementation of the video_player plugin. homepage: https://github.com/flutter-tizen/plugins repository: https://github.com/flutter-tizen/plugins/tree/master/packages/video_player -version: 2.5.0 +version: 2.5.1 environment: sdk: ">=3.3.0 <4.0.0" @@ -22,4 +22,4 @@ dependencies: video_player_platform_interface: ^6.2.0 dev_dependencies: - pigeon: ^10.0.0 + pigeon: ^22.3.0 diff --git a/packages/video_player/tizen/src/messages.cc b/packages/video_player/tizen/src/messages.cc index 67e9c4c44..588f37ae8 100644 --- a/packages/video_player/tizen/src/messages.cc +++ b/packages/video_player/tizen/src/messages.cc @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v10.0.0), do not edit directly. +// Autogenerated from Pigeon (v22.3.0), do not edit directly. // See also: https://pub.dev/packages/pigeon #undef _HAS_EXCEPTIONS @@ -20,6 +20,13 @@ using flutter::EncodableList; using flutter::EncodableMap; using flutter::EncodableValue; +FlutterError CreateConnectionError(const std::string channel_name) { + return FlutterError( + "channel-error", + "Unable to establish connection on channel: '" + channel_name + "'.", + EncodableValue("")); +} + // TextureMessage TextureMessage::TextureMessage(int64_t texture_id) : texture_id_(texture_id) {} @@ -38,7 +45,7 @@ EncodableList TextureMessage::ToEncodableList() const { } TextureMessage TextureMessage::FromEncodableList(const EncodableList& list) { - TextureMessage decoded(list[0].LongValue()); + TextureMessage decoded(std::get(list[0])); return decoded; } @@ -66,7 +73,7 @@ EncodableList LoopingMessage::ToEncodableList() const { } LoopingMessage LoopingMessage::FromEncodableList(const EncodableList& list) { - LoopingMessage decoded(list[0].LongValue(), std::get(list[1])); + LoopingMessage decoded(std::get(list[0]), std::get(list[1])); return decoded; } @@ -94,7 +101,7 @@ EncodableList VolumeMessage::ToEncodableList() const { } VolumeMessage VolumeMessage::FromEncodableList(const EncodableList& list) { - VolumeMessage decoded(list[0].LongValue(), std::get(list[1])); + VolumeMessage decoded(std::get(list[0]), std::get(list[1])); return decoded; } @@ -123,7 +130,8 @@ EncodableList PlaybackSpeedMessage::ToEncodableList() const { PlaybackSpeedMessage PlaybackSpeedMessage::FromEncodableList( const EncodableList& list) { - PlaybackSpeedMessage decoded(list[0].LongValue(), std::get(list[1])); + PlaybackSpeedMessage decoded(std::get(list[0]), + std::get(list[1])); return decoded; } @@ -151,7 +159,8 @@ EncodableList PositionMessage::ToEncodableList() const { } PositionMessage PositionMessage::FromEncodableList(const EncodableList& list) { - PositionMessage decoded(list[0].LongValue(), list[1].LongValue()); + PositionMessage decoded(std::get(list[0]), + std::get(list[1])); return decoded; } @@ -286,67 +295,74 @@ MixWithOthersMessage MixWithOthersMessage::FromEncodableList( return decoded; } -TizenVideoPlayerApiCodecSerializer::TizenVideoPlayerApiCodecSerializer() {} +PigeonInternalCodecSerializer::PigeonInternalCodecSerializer() {} -EncodableValue TizenVideoPlayerApiCodecSerializer::ReadValueOfType( +EncodableValue PigeonInternalCodecSerializer::ReadValueOfType( uint8_t type, flutter::ByteStreamReader* stream) const { switch (type) { - case 128: - return CustomEncodableValue(CreateMessage::FromEncodableList( + case 129: { + return CustomEncodableValue(TextureMessage::FromEncodableList( std::get(ReadValue(stream)))); - case 129: + } + case 130: { return CustomEncodableValue(LoopingMessage::FromEncodableList( std::get(ReadValue(stream)))); - case 130: - return CustomEncodableValue(MixWithOthersMessage::FromEncodableList( + } + case 131: { + return CustomEncodableValue(VolumeMessage::FromEncodableList( std::get(ReadValue(stream)))); - case 131: + } + case 132: { return CustomEncodableValue(PlaybackSpeedMessage::FromEncodableList( std::get(ReadValue(stream)))); - case 132: + } + case 133: { return CustomEncodableValue(PositionMessage::FromEncodableList( std::get(ReadValue(stream)))); - case 133: - return CustomEncodableValue(TextureMessage::FromEncodableList( + } + case 134: { + return CustomEncodableValue(CreateMessage::FromEncodableList( std::get(ReadValue(stream)))); - case 134: - return CustomEncodableValue(VolumeMessage::FromEncodableList( + } + case 135: { + return CustomEncodableValue(MixWithOthersMessage::FromEncodableList( std::get(ReadValue(stream)))); + } default: return flutter::StandardCodecSerializer::ReadValueOfType(type, stream); } } -void TizenVideoPlayerApiCodecSerializer::WriteValue( +void PigeonInternalCodecSerializer::WriteValue( const EncodableValue& value, flutter::ByteStreamWriter* stream) const { if (const CustomEncodableValue* custom_value = std::get_if(&value)) { - if (custom_value->type() == typeid(CreateMessage)) { - stream->WriteByte(128); + if (custom_value->type() == typeid(TextureMessage)) { + stream->WriteByte(129); WriteValue( EncodableValue( - std::any_cast(*custom_value).ToEncodableList()), + std::any_cast(*custom_value).ToEncodableList()), stream); return; } if (custom_value->type() == typeid(LoopingMessage)) { - stream->WriteByte(129); + stream->WriteByte(130); WriteValue( EncodableValue( std::any_cast(*custom_value).ToEncodableList()), stream); return; } - if (custom_value->type() == typeid(MixWithOthersMessage)) { - stream->WriteByte(130); + if (custom_value->type() == typeid(VolumeMessage)) { + stream->WriteByte(131); WriteValue( - EncodableValue(std::any_cast(*custom_value) - .ToEncodableList()), + EncodableValue( + std::any_cast(*custom_value).ToEncodableList()), stream); return; } if (custom_value->type() == typeid(PlaybackSpeedMessage)) { - stream->WriteByte(131); + stream->WriteByte(132); WriteValue( EncodableValue(std::any_cast(*custom_value) .ToEncodableList()), @@ -354,26 +370,26 @@ void TizenVideoPlayerApiCodecSerializer::WriteValue( return; } if (custom_value->type() == typeid(PositionMessage)) { - stream->WriteByte(132); + stream->WriteByte(133); WriteValue( EncodableValue( std::any_cast(*custom_value).ToEncodableList()), stream); return; } - if (custom_value->type() == typeid(TextureMessage)) { - stream->WriteByte(133); + if (custom_value->type() == typeid(CreateMessage)) { + stream->WriteByte(134); WriteValue( EncodableValue( - std::any_cast(*custom_value).ToEncodableList()), + std::any_cast(*custom_value).ToEncodableList()), stream); return; } - if (custom_value->type() == typeid(VolumeMessage)) { - stream->WriteByte(134); + if (custom_value->type() == typeid(MixWithOthersMessage)) { + stream->WriteByte(135); WriteValue( - EncodableValue( - std::any_cast(*custom_value).ToEncodableList()), + EncodableValue(std::any_cast(*custom_value) + .ToEncodableList()), stream); return; } @@ -384,19 +400,31 @@ void TizenVideoPlayerApiCodecSerializer::WriteValue( /// The codec used by TizenVideoPlayerApi. const flutter::StandardMessageCodec& TizenVideoPlayerApi::GetCodec() { return flutter::StandardMessageCodec::GetInstance( - &TizenVideoPlayerApiCodecSerializer::GetInstance()); + &PigeonInternalCodecSerializer::GetInstance()); } // Sets up an instance of `TizenVideoPlayerApi` to handle messages through the // `binary_messenger`. void TizenVideoPlayerApi::SetUp(flutter::BinaryMessenger* binary_messenger, TizenVideoPlayerApi* api) { + TizenVideoPlayerApi::SetUp(binary_messenger, api, ""); +} + +void TizenVideoPlayerApi::SetUp(flutter::BinaryMessenger* binary_messenger, + TizenVideoPlayerApi* api, + const std::string& message_channel_suffix) { + const std::string prepended_suffix = + message_channel_suffix.length() > 0 + ? std::string(".") + message_channel_suffix + : ""; { - auto channel = std::make_unique>( - binary_messenger, "dev.flutter.pigeon.TizenVideoPlayerApi.initialize", + BasicMessageChannel<> channel( + binary_messenger, + "dev.flutter.pigeon.video_player_tizen.TizenVideoPlayerApi.initialize" + + prepended_suffix, &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler( + channel.SetMessageHandler( [api](const EncodableValue& message, const flutter::MessageReply& reply) { try { @@ -413,15 +441,17 @@ void TizenVideoPlayerApi::SetUp(flutter::BinaryMessenger* binary_messenger, } }); } else { - channel->SetMessageHandler(nullptr); + channel.SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>( - binary_messenger, "dev.flutter.pigeon.TizenVideoPlayerApi.create", + BasicMessageChannel<> channel( + binary_messenger, + "dev.flutter.pigeon.video_player_tizen.TizenVideoPlayerApi.create" + + prepended_suffix, &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler( + channel.SetMessageHandler( [api](const EncodableValue& message, const flutter::MessageReply& reply) { try { @@ -447,15 +477,17 @@ void TizenVideoPlayerApi::SetUp(flutter::BinaryMessenger* binary_messenger, } }); } else { - channel->SetMessageHandler(nullptr); + channel.SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>( - binary_messenger, "dev.flutter.pigeon.TizenVideoPlayerApi.dispose", + BasicMessageChannel<> channel( + binary_messenger, + "dev.flutter.pigeon.video_player_tizen.TizenVideoPlayerApi.dispose" + + prepended_suffix, &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler( + channel.SetMessageHandler( [api](const EncodableValue& message, const flutter::MessageReply& reply) { try { @@ -480,15 +512,17 @@ void TizenVideoPlayerApi::SetUp(flutter::BinaryMessenger* binary_messenger, } }); } else { - channel->SetMessageHandler(nullptr); + channel.SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>( - binary_messenger, "dev.flutter.pigeon.TizenVideoPlayerApi.setLooping", + BasicMessageChannel<> channel( + binary_messenger, + "dev.flutter.pigeon.video_player_tizen.TizenVideoPlayerApi.setLooping" + + prepended_suffix, &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler( + channel.SetMessageHandler( [api](const EncodableValue& message, const flutter::MessageReply& reply) { try { @@ -513,15 +547,17 @@ void TizenVideoPlayerApi::SetUp(flutter::BinaryMessenger* binary_messenger, } }); } else { - channel->SetMessageHandler(nullptr); + channel.SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>( - binary_messenger, "dev.flutter.pigeon.TizenVideoPlayerApi.setVolume", + BasicMessageChannel<> channel( + binary_messenger, + "dev.flutter.pigeon.video_player_tizen.TizenVideoPlayerApi.setVolume" + + prepended_suffix, &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler( + channel.SetMessageHandler( [api](const EncodableValue& message, const flutter::MessageReply& reply) { try { @@ -546,15 +582,17 @@ void TizenVideoPlayerApi::SetUp(flutter::BinaryMessenger* binary_messenger, } }); } else { - channel->SetMessageHandler(nullptr); + channel.SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>( - binary_messenger, - "dev.flutter.pigeon.TizenVideoPlayerApi.setPlaybackSpeed", &GetCodec()); + BasicMessageChannel<> channel(binary_messenger, + "dev.flutter.pigeon.video_player_tizen." + "TizenVideoPlayerApi.setPlaybackSpeed" + + prepended_suffix, + &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler( + channel.SetMessageHandler( [api](const EncodableValue& message, const flutter::MessageReply& reply) { try { @@ -580,15 +618,17 @@ void TizenVideoPlayerApi::SetUp(flutter::BinaryMessenger* binary_messenger, } }); } else { - channel->SetMessageHandler(nullptr); + channel.SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>( - binary_messenger, "dev.flutter.pigeon.TizenVideoPlayerApi.play", + BasicMessageChannel<> channel( + binary_messenger, + "dev.flutter.pigeon.video_player_tizen.TizenVideoPlayerApi.play" + + prepended_suffix, &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler( + channel.SetMessageHandler( [api](const EncodableValue& message, const flutter::MessageReply& reply) { try { @@ -613,15 +653,17 @@ void TizenVideoPlayerApi::SetUp(flutter::BinaryMessenger* binary_messenger, } }); } else { - channel->SetMessageHandler(nullptr); + channel.SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>( - binary_messenger, "dev.flutter.pigeon.TizenVideoPlayerApi.position", + BasicMessageChannel<> channel( + binary_messenger, + "dev.flutter.pigeon.video_player_tizen.TizenVideoPlayerApi.position" + + prepended_suffix, &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler( + channel.SetMessageHandler( [api](const EncodableValue& message, const flutter::MessageReply& reply) { try { @@ -647,15 +689,17 @@ void TizenVideoPlayerApi::SetUp(flutter::BinaryMessenger* binary_messenger, } }); } else { - channel->SetMessageHandler(nullptr); + channel.SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>( - binary_messenger, "dev.flutter.pigeon.TizenVideoPlayerApi.seekTo", + BasicMessageChannel<> channel( + binary_messenger, + "dev.flutter.pigeon.video_player_tizen.TizenVideoPlayerApi.seekTo" + + prepended_suffix, &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler( + channel.SetMessageHandler( [api](const EncodableValue& message, const flutter::MessageReply& reply) { try { @@ -682,15 +726,17 @@ void TizenVideoPlayerApi::SetUp(flutter::BinaryMessenger* binary_messenger, } }); } else { - channel->SetMessageHandler(nullptr); + channel.SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>( - binary_messenger, "dev.flutter.pigeon.TizenVideoPlayerApi.pause", + BasicMessageChannel<> channel( + binary_messenger, + "dev.flutter.pigeon.video_player_tizen.TizenVideoPlayerApi.pause" + + prepended_suffix, &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler( + channel.SetMessageHandler( [api](const EncodableValue& message, const flutter::MessageReply& reply) { try { @@ -715,15 +761,17 @@ void TizenVideoPlayerApi::SetUp(flutter::BinaryMessenger* binary_messenger, } }); } else { - channel->SetMessageHandler(nullptr); + channel.SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>( - binary_messenger, - "dev.flutter.pigeon.TizenVideoPlayerApi.setMixWithOthers", &GetCodec()); + BasicMessageChannel<> channel(binary_messenger, + "dev.flutter.pigeon.video_player_tizen." + "TizenVideoPlayerApi.setMixWithOthers" + + prepended_suffix, + &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler( + channel.SetMessageHandler( [api](const EncodableValue& message, const flutter::MessageReply& reply) { try { @@ -749,7 +797,7 @@ void TizenVideoPlayerApi::SetUp(flutter::BinaryMessenger* binary_messenger, } }); } else { - channel->SetMessageHandler(nullptr); + channel.SetMessageHandler(nullptr); } } } diff --git a/packages/video_player/tizen/src/messages.h b/packages/video_player/tizen/src/messages.h index 174dc8f9d..1df9b7a56 100644 --- a/packages/video_player/tizen/src/messages.h +++ b/packages/video_player/tizen/src/messages.h @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v10.0.0), do not edit directly. +// Autogenerated from Pigeon (v22.3.0), do not edit directly. // See also: https://pub.dev/packages/pigeon #ifndef PIGEON_MESSAGES_H_ @@ -66,7 +66,7 @@ class TextureMessage { static TextureMessage FromEncodableList(const flutter::EncodableList& list); flutter::EncodableList ToEncodableList() const; friend class TizenVideoPlayerApi; - friend class TizenVideoPlayerApiCodecSerializer; + friend class PigeonInternalCodecSerializer; int64_t texture_id_; }; @@ -86,7 +86,7 @@ class LoopingMessage { static LoopingMessage FromEncodableList(const flutter::EncodableList& list); flutter::EncodableList ToEncodableList() const; friend class TizenVideoPlayerApi; - friend class TizenVideoPlayerApiCodecSerializer; + friend class PigeonInternalCodecSerializer; int64_t texture_id_; bool is_looping_; }; @@ -107,7 +107,7 @@ class VolumeMessage { static VolumeMessage FromEncodableList(const flutter::EncodableList& list); flutter::EncodableList ToEncodableList() const; friend class TizenVideoPlayerApi; - friend class TizenVideoPlayerApiCodecSerializer; + friend class PigeonInternalCodecSerializer; int64_t texture_id_; double volume_; }; @@ -129,7 +129,7 @@ class PlaybackSpeedMessage { const flutter::EncodableList& list); flutter::EncodableList ToEncodableList() const; friend class TizenVideoPlayerApi; - friend class TizenVideoPlayerApiCodecSerializer; + friend class PigeonInternalCodecSerializer; int64_t texture_id_; double speed_; }; @@ -150,7 +150,7 @@ class PositionMessage { static PositionMessage FromEncodableList(const flutter::EncodableList& list); flutter::EncodableList ToEncodableList() const; friend class TizenVideoPlayerApi; - friend class TizenVideoPlayerApiCodecSerializer; + friend class PigeonInternalCodecSerializer; int64_t texture_id_; int64_t position_; }; @@ -190,7 +190,7 @@ class CreateMessage { static CreateMessage FromEncodableList(const flutter::EncodableList& list); flutter::EncodableList ToEncodableList() const; friend class TizenVideoPlayerApi; - friend class TizenVideoPlayerApiCodecSerializer; + friend class PigeonInternalCodecSerializer; std::optional asset_; std::optional uri_; std::optional package_name_; @@ -212,16 +212,15 @@ class MixWithOthersMessage { const flutter::EncodableList& list); flutter::EncodableList ToEncodableList() const; friend class TizenVideoPlayerApi; - friend class TizenVideoPlayerApiCodecSerializer; + friend class PigeonInternalCodecSerializer; bool mix_with_others_; }; -class TizenVideoPlayerApiCodecSerializer - : public flutter::StandardCodecSerializer { +class PigeonInternalCodecSerializer : public flutter::StandardCodecSerializer { public: - TizenVideoPlayerApiCodecSerializer(); - inline static TizenVideoPlayerApiCodecSerializer& GetInstance() { - static TizenVideoPlayerApiCodecSerializer sInstance; + PigeonInternalCodecSerializer(); + inline static PigeonInternalCodecSerializer& GetInstance() { + static PigeonInternalCodecSerializer sInstance; return sInstance; } @@ -262,6 +261,9 @@ class TizenVideoPlayerApi { // `binary_messenger`. static void SetUp(flutter::BinaryMessenger* binary_messenger, TizenVideoPlayerApi* api); + static void SetUp(flutter::BinaryMessenger* binary_messenger, + TizenVideoPlayerApi* api, + const std::string& message_channel_suffix); static flutter::EncodableValue WrapError(std::string_view error_message); static flutter::EncodableValue WrapError(const FlutterError& error); diff --git a/packages/video_player/tizen/src/video_player.cc b/packages/video_player/tizen/src/video_player.cc index b08a44838..53f3b35fe 100644 --- a/packages/video_player/tizen/src/video_player.cc +++ b/packages/video_player/tizen/src/video_player.cc @@ -465,6 +465,15 @@ void VideoPlayer::SendInitialized() { } } + // TODO(jsuya):Some streaming resources may have a duration of 0 during the + // initialization step. If the duration is 0, it may affect the progress of + // video_player and cause unnecessary errors. Therefore, set it to 1 + // temporarily. In the future, It can be updated depending on + // the loading status. + if (width != 0 && height != 0 && duration == 0) { + duration = 1; + } + is_initialized_ = true; flutter::EncodableMap result = { {flutter::EncodableValue("event"),