Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebRTC: Failed to push stream on HTTP page, Cannot read properties of undefined (reading 'getUserMedia') #2762

Closed
okthomasren opened this issue Nov 30, 2021 · 3 comments
Assignees
Labels
TransByAI Translated by AI/GPT. WebRTC WebRTC, RTC2RTMP or RTMP2RTC. Won't fix We won't fix it.
Milestone

Comments

@okthomasren
Copy link

okthomasren commented Nov 30, 2021

Description

  1. SRS Version: registry.cn-hangzhou.aliyuncs.com/ossrs/srs:4
    Reproduction Steps:
  2. The configuration of SRS is as follows:
    Default rtc.conf configuration file.

Replay
Please make sure to maintain the markdown structure.

  1. Log in to an Alibaba Cloud ECS device.
  2. Pull the Docker image: docker pull registry.cn-hangzhou.aliyuncs.com/ossrs/srs:4
  3. Set the CANDIDATE: CANDIDATE="xx.xxx.xx.xxx"
  4. Start the Docker image: docker run --rm -it --env CANDIDATE=$CANDIDATE -p 1935:1935 -p 8080:8080 -p 1985:1985 -p 8000:8000/udp registry.cn-hangzhou.aliyuncs.com/ossrs/srs:4 objs/srs -c conf/rtc.conf

Please make sure to maintain the markdown structure.

Front-end error log:
?eip=x.x.x.x to overwrite candidate. Overwrite server candidate (public IP) configuration.

Please make sure to maintain the markdown structure.
rtc_publisher.html?autostart=true:104 TypeError: Cannot read properties of undefined (reading 'getUserMedia')
at Object.SrsRtcPublisherAsync.self.publish (srs.sdk.js:50)
at startPublish (rtc_publisher.html?autostart=true:98)
at rtc_publisher.html?autostart=true:115
(anonymous) @ rtc_publisher.html?autostart=true:104
rtc_publisher.html?autostart=true:104 TypeError: Cannot read properties of undefined (reading 'getUserMedia')
at Object.SrsRtcPublisherAsync.self.publish (srs.sdk.js:50)
at HTMLButtonElement.startPublish (rtc_publisher.html?autostart=true:98)
at HTMLButtonElement.dispatch (jquery-1.10.2.min.js:5)
at HTMLButtonElement.v.handle (jquery-1.10.2.min.js:5)

Expected Behavior (Expect)
The SRS4 service deployed on Alibaba Cloud ECS through Docker should be able to push RTC streams normally.

Please make sure to maintain the markdown structure.

TRANS_BY_GPT3

@okthomasren
Copy link
Author

okthomasren commented Nov 30, 2021

Front-end access example page:
http://xx.xxx.xx.xx:8080/players/rtc_publisher.html?autostart=true, streaming failed.

Front-end error log:
?eip=x.x.x.x to overwrite candidate. Overwriting server candidate (public IP) configuration.
rtc_publisher.html?autostart=true:104 TypeError: Cannot read properties of undefined (reading 'getUserMedia')
at Object.SrsRtcPublisherAsync.self.publish (srs.sdk.js:50)
at startPublish (rtc_publisher.html?autostart=true:98)
at rtc_publisher.html?autostart=true:115
(anonymous) @ rtc_publisher.html?autostart=true:104
rtc_publisher.html?autostart=true:104 TypeError: Cannot read properties of undefined (reading 'getUserMedia')
at Object.SrsRtcPublisherAsync.self.publish (srs.sdk.js:50)
at HTMLButtonElement.startPublish (rtc_publisher.html?autostart=true:98)
at HTMLButtonElement.dispatch (jquery-1.10.2.min.js:5)
at HTMLButtonElement.v.handle (jquery-1.10.2.min.js:5)

Expected behavior (Expect):
The SRS4 service deployed on Alibaba Cloud ECS through Docker should be able to push RTC streams normally.

TRANS_BY_GPT3

