【发布时间】:2021-03-15 19:53:10
【问题描述】:
我已经关注了有关 WebRTC 视频聊天的 YouTube 教程,因此我尝试编写它。在 localhost 中它可以工作,但是一旦我将它上传到 firebase 托管它就会出现此错误。 我能做些什么?我是网络开发新手,请耐心等待
main.hmtl
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>WebRtc Demo</title>
</head>
<body>
<h2>Start Cam</h2>
<div class ="videos">
<span>
<h3>Local</h3>
<video id="webcamVideo" autoplay playsinline></video>
</span>
<span>
<h3>Remote</h3>
<video id="remoteVideo" autoplay playsinline></video>
</span>
</div>
<button id="webcamButton">Start cam</button>
<h2>New Call</h2>
<button id="callButton">call</button>
<input id="callInput"/>
<button id="answerButton">Rispondi</button>
<button id="hangupButton">Hangup</button>
<script type="module" src="/main.js"></script>
</body>
</html>
Firebase.json
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
},
"hosting": {
"public": "/",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
main.js
import firebase from 'firebase/app';
import 'firebase/firestore';
const firebaseConfig = {
...
};
【问题讨论】:
-
您介意确认 firebase 已正确安装为 package.json 中的依赖项吗?如果不是,那可能就是问题所在。
-
它安装正确,因为在 package.json : ``` "dependencies": { "firebase": "^8.3.0" } ``
-
你在 node_modules 文件夹中看到了 firebase 模块吗?
-
是的,在那儿
-
这里有同样的问题。有解决这个问题的希望吗?
标签: javascript html firebase