mirror of https://github.com/OpenVidu/openvidu.git
openvidu-browser: allow 'window' string as videoSource in modern Chrome/Firefox
parent
47312205c5
commit
e78f13db54
|
@ -546,7 +546,8 @@ export class OpenVidu {
|
|||
let mustAskForAudioTrackLater = false;
|
||||
if (typeof options.videoSource === 'string') {
|
||||
if (options.videoSource === 'screen' ||
|
||||
(platform.name!.indexOf('Firefox') !== -1 && options.videoSource === 'window')) {
|
||||
options.videoSource === 'window' ||
|
||||
(platform.name === 'Electron' && options.videoSource.startsWith('screen:'))) {
|
||||
// Screen sharing
|
||||
mustAskForAudioTrackLater = options.audioSource !== null && options.audioSource !== false;
|
||||
if (navigator.mediaDevices['getDisplayMedia'] && platform.name !== 'Electron') {
|
||||
|
@ -680,7 +681,7 @@ export class OpenVidu {
|
|||
if (!!publisherProperties.videoSource && typeof publisherProperties.videoSource === 'string') {
|
||||
|
||||
if (publisherProperties.videoSource === 'screen' ||
|
||||
(platform.name!.indexOf('Firefox') !== -1 && publisherProperties.videoSource === 'window') ||
|
||||
publisherProperties.videoSource === 'window' ||
|
||||
(platform.name === 'Electron' && publisherProperties.videoSource.startsWith('screen:'))) {
|
||||
|
||||
if (!this.checkScreenSharingCapabilities()) {
|
||||
|
@ -740,7 +741,7 @@ export class OpenVidu {
|
|||
} else {
|
||||
|
||||
if (navigator.mediaDevices['getDisplayMedia']) {
|
||||
// getDisplayMedia support (Chrome >= 72, Firefox >= 52)
|
||||
// getDisplayMedia support (Chrome >= 72, Firefox >= 66)
|
||||
resolve(mediaConstraints);
|
||||
} else {
|
||||
// Default screen sharing extension for Chrome/Opera, or is Firefox < 66
|
||||
|
|
|
@ -75,7 +75,7 @@ export interface PublisherProperties {
|
|||
* - `"screen"` to screen-share. We provide a default screen-shraring extension for Chrome that can run in any domain, but you can customize it so it has your own icon, your own name, etc. Visit this
|
||||
* [GitHub repository](https://github.com/OpenVidu/openvidu-screen-sharing-chrome-extension/) to learn how. Once you have uploaded your own extension to Chrome Web Store,
|
||||
* simply call `OpenVidu.setAdvancedConfiguration({screenShareChromeExtension : "https://chrome.google.com/webstore/detail/YOUR_EXTENSION_NAME/YOUR_EXTENSION_ID"})` before calling `OpenVidu.initPublisher(targetElement, {videoSource: "screen"})`.
|
||||
* For Firefox `"screen"` string will ask for permissions to share the entire screen. To ask for a specific window or application, use `"window"` string instead (this only applies to Firefox).
|
||||
* For Firefox (<66) `"screen"` string will ask for permissions to share the entire screen. To ask for a specific window or application, use `"window"` string instead (this only applies to Firefox).
|
||||
* - A MediaStreamTrack obtained from a MediaStream object with [[OpenVidu.getUserMedia]]
|
||||
* - `false` or null to have an audio-only publisher
|
||||
* @default _Default camera_
|
||||
|
|
Loading…
Reference in New Issue