fix(amap):core
This commit is contained in:
parent
5941a69f96
commit
a99a9d7acc
|
@ -61,10 +61,33 @@ class WebRtc {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async createOffer() {
|
async createOffer() {
|
||||||
try {
|
|
||||||
|
var url =
|
||||||
|
'http://rw.quwanya.cn:12217/api/turn?service=turn&username=flutter-webrtc';
|
||||||
|
fetch(url)
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
const configuration = {
|
const configuration = {
|
||||||
iceServers: [{ urls: 'stun:127.0.0.1:19302' }]
|
iceServers: [
|
||||||
};
|
{
|
||||||
|
urls: data.uris,
|
||||||
|
"username": data.username,
|
||||||
|
"credential": data.password
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
this.gets(configuration)
|
||||||
|
})
|
||||||
|
try {
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async gets(configuration) {
|
||||||
|
console.log(configuration);
|
||||||
|
|
||||||
const peerConnection = new RTCPeerConnection(configuration);
|
const peerConnection = new RTCPeerConnection(configuration);
|
||||||
this.pee = peerConnection
|
this.pee = peerConnection
|
||||||
|
|
||||||
|
@ -86,9 +109,6 @@ class WebRtc {
|
||||||
}
|
}
|
||||||
this.ws?.send(JSON.stringify({ type: 'candidate', data: e }))
|
this.ws?.send(JSON.stringify({ type: 'candidate', data: e }))
|
||||||
}
|
}
|
||||||
} catch (error) {
|
|
||||||
console.log(error);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
sendOffer(userId) {
|
sendOffer(userId) {
|
||||||
let that = this;
|
let that = this;
|
||||||
|
|
Loading…
Reference in New Issue