mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Add MediaStream::new_single()
This commit is contained in:
parent
6a001e7523
commit
bf9614edf7
1 changed files with 12 additions and 0 deletions
|
@ -13,6 +13,7 @@ use crate::dom::globalscope::GlobalScope;
|
|||
use crate::dom::mediastreamtrack::MediaStreamTrack;
|
||||
use crate::dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use servo_media::streams::registry::MediaStreamId;
|
||||
use servo_media::streams::MediaStreamType;
|
||||
|
||||
#[dom_struct]
|
||||
|
@ -34,6 +35,17 @@ impl MediaStream {
|
|||
reflect_dom_object(Box::new(MediaStream::new_inherited()), global)
|
||||
}
|
||||
|
||||
pub fn new_single(
|
||||
global: &GlobalScope,
|
||||
id: MediaStreamId,
|
||||
ty: MediaStreamType,
|
||||
) -> DomRoot<MediaStream> {
|
||||
let this = Self::new(global);
|
||||
let track = MediaStreamTrack::new(global, id, ty);
|
||||
this.AddTrack(&track);
|
||||
this
|
||||
}
|
||||
|
||||
pub fn Constructor(global: &Window) -> Fallible<DomRoot<MediaStream>> {
|
||||
Ok(MediaStream::new(&global.global()))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue