youtube_player_flutter icon indicating copy to clipboard operation
youtube_player_flutter copied to clipboard

[BUG] Error code parsing is problematic

Open panghy opened this issue 5 months ago • 0 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Package

youtube_player_flutter

What happened?

The current code in raw_youtube_player.dart (line 189) could fail if args actually contains int (as int.parse will throw is it's already an int). This prevents us from trapping any player errors.

[JavaScript Handler "Errors"] type 'int' is not a subtype of type 'String'
#0      _RawYoutubePlayerState.build.<anonymous closure>.<anonymous closure> (package:youtube_player_flutter/src/player/raw_youtube_player.dart:189:72)
#1      IOSInAppWebViewController._handleMethod (package:flutter_inappwebview_ios/src/in_app_webview/in_app_webview_controller.dart:1538:73)
#2      InternalChannelController.initMethodCallHandler.<anonymous closure> (package:flutter_inappwebview_platform_interface/src/util.dart:631:30)
#3      MethodChannel._handleAsMethodCall (package:flutter/src/services/platform_channel.dart:571:55)
#4      MethodChannel.setMethodCallHandler.<anonymous closure> (package:flutter/src/services/platform_channel.dart:564:34)
#5      _DefaultBinaryMessenger.setMessageHandler.<anonymous closure> (package:flutter/src/services/binding.dart:581:35)
#6      _invoke2 (dart:ui/hooks.dart:344:13)
#7      _ChannelCallbackRecord.invoke (dart:ui/channel_buffers.dart:45:5)

What is the expected behaviour?

The code should not fault if args already contains ints and not strings.

How to reproduce?

Try to play a video that is region blocked or no longer available.

Flutter Doctor Output

No response

panghy avatar Sep 12 '24 19:09 panghy