@winlinvip winlinvip changed the title docker 映像4版本部署到阿里云ECS上前端页面http://xx.xx.xx.xxx:8080/players/rtc_publisher.html?autostart=true 推流失败 WebRTC: HTTP页面推流失败,Cannot read properties of undefined (reading 'getUserMedia') Dec 1, 2021
@winlinvip winlinvip self-assigned this Dec 1, 2021
@winlinvip winlinvip added WebRTC WebRTC, RTC2RTMP or RTMP2RTC. Won't fix We won't fix it. labels Dec 1, 2021
@winlinvip
Copy link
Member

winlinvip commented Dec 1, 2021

This is a basic permission issue with WebRTC.

Cannot read properties of undefined (reading 'getUserMedia')

Note: If the current document isn't loaded securely, navigator.mediaDevices will be undefined, and you cannot use getUserMedia(). See Security for more information on this and other security issues related to using getUserMedia().

The meaning is: You must use a webpage with HTTPS (or localhost) to access the getUserMedia API, otherwise this exception will be thrown.

I have improved srs.sdk.js to provide clearer prompts.

rtc_publisher.html?autostart=true:104 Error: Please use HTTPS or localhost to publish, read https://github.com/ossrs/srs/issues/2762#issuecomment-983147576
    at Object.SrsRtcPublisherAsync.self.publish (srs.sdk.js:51)
    at startPublish (rtc_publisher.html?autostart=true:98)
    at rtc_publisher.html?autostart=true:115

This way, the problems will be clearer.

TRANS_BY_GPT3

@bbhxwl
Copy link

bbhxwl commented Jun 24, 2022

Description
'
Make sure to maintain the markdown structure.

  1. SRS Version: registry.cn-hangzhou.aliyuncs.com/ossrs/srs:4
    Reproduction steps:
  2. SRS configuration (Config):
    Default rtc.conf configuration file

Replay

  1. Log in to an Alibaba Cloud ECS device.
  2. Pull the Docker image: docker pull registry.cn-hangzhou.aliyuncs.com/ossrs/srs:4
  3. Set the CANDIDATE: CANDIDATE="xx.xxx.xx.xxx"
  4. Start the Docker image: docker run --rm -it --env CANDIDATE=$CANDIDATE -p 1935:1935 -p 8080:8080 -p 1985:1985 -p 8000:8000/udp registry.cn-hangzhou.aliyuncs.com/ossrs/srs:4 objs/srs -c conf/rtc.conf

Frontend error log: ?eip=x.x.x.x to overwrite candidate. Overwriting server candidate (public IP) configuration rtc_publisher.html?autostart=true:104 TypeError: Cannot read properties of undefined (reading 'getUserMedia') at Object.SrsRtcPublisherAsync.self.publish (srs.sdk.js:50) at startPublish (rtc_publisher.html?autostart=true:98) at rtc_publisher.html?autostart=true:115 (anonymous) @ rtc_publisher.html?autostart=true:104 rtc_publisher.html?autostart=true:104 TypeError: Cannot read properties of undefined (reading 'getUserMedia') at Object.SrsRtcPublisherAsync.self.publish (srs.sdk.js:50) at HTMLButtonElement.startPublish (rtc_publisher.html?autostart=true:98) at HTMLButtonElement.dispatch (jquery-1.10.2.min.js:5) at HTMLButtonElement.v.handle (jquery-1.10.2.min.js:5)

Expected Behavior (Expect) The SRS4 service deployed on Alibaba Cloud ECS through Docker should be able to stream RTC (Real-Time Communication) properly.

Can you successfully use WebRTC to stream on a webpage?

TRANS_BY_GPT3

@winlinvip winlinvip changed the title WebRTC: HTTP页面推流失败,Cannot read properties of undefined (reading 'getUserMedia') WebRTC: Failed to push stream on HTTP page, Cannot read properties of undefined (reading 'getUserMedia') Jul 28, 2023
@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TransByAI Translated by AI/GPT. WebRTC WebRTC, RTC2RTMP or RTMP2RTC. Won't fix We won't fix it.
Projects
None yet
Development

No branches or pull requests

3 participants