Update build

This commit is contained in:
Sergiu Toma 2022-11-22 19:51:09 +02:00
parent 1084a808c7
commit 8f96b8c98b
2 changed files with 82 additions and 28 deletions

View File

@ -20453,7 +20453,8 @@ let device
let rtpCapabilities
let producerTransport
let consumerTransport
let producer
let producerVideo
let producerAudio
let consumer
let originAssetId
// let originAssetName = 'Adi'
@ -20461,21 +20462,18 @@ let originAssetId
// https://mediasoup.org/documentation/v3/mediasoup-client/api/#ProducerOptions
// https://mediasoup.org/documentation/v3/mediasoup-client/api/#transport-produce
let params = {
let videoParams = {
// mediasoup params
encodings: [
{
rid: 'r0',
maxBitrate: 100000,
scalabilityMode: 'S1T3',
},
{
rid: 'r1',
maxBitrate: 300000,
scalabilityMode: 'S1T3',
},
{
rid: 'r2',
maxBitrate: 900000,
scalabilityMode: 'S1T3',
},
@ -20486,15 +20484,44 @@ let params = {
}
}
let audioParams = {
// mediasoup params
encodings: [
{
maxBitrate: 100000,
scalabilityMode: 'S1T3',
},
{
maxBitrate: 300000,
scalabilityMode: 'S1T3',
},
{
maxBitrate: 900000,
scalabilityMode: 'S1T3',
},
],
codecOptions: {
opusStereo: true
}
}
const streamSuccess = (stream) => {
localVideo.srcObject = stream
console.log('stream', stream);
const track = stream.getVideoTracks()[0]
params = {
track,
...params
const videoTrack = stream.getVideoTracks()[0]
const audioTrack = stream.getAudioTrack()[0]
videoParams = {
track: videoTrack,
...videoParams
}
console.log('[streamSuccess] track', params);
audioParams = {
track: audioTrack,
...audioParams
}
console.log('[streamSuccess] videoParams', videoParams, ' | audioParams', audioParams);
goConnect()
}
@ -20643,14 +20670,14 @@ const connectSendTransport = async () => {
// to send media to the Router
// https://mediasoup.org/documentation/v3/mediasoup-client/api/#transport-produce
// this action will trigger the 'connect' and 'produce' events above
producer = await producerTransport.produce(params)
producerVideo = await producerTransport.produce(videoParams)
producer.on('trackended', () => {
producerVideo.on('trackended', () => {
console.log('track ended')
// close video track
})
producer.on('transportclose', () => {
producerVideo.on('transportclose', () => {
console.log('transport ended')
// close video track
})
@ -20722,7 +20749,7 @@ const resetCallSettings = () => {
localVideo.srcObject = null
remoteVideo.srcObject = null
consumer = null
producer = null
producerVideo = null
producerTransport = null
consumerTransport = null
device = undefined

View File

@ -95,7 +95,8 @@ let device
let rtpCapabilities
let producerTransport
let consumerTransport
let producer
let producerVideo
let producerAudio
let consumer
let originAssetId
// let originAssetName = 'Adi'
@ -103,21 +104,18 @@ let originAssetId
// https://mediasoup.org/documentation/v3/mediasoup-client/api/#ProducerOptions
// https://mediasoup.org/documentation/v3/mediasoup-client/api/#transport-produce
let params = {
let videoParams = {
// mediasoup params
encodings: [
{
rid: 'r0',
maxBitrate: 100000,
scalabilityMode: 'S1T3',
},
{
rid: 'r1',
maxBitrate: 300000,
scalabilityMode: 'S1T3',
},
{
rid: 'r2',
maxBitrate: 900000,
scalabilityMode: 'S1T3',
},
@ -128,15 +126,44 @@ let params = {
}
}
let audioParams = {
// mediasoup params
encodings: [
{
maxBitrate: 100000,
scalabilityMode: 'S1T3',
},
{
maxBitrate: 300000,
scalabilityMode: 'S1T3',
},
{
maxBitrate: 900000,
scalabilityMode: 'S1T3',
},
],
codecOptions: {
opusStereo: true
}
}
const streamSuccess = (stream) => {
localVideo.srcObject = stream
console.log('stream', stream);
const track = stream.getVideoTracks()[0]
params = {
track,
...params
const videoTrack = stream.getVideoTracks()[0]
const audioTrack = stream.getAudioTrack()[0]
videoParams = {
track: videoTrack,
...videoParams
}
console.log('[streamSuccess] track', params);
audioParams = {
track: audioTrack,
...audioParams
}
console.log('[streamSuccess] videoParams', videoParams, ' | audioParams', audioParams);
goConnect()
}
@ -285,14 +312,14 @@ const connectSendTransport = async () => {
// to send media to the Router
// https://mediasoup.org/documentation/v3/mediasoup-client/api/#transport-produce
// this action will trigger the 'connect' and 'produce' events above
producer = await producerTransport.produce(params)
producerVideo = await producerTransport.produce(videoParams)
producer.on('trackended', () => {
producerVideo.on('trackended', () => {
console.log('track ended')
// close video track
})
producer.on('transportclose', () => {
producerVideo.on('transportclose', () => {
console.log('transport ended')
// close video track
})
@ -364,7 +391,7 @@ const resetCallSettings = () => {
localVideo.srcObject = null
remoteVideo.srcObject = null
consumer = null
producer = null
producerVideo = null
producerTransport = null
consumerTransport = null
device = undefined