Comments (3)
Did you ever figure out a solution to this?
from opentok-web-samples.
I had the same issue but it has nothing to do with the opentok publisher, the issue is when you do the video.captureStream()
the video by default uses the lowest resolution so when you do captureStream()
your max resolution to use in the publisher would be the lowest of the video.
You could check this by logging your stream.videoTracks()[0].getSettings()
you'll see the max resolution of the video.
What you can do is set the video player resolution to use the highest available by default so when you do captureStream()
your stream.videoTracks()[0]
would have the highest resolution and you can use same resolution in your publisher or downscale it.
from opentok-web-samples.
I managed to get a somewhat workable solution to this. The following solution will also work on ios. It needs more testing but the workflow is as follows:
-
Draw the video to a canvas using
requestAnimationFrame
andcontext.drawImage()
as outlined here https://mux.com/blog/canvas-adding-filters-and-more-to-video-using-just-a-browser/. Note that you can draw a canvas from a video element easily and adjust width, height and framerate using this technique. -
Publish the canvas video stream using
canvas.captureStream(fps).getVideoTracks()[0]
like this:
OT.initPublisher(null, {
videoSource: this.canvasEl
.captureStream(30)
.getVideoTracks()[0],
insertDefaultUI: false,
audioSource: false,
})
This is also shown here: https://github.com/opentok/opentok-web-samples/blob/master/Publish-Canvas/js/app.js. Note that canvas.captureStream
is supported by all recent browsers (https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/captureStream)
from opentok-web-samples.
Related Issues (20)
- I have a problem in @opentok/client 2.22.1 when subscribing to a stream created
- react-16.2.0.tgz: 5 vulnerabilities (highest severity is: 7.5) - autoclosed HOT 1
- url-parse-1.4.3.tgz: 7 vulnerabilities (highest severity is: 9.8) - autoclosed HOT 1
- electron-2.0.2.tgz: 25 vulnerabilities (highest severity is: 9.9) - autoclosed HOT 1
- react-dom-16.2.0.tgz: 1 vulnerabilities (highest severity is: 6.1) - autoclosed HOT 1
- core-6.1.8.tgz: 1 vulnerabilities (highest severity is: 5.4) - autoclosed HOT 1
- jquery-3.2.1.min.js: 3 vulnerabilities (highest severity is: 6.1) - autoclosed HOT 1
- opentok-react-0.7.0.tgz: 7 vulnerabilities (highest severity is: 9.1) - autoclosed HOT 1
- electron-17.0.0-beta.1.tgz: 5 vulnerabilities (highest severity is: 9.8) - autoclosed HOT 1
- react-scripts-1.0.16.tgz: 97 vulnerabilities (highest severity is: 9.8) - autoclosed HOT 1
- apply background filter to a video call HOT 1
- subscriber.setAudioVolume is not a function
- electron-21.2.2.tgz: 1 vulnerabilities (highest severity is: 5.3) - autoclosed HOT 1
- OT.getDevices() get speakers HOT 1
- Inbound Audio does not work with VOIP sample HOT 3
- vue sample ? HOT 1
- express-4.17.1.tgz: 1 vulnerabilities (highest severity is: 7.5)
- opentok-2.15.1.tgz: 5 vulnerabilities (highest severity is: 9.8)
- Outdated Vonage ML Trasformer Library
- vue3 + opentok
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opentok-web-samples.