mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
script: fix set muted on html video element creation (#38462)
Set muted on html video element creation. On `video` element creation, the `set_mute` function will be called before the media player is created, hence the player will still act as not being muted. This PR fix this behaviour by passing `muted` info after player is created as part of `setup_media_player` process. Testing: Locally test on Windows11 Fixes: https://github.com/servo/servo/issues/38448 --------- Signed-off-by: rayguo17 <tin.tun.aung1@huawei.com> Signed-off-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com> Co-authored-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com>
This commit is contained in:
parent
391bf5d605
commit
778dc70181
1 changed files with 9 additions and 1 deletions
|
@ -1445,7 +1445,15 @@ impl HTMLMediaElement {
|
|||
audio_renderer,
|
||||
Box::new(window.get_player_context()),
|
||||
);
|
||||
let player_id = player.lock().unwrap().get_id();
|
||||
let player_id = {
|
||||
let player_guard = player.lock().unwrap();
|
||||
|
||||
if let Err(e) = player_guard.set_mute(self.muted.get()) {
|
||||
log::warn!("Could not set mute state: {:?}", e);
|
||||
}
|
||||
|
||||
player_guard.get_id()
|
||||
};
|
||||
|
||||
*self.player.borrow_mut() = Some(player);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue