mirror of https://github.com/OpenVidu/openvidu.git
openvidu-testapp: 'initGrayVideo' method publishes video
parent
c9289d75a2
commit
b2ec6a00e7
|
@ -473,7 +473,7 @@ export class OpenviduInstanceComponent implements OnInit, OnChanges, OnDestroy {
|
||||||
{
|
{
|
||||||
videoSource: undefined,
|
videoSource: undefined,
|
||||||
resolution: '1280x720',
|
resolution: '1280x720',
|
||||||
frameRate: 10,
|
frameRate: 30,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.then((mediaStream: MediaStream) => {
|
.then((mediaStream: MediaStream) => {
|
||||||
|
@ -489,19 +489,23 @@ export class OpenviduInstanceComponent implements OnInit, OnChanges, OnDestroy {
|
||||||
const loop = () => {
|
const loop = () => {
|
||||||
if (!video.paused && !video.ended) {
|
if (!video.paused && !video.ended) {
|
||||||
ctx.drawImage(video, 0, 0, 300, 170);
|
ctx.drawImage(video, 0, 0, 300, 170);
|
||||||
setTimeout(loop, 100); // Drawing at 10fps
|
setTimeout(loop, 33); // Drawing at 30fps
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
loop();
|
loop();
|
||||||
});
|
});
|
||||||
const grayVideoTrack = canvas.captureStream(30).getVideoTracks()[0];
|
const grayVideoTrack = canvas.captureStream(30).getVideoTracks()[0];
|
||||||
this.OV.initPublisher(
|
this.publisher = this.OV.initPublisher(
|
||||||
document.body,
|
document.body,
|
||||||
{
|
{
|
||||||
audioSource: false,
|
audioSource: false,
|
||||||
videoSource: grayVideoTrack,
|
videoSource: grayVideoTrack,
|
||||||
insertMode: VideoInsertMode.APPEND
|
insertMode: VideoInsertMode.APPEND
|
||||||
});
|
});
|
||||||
|
this.session.publish(this.publisher).catch((error: OpenViduError) => {
|
||||||
|
console.error(error);
|
||||||
|
this.session.unpublish(this.publisher);
|
||||||
|
});
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
|
Loading…
Reference in New Issue