Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: macOS/iOS 部分视频会导致闪退 #376

Closed
2 tasks done
ErBWs opened this issue Nov 7, 2024 · 25 comments
Closed
2 tasks done

[Bug]: macOS/iOS 部分视频会导致闪退 #376

ErBWs opened this issue Nov 7, 2024 · 25 comments
Labels
bug Something isn't working

Comments

@ErBWs
Copy link
Contributor

ErBWs commented Nov 7, 2024

在使用的时候发生了什么 Bug ?

使用 akiamime 播放《想要成为影之实力者!第一季》时会闪退

您在使用哪个操作系统?

macOS / iOS

请具体提供设备、版本号等信息。

macOS 15.1, iOS 18.1

日志信息

flutter: JS Bridge: The number of iframe tags is3
flutter: JS Bridge: https://player.xn--gmqr9gevarqk8t.cn/player/ec.php?code=qw&if=1&url=https://s1.bfengbf.com/video/xiangyaochengweiyingzhishilizhe/第01集/index.m3u8
*** Assertion failure in -[FWFScriptMessageHandler userContentController:didReceiveScriptMessage:], FWFScriptMessageHandlerHostApi.m:59
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '<FlutterError: 0x60000274fa40>'
*** First throw call stack:
(
	0   CoreFoundation                      0x0000000198a9c300 __exceptionPreprocess + 176
	1   libobjc.A.dylib                     0x0000000198582cd8 objc_exception_throw + 88
	2   Foundation                          0x0000000199c99478 -[NSCalendarDate initWithCoder:] + 0
	3   webview_flutter_wkwebview           0x000000010554cf2c __73-[FWFScriptMessageHandler userContentController:didReceiveScriptMessage:]_block_invoke + 156
	4   webview_flutter_wkwebview           0x000000010553478c __138-[FWFWKScriptMessageHandlerFlutterApi didReceiveScriptMessageForHandlerWithIdentifier:userContentControllerIdentifier:message:completion:]_block_invoke + 248
	5   FlutterMacOS                        0x0000000108d8e62c __48-[FlutterBasicMessageChannel sendMessage:reply:]_block_invoke + 112
	6   FlutterMacOS                        0x0000000108131a18 _ZZ51-[FlutterEngine sendOnChannel:message:binaryReply:]EN4$_118__invokeEPKhmPv + 108
	7   FlutterMacOS                        0x00000001089b826c _ZNSt3_fl10__function6__funcIN3fml8internal14CopyableLambdaIZN7flutter31EmbedderPlatformMessageResponse8CompleteENS_10unique_ptrINS2_7MappingENS_14default_deleteIS8_EEEEE3$_0EENS_9allocatorISD_EE	8   FlutterMacOS                        0x00000001089bc484 _ZN7flutter18EmbedderTaskRunner8PostTaskEy + 652
	9   FlutterMacOS                        0x00000001089a4e6c FlutterEngineRunTask + 36
	10  FlutterMacOS                        0x0000000108130e40 -[FlutterEngine runTaskOnEmbedder:] + 56
	11  FlutterMacOS                        0x0000000108130ff4 __60-[FlutterEngine postMainThreadTask:targetTimeInNanoseconds:]_block_invoke + 64
	12  libdispatch.dylib                   0x000000019878e8f8 _dispatch_call_block_and_release + 32
	13  libdispatch.dylib                   0x0000000198790658 _dispatch_client_callout + 20
	14  libdispatch.dylib                   0x000000019879ef68 _dispatch_main_queue_drain + 980
	15  libdispatch.dylib                   0x000000019879eb84 _dispatch_main_queue_callback_4CF + 44
	16  CoreFoundation                      0x0000000198a68e60 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
	17  CoreFoundation                      0x0000000198a28a4c __CFRunLoopRun + 1996
	18  CoreFoundation                      0x0000000198a27bc4 CFRunLoopRunSpecific + 588
	19  HIToolbox                           0x00000001a3e97f64 RunCurrentEventLoopInMode + 292
	20  HIToolbox                           0x00000001a3e9dd54 ReceiveNextEventCommon + 636
	21  HIToolbox                           0x00000001a3e9deb8 _BlockUntilNextEventMatchingListInModeWithFilter + 76
	22  AppKit                              0x000000019c553a08 _DPSNextEvent + 660
	23  AppKit                              0x000000019ce93e0c -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 688
	24  AppKit                              0x000000019c546ae0 -[NSApplication run] + 480
	25  AppKit                              0x000000019c51d364 NSApplicationMain + 888
	26  kazumi.debug.dylib                  0x0000000104f0e9d4 $sSo21NSApplicationDelegateP6AppKitE4mainyyFZ + 40
	27  kazumi.debug.dylib                  0x0000000104f0e99c $s6kazumi11AppDelegateC5$mainyyFZ + 44
	28  kazumi.debug.dylib                  0x0000000104f0ec18 __debug_main_executable_dylib_entry_point + 28
	29  dyld                                0x00000001985c0274 start + 2840
)
FAULT: NSInternalInconsistencyException: <FlutterError: 0x600002d912e0>; {
    NSAssertFile = "FWFScriptMessageHandlerHostApi.m";
    NSAssertLine = 59;
}
libc++abi: terminating due to uncaught exception of type NSException

