web端的屏幕共享,Safari浏览器总是报未知错误,请问怎么解决?

[Error] 17:58:45:704 Agora-SDK [ERROR]: – “getUserMedia unexpected error” – “InvalidAccessError”
log (AgoraRTC_N-production.js:446:231)
error (AgoraRTC_N-production.js:444:295)
Me (AgoraRTC_N-production.js:138:149)
(匿名函数) (AgoraRTC_N-production.js:131:120)
asyncFunctionResume
(匿名函数)
promiseReactionJobWithoutPromise
promiseReactionJob
[Error] 17:58:45:704 Agora-SDK [ERROR]: – “[track-scr92a40003] AgoraRTCError UNEXPECTED_ERROR: InvalidAccessError: getDisplayMedia must be called from a user gesture handler.”
log (AgoraRTC_N-production.js:446:231)
error (AgoraRTC_N-production.js:444:295)
(匿名函数) (AgoraRTC_N-production.js:131:284)
asyncFunctionResume
(匿名函数)
promiseReactionJobWithoutPromise
promiseReactionJob
[Error] 17:58:45:723 Agora-SDK [ERROR]: – “AgoraRTCError INVALID_PARAMS: pamameter is not local track”
log (AgoraRTC_N-production.js:446:231)
error (AgoraRTC_N-production.js:444:295)
print (AgoraRTC_N-production.js:449:372)
throw (AgoraRTC_N-production.js:449:461)
(匿名函数) (AgoraRTC_N-production.js:1194:90)
asyncFunctionResume
u (trtc.js:1:15584)
(匿名函数) (trtc.js:1:15334)
(匿名函数) (trtc.js:1:15946)
asyncGeneratorStep (asyncToGenerator.js:9)
_next (asyncToGenerator.js:31)
promiseReactionJob

9个回答
刘应 回复于 2021-10-22 02:48 · IP属地贵州

建议参考我们的demo:GitHub - AgoraIO/API-Examples-Web

回复·1

你好,我看demo里也没特别处理,就是用了AgoraRTC.createScreenVideoTrack(),我们那个屏幕共享在谷歌浏览器正常,在safari浏览器就报未知的错误,那个选择共享的弹窗也不能出来。

ceshi 回复于 2021-10-22 05:31 · IP属地北京

我看Safari浏览器的版本是13.1.3,也支持屏幕共享。

回复·0
刘应 回复于 2021-10-22 05:45 · IP属地贵州

可能某些地方写得有问题,可以测试刚才demo的在线测试地址:Share The Screen -- Agora
截屏2021-10-22 13.44.02
可以正常进行分享

回复·0
moyuwen 回复于 2021-10-30 12:03 · IP属地北京

我们也遇到这个问题了 麻烦问下找到原因了吗

回复·1

有试过web的在线demo嘛

moyuwen 回复于 2021-11-01 11:37 · IP属地北京

在线demo 试过 没有问题 但是我们对照了代码 看着逻辑基本一样 找不到是哪里的问题 怀疑是AgoraRTC.createScreenVideoTrack() 时没有弹起是否允许屏幕共享的界面 但是我们理解的这个不应该是 调用上述方法时 web SDK 自动去触发的吗?

回复·0
Reall 回复于 2021-11-01 11:45

建议您关注下框选的区域。参考:API 参考
[API 参考 (agora.io)] ScreenVideoTrackInitConfig
image

回复·0
wayhow 回复于 2022-09-11 16:20

这个问题有解决吗???

回复·0
wayhow 回复于 2022-09-13 06:26

我用react的useEffect的回调里面调用就会报这个错,不通过useEffect在button的click里面直接调用声网的接口就没问题

回复·0
kazutaka horie 回复于 2023-01-31 11:00 · IP属地Tokyo

I've finally handled this with here codes.

// Using Promise like that, Will show confirming on safari
let localScreenVideoTrack;[localScreenVideoTrack] = await Promise.all([  
AgoraRTC.createScreenVideoTrack({    encoderConfig: "720p_2",  })
])


// it will not show confirming, and Agora retun error.
await this.screenShareRTCClient.join(appId, channel, token, uid);



回复·0