Skip to content

Commit 9a678c8

Browse files
committed
Updated platform channel interface
1 parent 4767b49 commit 9a678c8

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

linux/dart_vlc_plugin.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,13 @@ static void dart_vlc_plugin_handle_method_call(DartVlcPlugin* self, FlMethodCall
300300
player->setPlaylistMode(playlistMode);
301301
response = FL_METHOD_RESPONSE(fl_method_success_response_new(fl_value_new_null()));
302302
}
303+
else if(strcmp(method, "Player.setUserAgent") == 0){
304+
int id = fl_value_get_int(fl_value_lookup_string(fl_method_call_get_args(method_call), "id"));
305+
const char* userAgent = fl_value_get_string(fl_value_lookup_string(fl_method_call_get_args(method_call), "userAgent"));
306+
Player* player = players->get(id);
307+
player->setUserAgent(userAgent);
308+
response = FL_METHOD_RESPONSE(fl_method_success_response_new(fl_value_new_null()));
309+
}
303310
else if (strcmp(method, "Player.add") == 0) {
304311
int id = fl_value_get_int(fl_value_lookup_string(fl_method_call_get_args(method_call), "id"));
305312
auto source = fl_value_lookup_string(fl_method_call_get_args(method_call), "source");

windows/dart_vlc_plugin.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,24 @@ namespace {
761761
player->setPlaylistMode(playlistMode);
762762
method->returnNull();
763763
}
764+
/*
765+
* Sets user agent.
766+
*
767+
* Argument:
768+
*
769+
* {
770+
* 'id': 0,
771+
* 'userAgent': 'curl/7.58.0'
772+
* }
773+
*
774+
*/
775+
else if (method->name == "Player.setUserAgent") {
776+
int id = method->getArgument<int>("id");
777+
std::string userAgent = method->getArgument<std::string>("userAgent");
778+
Player* player = players->get(id);
779+
player->setUserAgent(userAgent);
780+
method->returnNull();
781+
}
764782
/* Adds new `Media` to the end of the `Playlist` of the `Player`.
765783
*
766784
* Argument:

0 commit comments

Comments
 (0)