Skip to content

Commit d773530

Browse files
committed
Player::setUserAgent (#44)
1 parent 9a678c8 commit d773530

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

dartvlc/internal/setters.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@ class PlayerSetters: public PlayerEvents {
121121
);
122122
}
123123

124+
void setUserAgent(std::string userAgent) {
125+
this->instance.setUserAgent("Dart VLC", userAgent);
126+
}
127+
124128
void add(Media* media) {
125129
this->isPlaylistModified = true;
126130
this->state->medias->medias.emplace_back(media);

lib/src/player.dart

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,18 @@ class Player {
274274
);
275275
}
276276

277+
/// Sets user agent for dart_vlc player.
278+
Future<void> setUserAgent(String userAgent) async {
279+
await this._isInstanceCreated.future;
280+
await channel.invokeMethod(
281+
'Player.setUserAgent',
282+
{
283+
'id': this.id,
284+
'userAgent': userAgent
285+
},
286+
);
287+
}
288+
277289
/// Appends [Media] to the [Playlist] of the [Player] instance.
278290
Future<void> add(Media source) async {
279291
await this._isInstanceCreated.future;

0 commit comments

Comments
 (0)