Azir Posted November 9, 2020 Share Posted November 9, 2020 (edited) I want to use pixi js to help me synthesize the webcam stream I successfully merg two video stream into one canvas But I cannot get mediastream using canvas.captureStream() look this image sample code const canvas = document.getElementById('mycanvas') const app = new PIXI.Application({ view: canvas, }); canvas.width = 1920; canvas.height = 1080; var texture = null; var captureMixerStream = () => { // canvas mixer stream let mediaStream3 = canvas.captureStream(); video2.srcObject = mediaStream3; video2.onloadedmetadata = () => { video2.play(); // error broken screen }; } var initvideo2 = () => { // mediaStream from getusermedia webcam stream video2.srcObject = mediastream; video2.onloadedmetadata = () => { video2.play(); }; video2.oncanplay = function () { let sprite = new PIXI.Sprite(texture); sprite.position.set(640, 360); sprite.width = 640; sprite.height = 360; app.stage.addChild(sprite) captureMixerStream(); } } var initvideo1 = () => { // mediaStream from getusermedia webcam stream video1.srcObject = mediastream; video1.onloadedmetadata = () => { video1.play(); }; video1.oncanplay = function () { texture = PIXI.Texture.from(video1); let sprite = new PIXI.Sprite(texture); sprite.position.set(0, 0); sprite.width = 1920; sprite.height = 1080; app.stage.addChild(sprite); initvideo2(); } } initvideo1(); Edited November 9, 2020 by Azir Pixi.js Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted November 9, 2020 Share Posted November 9, 2020 Seems like browser/WebGL problem. PixiJS itself doesnt have anything related to streams. Do you reproduce it in both chrome & firefox? Quote Link to comment Share on other sites More sharing options...
Azir Posted November 9, 2020 Author Share Posted November 9, 2020 I haven't tried this sample in firefox For some reasons, my program only needs to support chrome (chromium) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.