提交前确认

  • issue 列表中,没有我发现的这个 Bug
  • 我正在使用最新版本的 Kazumi
@ErBWs ErBWs added the bug Something isn't working label Nov 7, 2024
@ErBWs
Copy link
Contributor Author

ErBWs commented Nov 7, 2024

image

@ErBWs
Copy link
Contributor Author

ErBWs commented Nov 7, 2024

@KotaHv brovod 规则有什么问题吗?是否可以给个示例,我这边 brovod 的问题不是闪退是这个:

Player inent error. invalid or unsupported media

考虑到 brovod 被移出了规则仓库的 index, 或许这是正常表现

@KotaHv
Copy link
Contributor

KotaHv commented Nov 7, 2024

@KotaHv brovod 规则有什么问题吗?是否可以给个示例,我这边 brovod 的问题不是闪退是这个:

Player inent error. invalid or unsupported media

考虑到 brovod 被移出了规则仓库的 index, 或许这是正常表现

我在播放 迷宫饭 时会闪退

flutter: JS Bridge: The number of iframe tags is3
flutter: JS Bridge: https://play.brovod.com/?url=aoo00oH0Roo00o04cO0O0OH1M1lO0O0OM007ElMkYlMkZjZG4wMS5zZW5oZXdlbmh1YS5jboo00o0lMkYoo00oTCUyQjM1YTZyNmFXdExsTXdNVVV3TVM1dGNEUSUzRC5tcDQo000o&next=//www.brovod.com/play/109044-2-2/&title=在线播放迷宫饭 第01集
flutter: VideoJS Bridge: The number of video tags is0
flutter: VideoJS Bridge: The number of video tags is0
flutter: VideoJS Bridge: The number of video tags is0
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '<FlutterError: 0x6000006be0c0>'
*** First throw call stack:
(
	0   CoreFoundation                      0x00000001839f8300 __exceptionPreprocess + 176
	1   libobjc.A.dylib                     0x00000001834decd8 objc_exception_throw + 88
	2   Foundation                          0x0000000184bf5478 -[NSCalendarDate initWithCoder:] + 0
	3   webview_flutter_wkwebview           0x00000001010f4f2c __73-[FWFScriptMessageHandler userContentController:didReceiveScriptMessage:]_block_invoke + 156
	4   webview_flutter_wkwebview           0x00000001010dc78c __138-[FWFWKScriptMessageHandlerFlutterApi didReceiveScriptMessageForHandlerWithIdentifier:userContentControllerIdentifier:message:completion:]_block_invoke + 248
	5   FlutterMacOS                        0x000000010492e62c __48-[FlutterBasicMessageChannel sendMessage:reply:]_block_invoke + 112
	6   FlutterMacOS                        0x0000000103cd1a18 _ZZ51-[FlutterEngine sendOnChannel:message:binaryReply:]EN4$_118__invokeEPKhmPv + 108
	7   FlutterMacOS                        0x000000010455826c _ZNSt3_fl10__function6__funcIN3fml8internal14CopyableLambdaIZN7flutter31EmbedderPlatformMessageResponse8CompleteENS_10unique_ptrINS2_7MappingENS_14default_deleteIS8_EEEEE3$_0EENS_9allocatorISD_EE	8   FlutterMacOS                        0x000000010455c484 _ZN7flutter18EmbedderTaskRunner8PostTaskEy + 652
	9   FlutterMacOS                        0x0000000104544e6c FlutterEngineRunTask + 36
	10  FlutterMacOS                        0x0000000103cd0e40 -[FlutterEngine runTaskOnEmbedder:] + 56
	11  FlutterMacOS                        0x0000000103cd0ff4 __60-[FlutterEngine postMainThreadTask:targetTimeInNanoseconds:]_block_invoke + 64
	12  libdispatch.dylib                   0x00000001836ea8f8 _dispatch_call_block_and_release + 32
	13  libdispatch.dylib                   0x00000001836ec658 _dispatch_client_callout + 20
	14  libdispatch.dylib                   0x00000001836faf68 _dispatch_main_queue_drain + 980
	15  libdispatch.dylib                   0x00000001836fab84 _dispatch_main_queue_callback_4CF + 44
	16  CoreFoundation                      0x00000001839c4e60 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
	17  CoreFoundation                      0x0000000183984a4c __CFRunLoopRun + 1996
	18  CoreFoundation                      0x0000000183983bc4 CFRunLoopRunSpecific + 588
	19  HIToolbox                           0x000000018edf3f64 RunCurrentEventLoopInMode + 292
	20  HIToolbox                           0x000000018edf9d54 ReceiveNextEventCommon + 636
	21  HIToolbox                           0x000000018edf9eb8 _BlockUntilNextEventMatchingListInModeWithFilter + 76
	22  AppKit                              0x00000001874afa08 _DPSNextEvent + 660
	23  AppKit                              0x0000000187defe0c -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 688
	24  AppKit                              0x00000001874a2ae0 -[NSApplication run] + 480
	25  AppKit                              0x0000000187479364 NSApplicationMain + 888
	26  kazumi.debug.dylib                  0x0000000100aae9d4 $sSo21NSApplicationDelegateP6AppKitE4mainyyFZ + 40
	27  kazumi.debug.dylib                  0x0000000100aae99c $s6kazumi11AppDelegateC5$mainyyFZ + 44
	28  kazumi.debug.dylib                  0x0000000100aaec18 __debug_main_executable_dylib_entry_point + 28
	29  dyld                                0x000000018351c274 start + 2840
)
libc++abi: terminating due to uncaught exception of type NSException

