1
- import { Extension , VideoProcessor , Ticker , IProcessorContext } from ' agora-rte-extension'
1
+ import { Extension , VideoProcessor , Ticker , IProcessorContext } from " agora-rte-extension" ;
2
2
3
3
class SimpleVideoExtension extends Extension < SimpleVideoProcessor > {
4
4
protected _createProcessor ( ) : SimpleVideoProcessor {
5
5
return new SimpleVideoProcessor ( ) ;
6
6
}
7
-
8
7
}
9
8
10
9
class SimpleVideoProcessor extends VideoProcessor {
@@ -18,11 +17,11 @@ class SimpleVideoProcessor extends VideoProcessor {
18
17
public constructor ( ) {
19
18
super ( ) ;
20
19
21
- this . canvas = document . createElement ( ' canvas' ) ;
20
+ this . canvas = document . createElement ( " canvas" ) ;
22
21
this . canvas . width = 640 ;
23
22
this . canvas . height = 480 ;
24
- this . ctx = this . canvas . getContext ( '2d' ) ! ;
25
- this . videoElement = document . createElement ( ' video' ) ;
23
+ this . ctx = this . canvas . getContext ( "2d" ) ! ;
24
+ this . videoElement = document . createElement ( " video" ) ;
26
25
this . videoElement . muted = true ;
27
26
const outputStream = this . canvas . captureStream ( 30 ) ;
28
27
this . canvasTrack = outputStream . getVideoTracks ( ) [ 0 ] ;
@@ -37,7 +36,7 @@ class SimpleVideoProcessor extends VideoProcessor {
37
36
this . ctx . fillStyle = "red" ;
38
37
this . ctx . fillRect ( 0 , 0 , 100 , 100 ) ;
39
38
}
40
- }
39
+ } ;
41
40
42
41
protected onEnableChange ( enabled : boolean ) : void | Promise < void > {
43
42
if ( ! this . context ) {
@@ -61,7 +60,7 @@ class SimpleVideoProcessor extends VideoProcessor {
61
60
this . videoElement . onplaying = ( ) => {
62
61
this . canvas . width = this . videoElement . videoWidth ;
63
62
this . canvas . height = this . videoElement . videoHeight ;
64
- }
63
+ } ;
65
64
66
65
if ( this . enabled ) {
67
66
this . ticker . start ( ) ;
@@ -77,4 +76,4 @@ class SimpleVideoProcessor extends VideoProcessor {
77
76
}
78
77
}
79
78
80
- export { SimpleVideoExtension }
79
+ export { SimpleVideoExtension } ;
0 commit comments