import VideoFrameBuffer from './VideoFrameBuffer' ; /**
 * [[CanvasVideoFrameBuffer]] implements [[VideoFrameBuffer]]. It internally holds an `HTMLCanvasElement`.
 */ export default class CanvasVideoFrameBuffer implements VideoFrameBuffer { private destroyed : boolean = false ; framerate : number ; width : number ; height : number ; constructor ( private canvas ) { } destroy ( ) { this . canvas = null ; this . destroyed = true ; } async asCanvasImageSource ( ) { if ( this . destroyed ) { return Promise . reject ( 'canvas buffer is destroyed' ) ; } return Promise . resolve ( this . canvas ) ; } asCanvasElement ( ) { return this . canvas ; } }