brovod 被移除是因为有段时间网站不可用

@ErBWs
Copy link
Contributor Author

ErBWs commented Nov 7, 2024

将 webview_controller_impel.dart 第 59 行 修改为

currentUrl = Uri.encodeFull(message.message);

可以解决闪退问题,我想问题出在链接具有未被编码的中文导致的,不过迷宫饭依然不能播放,解析成功后报错:

Player inent error. Failed to load video: You do not have permission to access the requested resource.

@Predidit
Copy link
Owner

Predidit commented Nov 7, 2024

这听上去和 #284 类似,也许我们可以和在 #284 中做的一样,传递给播放器的资源地址进行一次 decode

@Rstoroniomi
Copy link

image
經過更新,解析失敗😔

@Rstoroniomi
Copy link

akiaime只有部分視頻可以播放嗎?

@ErBWs
Copy link
Contributor Author

ErBWs commented Nov 7, 2024

akiaime只有部分視頻可以播放嗎?

这是哪部番剧?

@Rstoroniomi
Copy link

akiaime只有部分視頻可以播放嗎?

这是哪部番剧?

水星領航員

@ErBWs
Copy link
Contributor Author

ErBWs commented Nov 7, 2024

水星領航員

我这边解析都没有问题

@Rstoroniomi
Copy link

image
是網路問題嗎?

@ErBWs
Copy link
Contributor Author

ErBWs commented Nov 7, 2024

这听上去和 #284 类似,也许我们可以和在 #284 中做的一样,传递给播放器的资源地址进行一次 decode

好像有一些区别,因为这里闪退的原因是缺少 encode 而不是 decode

@ErBWs
Copy link
Contributor Author

ErBWs commented Nov 7, 2024

是網路問題嗎?

估计是

@Rstoroniomi
Copy link

等等,第三季看的了,但第一季解析失敗了😔

@Predidit
Copy link
Owner

Predidit commented Nov 7, 2024

这听上去和 #284 类似,也许我们可以和在 #284 中做的一样,传递给播放器的资源地址进行一次 decode

好像有一些区别,因为这里闪退的原因是缺少 encode 而不是 decode

我的意思是 encode 修复闪退问题只后,播放器无法播放的问题可能是 #284 ,也就是 encode 破坏了 URL 中的校验参数

@Rstoroniomi
Copy link

akiaime 現在沒問題了👌

@KotaHv
Copy link
Contributor

KotaHv commented Nov 7, 2024

将 webview_controller_impel.dart 第 59 行 修改为

currentUrl = Uri.encodeFull(message.message);

可以解决闪退问题,我想问题出在链接具有未被编码的中文导致的,不过迷宫饭依然不能播放,解析成功后报错:

