Merge branch 'feature-msedge-screensharing' into develop
commit
82e8a076c8
|
|
@ -189,6 +189,57 @@ class FirefoxScreenShare
|
|||
}
|
||||
}
|
||||
|
||||
class EdgeScreenShare
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
this._stream = null;
|
||||
}
|
||||
|
||||
start(options = {})
|
||||
{
|
||||
const constraints = this._toConstraints(options);
|
||||
|
||||
return navigator.getDisplayMedia(constraints)
|
||||
.then((stream) =>
|
||||
{
|
||||
this._stream = stream;
|
||||
|
||||
return Promise.resolve(stream);
|
||||
});
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
if (this._stream instanceof MediaStream === false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this._stream.getTracks().forEach((track) => track.stop());
|
||||
this._stream = null;
|
||||
}
|
||||
|
||||
isScreenShareAvailable()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
needExtension()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
_toConstraints()
|
||||
{
|
||||
const constraints = {
|
||||
video : true
|
||||
};
|
||||
|
||||
return constraints;
|
||||
}
|
||||
}
|
||||
|
||||
class DefaultScreenShare
|
||||
{
|
||||
isScreenShareAvailable()
|
||||
|
|
@ -216,6 +267,10 @@ export default class ScreenShare
|
|||
{
|
||||
return new ChromeScreenShare();
|
||||
}
|
||||
case 'edge':
|
||||
{
|
||||
return new EdgeScreenShare();
|
||||
}
|
||||
default:
|
||||
{
|
||||
return new DefaultScreenShare();
|
||||
|
|
|
|||
|
|
@ -35,5 +35,11 @@ export function getBrowserType()
|
|||
return 'chrome';
|
||||
}
|
||||
|
||||
// MSEdge
|
||||
if (ua.indexOf('edge') !== -1)
|
||||
{
|
||||
return 'edge';
|
||||
}
|
||||
|
||||
return 'N/A';
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue