分享前页面
获取分享屏幕
Code
/**
* 开始屏幕共享
*/
openShareScreen() {
var that = this
// 判断是否支持获取本地屏幕分享数据
if (!navigator.mediaDevices || !navigator.mediaDevices.getDisplayMedia) {
that.$notify({
title: '警告',
message: '浏览器不支持本地屏幕设备',
type: 'warning'
});
return;
}
const constraints = {
audio: true,
video: true
};
this.loading = true
this.getLocalDisplayMedia(constraints).then(stream => {
// 拿到流数据后,将流显示在video标签内
this.setDomVideoStream('localVideo', stream);
// 监听流
stream.getVideoTracks()[0].onended = () => {
//监听以后的处理逻辑……
this.$notify({
title: '提示',
message: '屏幕共享已关闭',
type: 'success'
});
that.closeUserMedia('localVideo')
}
});
}
期待更新,麻烦点个赞,点个关注,栓Q !
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/197538.html