Player inent error. Failed to load video: You do not have permission to access the requested resource.

嗯,这样改后不会闪退了。

报错的原因是网站问题,视频源 403错误

@Predidit
Copy link
Owner

Predidit commented Nov 7, 2024

感谢 @KotaHv#377 中为拆分了 Apple WKWebview 的实现

我想现在我们可以直接在 webview_apple_controller.dart 上工作而不影响 Android

@ErBWs
Copy link
Contributor Author

ErBWs commented Nov 7, 2024

我的意思是 encode 修复闪退问题只后,播放器无法播放的问题可能是 #284 ,也就是 encode 破坏了 URL 中的校验参数

应该没有关联,因为修改的是 JSBridgeDebug 部分,而 #284 中的修改对于 macOS/iOS/Android 平台来说是在 VideoBridgeDebug 部分。

另外这个修改同样适用于 Android,Android 不会闪退但不这样修改会无法播放

@Predidit
Copy link
Owner

Predidit commented Nov 7, 2024

我们可以对比 Android 和 macOS 解析出的视频直链吗

@ErBWs
Copy link
Contributor Author

ErBWs commented Nov 7, 2024

修改前 Android:

I/flutter ( 5508): JS Bridge: https://player.xn--gmqr9gevarqk8t.cn/player/ec.php?code=qw&if=1&url=https://s1.bfengbf.com/video/xiangyaochengweiyingzhishilizhe/第01集/index.m3u8
======== Exception caught by services library ======================================================
The following ArgumentError was thrown during a platform message callback:
Invalid argument(s): Illegal percent encoding in URI

When the exception was thrown, this was the stack: 
#0      _Uri._uriDecode (dart:core/uri.dart:3125:11)
#1      Uri.decodeFull (dart:core/uri.dart:1298:17)
#2      Utils.decodeVideoSource (package:kazumi/utils/utils.dart:98:26)
#3      WebviewItemControllerImpel.loadUrl.<anonymous closure> (package:kazumi/pages/webview/webview_controller_impel/webview_controller_impel.dart:61:19)
#4      new AndroidJavaScriptChannelParams.<anonymous closure>.<anonymous closure> (package:webview_flutter_android/src/android_webview_controller.dart:875:40)
#5      JavaScriptChannelFlutterApiImpl.postMessage (package:webview_flutter_android/src/android_webview_api_impls.dart:628:26)
#6      JavaScriptChannelFlutterApi.setup.<anonymous closure> (package:webview_flutter_android/src/android_webview.g.dart:1648:15)
#7      BasicMessageChannel.setMessageHandler.<anonymous closure> (package:flutter/src/services/platform_channel.dart:235:49)
#8      _DefaultBinaryMessenger.setMessageHandler.<anonymous closure> (package:flutter/src/services/binding.dart:618:35)
#9      _invoke2 (dart:ui/hooks.dart:344:13)
#10     _ChannelCallbackRecord.invoke (dart:ui/channel_buffers.dart:45:5)
#11     _Channel.push (dart:ui/channel_buffers.dart:135:31)
#12     ChannelBuffers.push (dart:ui/channel_buffers.dart:343:17)
#13     PlatformDispatcher._dispatchPlatformMessage (dart:ui/platform_dispatcher.dart:750:22)
#14     _dispatchPlatformMessage (dart:ui/hooks.dart:257:31)
====================================================================================================

修改后两个平台相同:

I/flutter ( 5508): JS Bridge: https://player.xn--gmqr9gevarqk8t.cn/player/ec.php?code=qw&if=1&url=https://s1.bfengbf.com/video/xiangyaochengweiyingzhishilizhe/第01集/index.m3u8
I/flutter ( 5508): Loading video source from iframe src https://s1.bfengbf.com/video/xiangyaochengweiyingzhishilizhe/%E7%AC%AC01%E9%9B%86/index.m3u8

若是不 encode 安卓会在执行 RegExp 时抛出错误

@Predidit
Copy link
Owner

Predidit commented Nov 7, 2024

看上去不错,我们可以提交一个PR吗

ErBWs added a commit to ErBWs/Kazumi that referenced this issue Nov 7, 2024
@ErBWs
Copy link
Contributor Author

ErBWs commented Nov 7, 2024

已经提交

@Predidit
Copy link
Owner

Predidit commented Nov 7, 2024

这个 Issue 看上去解决了,我们可以关闭它吗

@ErBWs
Copy link
Contributor Author

ErBWs commented Nov 7, 2024

可以

@ErBWs ErBWs closed this as completed Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants