在React应用程序上使用peer.js实现视频流
addVideoStream(video: HTMLVideoElement, stream: MediaStream) {
video.srcObject = stream
video?.addEventListener('loadedmetadata', () => {
video.play()
})
if (this.videoGrid) this.videoGrid.append(video)
}
在'video.play()‘处得到了这个错误
the request is not allowed by the user agent or the platform in the current context
我已经允许了IOS上的音频和视频许可。
此代码除IOS外,其他平台运行良好。
我没有头绪。
如果我部署的话,我只会在IOS上看到黑色屏幕。
我怎么才能解决这个问题?
提前感谢
发布于 2021-12-20 21:28:23
问题是视频标签如何在IOS中与WebRTC一起工作。
使用HTTPS环境(生产),然后添加以下属性
if (isMobile && isSafari) {
this.myVideo.playsInline = true
this.myVideo.autoplay = true
}
那就成功了。
https://stackoverflow.com/questions/70407269
复制相似问题