closer
This commit is contained in:
parent
8ca4f3368b
commit
bb37c83d2a
2 changed files with 21 additions and 6 deletions
|
@ -50,6 +50,7 @@ class Channel extends SnowFlake{
|
||||||
idToNext: Map<string, string> = new Map();
|
idToNext: Map<string, string> = new Map();
|
||||||
messages: Map<string, Message> = new Map();
|
messages: Map<string, Message> = new Map();
|
||||||
voice?:Voice;
|
voice?:Voice;
|
||||||
|
bitrate:number=128000;
|
||||||
static setupcontextmenu(){
|
static setupcontextmenu(){
|
||||||
this.contextmenu.addbutton("Copy channel id", function(this: Channel){
|
this.contextmenu.addbutton("Copy channel id", function(this: Channel){
|
||||||
navigator.clipboard.writeText(this.id);
|
navigator.clipboard.writeText(this.id);
|
||||||
|
|
|
@ -107,6 +107,12 @@ a=msid-semantic: WMS *\r
|
||||||
a=group:BUNDLE ${bundles.join(" ")}\r`
|
a=group:BUNDLE ${bundles.join(" ")}\r`
|
||||||
let i=0;
|
let i=0;
|
||||||
for(const grouping of parsed.medias){
|
for(const grouping of parsed.medias){
|
||||||
|
let mode="inactive";
|
||||||
|
for(const thing of this.senders){
|
||||||
|
if(thing.mid===bundles[i]){
|
||||||
|
mode="sendonly";
|
||||||
|
}
|
||||||
|
}
|
||||||
if(grouping.media==="audio"){
|
if(grouping.media==="audio"){
|
||||||
build+=
|
build+=
|
||||||
`
|
`
|
||||||
|
@ -121,7 +127,7 @@ a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extension
|
||||||
a=setup:passive\r
|
a=setup:passive\r
|
||||||
a=mid:${bundles[i]}\r
|
a=mid:${bundles[i]}\r
|
||||||
a=maxptime:60\r
|
a=maxptime:60\r
|
||||||
a=inactive\r
|
a=${mode}\r
|
||||||
a=ice-ufrag:${ICE_UFRAG}\r
|
a=ice-ufrag:${ICE_UFRAG}\r
|
||||||
a=ice-pwd:${ICE_PWD}\r
|
a=ice-pwd:${ICE_PWD}\r
|
||||||
a=fingerprint:${FINGERPRINT}\r
|
a=fingerprint:${FINGERPRINT}\r
|
||||||
|
@ -148,7 +154,7 @@ a=extmap:14 urn:ietf:params:rtp-hdrext:toffset\r
|
||||||
a=extmap:13 urn:3gpp:video-orientation\r
|
a=extmap:13 urn:3gpp:video-orientation\r
|
||||||
a=extmap:5 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay/r/na=setup:passive/r/n
|
a=extmap:5 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay/r/na=setup:passive/r/n
|
||||||
a=mid:${bundles[i]}\r
|
a=mid:${bundles[i]}\r
|
||||||
a=inactive\r
|
a=${mode}\r
|
||||||
a=ice-ufrag:${ICE_UFRAG}\r
|
a=ice-ufrag:${ICE_UFRAG}\r
|
||||||
a=ice-pwd:${ICE_PWD}\r
|
a=ice-pwd:${ICE_PWD}\r
|
||||||
a=fingerprint:${FINGERPRINT}\r
|
a=fingerprint:${FINGERPRINT}\r
|
||||||
|
@ -232,14 +238,22 @@ a=rtcp-mux\r`;
|
||||||
const audioStream = await navigator.mediaDevices.getUserMedia({video: false, audio: true} );
|
const audioStream = await navigator.mediaDevices.getUserMedia({video: false, audio: true} );
|
||||||
for (const track of audioStream.getTracks()){
|
for (const track of audioStream.getTracks()){
|
||||||
//Add track
|
//Add track
|
||||||
const sender = pc.addTransceiver(track);
|
const sender = pc.addTransceiver(track,{
|
||||||
sender.sender.setStreams(audioStream);
|
direction:"sendonly",
|
||||||
|
streams:[audioStream],
|
||||||
|
sendEncodings:[{active:true,maxBitrate:this.channel.bitrate}]
|
||||||
|
});
|
||||||
|
this.channel
|
||||||
this.senders.add(sender);
|
this.senders.add(sender);
|
||||||
sender.direction="sendonly";
|
|
||||||
console.log(sender)
|
console.log(sender)
|
||||||
}
|
}
|
||||||
this.counter=data.d.sdp;
|
this.counter=data.d.sdp;
|
||||||
pc.ontrack = ({ streams: [stream] }) => console.log("got audio stream", stream);
|
pc.ontrack = ({ streams: [stream] }) => {
|
||||||
|
console.log("got audio stream", stream);
|
||||||
|
const audio = new Audio();
|
||||||
|
audio.srcObject = stream;
|
||||||
|
audio.play()
|
||||||
|
};
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
this.status="Connection failed";
|
this.status="Connection failed";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue