-
Notifications
You must be signed in to change notification settings - Fork 51
[video_player_videohole]How to call a callback which allow app do drm license request? #506
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
Comments
More details about the requirement:
we must get response result before return. |
Hi, Have you checked this link? https://dart-review.googlesource.com/c/sdk/+/134704 https://dart-review.googlesource.com/c/sdk/+/134704/18/samples/ffi/async/sample_async_callback.dart
|
Hi, this way is asynchronous, what I need is a synchronous call. I must receive the return result and then can go on. |
I found this synchronized package.
|
@xuelian-bai Sorry for the late response. What I suggested via messenger was to use FFI's port mechanism and a lock on the main thread just like this: I believe in this way you can block the main thread (platform thread) while the Dart callback is running on the UI thread. I just haven't tried so I'm not very sure if it's a feasible solution. Maybe @WonyoungChoi have tried it in his way to solve flutter-tizen/tizen_interop#10. |
Thanks!! I have solved the problem according this. |
Hi,all!
About this requirement:
flutter-tizen/flutter-tizen#217 (comment)
We now need to call a callback in app, this callback can request drm license on its own and return license back to player, and then player use the return result to get license key.
For example:
The dart callback in app will like this:
player(in this file) will call this callback like this:
This process must be synchronized.
I have tried several ways to implement it but all have some problems.
1. Use methodchannel
channel->InvokeMethod("drm.getlicense", std::move(arguments),std::move(result_handler));
I tried used this asynchronous method to call the callback, and then lock the thread and wait for the return result(return result is necessary). But this will lead to the main thread locked, the result cannot be received. Because
InvokeMethod
and main function are on the same thread.The main function locked,InvokeMethod
cannot go on.2. Use FFI
Use FFI to call the dart function, because of the dart isolate, doing a callback from another thread is not supported. According to this.
When I use the callback in another thread(plugin thread), it will occur an error: Cannot invoke native callback outside an isolate. There is no particularly good solution for this problem.
Do you have any good way to implement this requirement? :)
The text was updated successfully, but these errors were encountered: