video_player_win icon indicating copy to clipboard operation
video_player_win copied to clipboard

Video player crashed on release mode

Open gokulb2298 opened this issue 1 year ago • 2 comments

The 'video_player_win' channel sent a message from native to Flutter on a non-platform thread. Platform channel messages must be sent on the platform thread. Failure to do so may result in data loss or crashes, and must be fixed in the plugin or application code creating that channel.

gokulb2298 avatar Dec 04 '23 06:12 gokulb2298

As you said, it seems that MethodChannel.setMethodCallHandler() cannot work with isolate. related issue

However, currently there is no way to send message from native to platform thread when you create VideoPlayerController in isolate. Even if it is allowed to force sending to platform thread, I think it is not a good idea because the main thread maybe killed when application is put into background for a long time in Android/iOS (even though Windows app has no such a problem).

So I won't fix this unless you can tell me which package has already support this feature, or providing me more workable solution. Or just wait until flutter team fix it.

jakky1 avatar Dec 04 '23 12:12 jakky1

More information, _background_isolate_binary_messenger_io.dart in official flutter codebase has the following code:

void setMessageHandler(String channel, MessageHandler? handler) {
    throw UnsupportedError(
        'Background isolates do not support setMessageHandler(). Messages from the host platform always go to the root isolate.');
}

jakky1 avatar Dec 04 '23 16:12 jakky1