LINXD-2270-p2 #19
@ -20370,19 +20370,20 @@ let callId = parseInt(urlParams.get('callId')) || null;
|
||||
const IS_PRODUCER = urlParams.get('producer') === 'true' ? true : false
|
||||
let remoteVideo = document.getElementById('remoteVideo')
|
||||
remoteVideo.defaultMuted = true
|
||||
let produceAudio = false
|
||||
|
||||
console.log('[URL] ASSET_ID', ASSET_ID, '| ACCOUNT_ID', ACCOUNT_ID, '| callId', callId, ' | IS_PRODUCER', IS_PRODUCER)
|
||||
|
||||
console.log('🟩 config', config)
|
||||
|
||||
checkbox = document.getElementById('produceAudio');
|
||||
checkbox.addEventListener('change', e => {
|
||||
produceAudioSelector = document.getElementById('produceAudio');
|
||||
produceAudioSelector.addEventListener('change', e => {
|
||||
if(e.target.checked) {
|
||||
produceAudio = true
|
||||
console.log('produce audio');
|
||||
} else {
|
||||
console.log('don\t produce audio');
|
||||
produceAudio = false
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
let socket, hub
|
||||
@ -20530,7 +20531,7 @@ const streamSuccess = (stream) => {
|
||||
const getLocalStream = () => {
|
||||
console.log('[getLocalStream]');
|
||||
navigator.mediaDevices.getUserMedia({
|
||||
audio: false,
|
||||
audio: produceAudio ? true : false,
|
||||
video: {
|
||||
qvga : { width: { ideal: 320 }, height: { ideal: 240 } },
|
||||
vga : { width: { ideal: 640 }, height: { ideal: 480 } },
|
||||
@ -20679,34 +20680,36 @@ const connectSendTransport = async () => {
|
||||
// this action will trigger the 'connect' and 'produce' events above
|
||||
|
||||
// Produce video
|
||||
producerVideo = await producerTransport.produce(videoParams)
|
||||
let producerVideoHandler = await producerTransport.produce(videoParams)
|
||||
console.log('videoParams', videoParams);
|
||||
console.log('producerVideo', producerVideo);
|
||||
|
||||
producerVideo.on('trackended', () => {
|
||||
producerVideoHandler.on('trackended', () => {
|
||||
console.log('track ended')
|
||||
// close video track
|
||||
})
|
||||
|
||||
producerVideo.on('transportclose', () => {
|
||||
producerVideoHandler.on('transportclose', () => {
|
||||
console.log('transport ended')
|
||||
// close video track
|
||||
})
|
||||
|
||||
// Produce audio
|
||||
// producerAudio = await producerTransport.produce(audioParams)
|
||||
// console.log('audioParams', audioParams);
|
||||
// console.log('producerAudio', producerAudio);
|
||||
if (produceAudio) {
|
||||
let producerAudioHandler = await producerTransport.produce(audioParams)
|
||||
console.log('audioParams', audioParams);
|
||||
console.log('producerAudio', producerAudio);
|
||||
|
||||
// producerAudio.on('trackended', () => {
|
||||
// console.log('track ended')
|
||||
// // close audio track
|
||||
// })
|
||||
producerAudioHandler.on('trackended', () => {
|
||||
console.log('track ended')
|
||||
// close audio track
|
||||
})
|
||||
|
||||
// producerAudio.on('transportclose', () => {
|
||||
// console.log('transport ended')
|
||||
// // close audio track
|
||||
// })
|
||||
producerAudioHandler.on('transportclose', () => {
|
||||
console.log('transport ended')
|
||||
// close audio track
|
||||
})
|
||||
}
|
||||
|
||||
const answer = {
|
||||
origin_asset_id: ASSET_ID,
|
||||
|
@ -12,19 +12,20 @@ let callId = parseInt(urlParams.get('callId')) || null;
|
||||
const IS_PRODUCER = urlParams.get('producer') === 'true' ? true : false
|
||||
let remoteVideo = document.getElementById('remoteVideo')
|
||||
remoteVideo.defaultMuted = true
|
||||
let produceAudio = false
|
||||
|
||||
console.log('[URL] ASSET_ID', ASSET_ID, '| ACCOUNT_ID', ACCOUNT_ID, '| callId', callId, ' | IS_PRODUCER', IS_PRODUCER)
|
||||
|
||||
console.log('🟩 config', config)
|
||||
|
||||
checkbox = document.getElementById('produceAudio');
|
||||
checkbox.addEventListener('change', e => {
|
||||
produceAudioSelector = document.getElementById('produceAudio');
|
||||
produceAudioSelector.addEventListener('change', e => {
|
||||
if(e.target.checked) {
|
||||
produceAudio = true
|
||||
console.log('produce audio');
|
||||
} else {
|
||||
console.log('don\t produce audio');
|
||||
produceAudio = false
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
let socket, hub
|
||||
@ -172,7 +173,7 @@ const streamSuccess = (stream) => {
|
||||
const getLocalStream = () => {
|
||||
console.log('[getLocalStream]');
|
||||
navigator.mediaDevices.getUserMedia({
|
||||
audio: false,
|
||||
audio: produceAudio ? true : false,
|
||||
video: {
|
||||
qvga : { width: { ideal: 320 }, height: { ideal: 240 } },
|
||||
vga : { width: { ideal: 640 }, height: { ideal: 480 } },
|
||||
@ -321,34 +322,36 @@ const connectSendTransport = async () => {
|
||||
// this action will trigger the 'connect' and 'produce' events above
|
||||
|
||||
// Produce video
|
||||
producerVideo = await producerTransport.produce(videoParams)
|
||||
let producerVideoHandler = await producerTransport.produce(videoParams)
|
||||
console.log('videoParams', videoParams);
|
||||
console.log('producerVideo', producerVideo);
|
||||
|
||||
producerVideo.on('trackended', () => {
|
||||
producerVideoHandler.on('trackended', () => {
|
||||
console.log('track ended')
|
||||
// close video track
|
||||
})
|
||||
|
||||
producerVideo.on('transportclose', () => {
|
||||
producerVideoHandler.on('transportclose', () => {
|
||||
console.log('transport ended')
|
||||
// close video track
|
||||
})
|
||||
|
||||
// Produce audio
|
||||
// producerAudio = await producerTransport.produce(audioParams)
|
||||
// console.log('audioParams', audioParams);
|
||||
// console.log('producerAudio', producerAudio);
|
||||
if (produceAudio) {
|
||||
let producerAudioHandler = await producerTransport.produce(audioParams)
|
||||
console.log('audioParams', audioParams);
|
||||
console.log('producerAudio', producerAudio);
|
||||
|
||||
// producerAudio.on('trackended', () => {
|
||||
// console.log('track ended')
|
||||
// // close audio track
|
||||
// })
|
||||
producerAudioHandler.on('trackended', () => {
|
||||
console.log('track ended')
|
||||
// close audio track
|
||||
})
|
||||
|
||||
// producerAudio.on('transportclose', () => {
|
||||
// console.log('transport ended')
|
||||
// // close audio track
|
||||
// })
|
||||
producerAudioHandler.on('transportclose', () => {
|
||||
console.log('transport ended')
|
||||
// close audio track
|
||||
})
|
||||
}
|
||||
|
||||
const answer = {
|
||||
origin_asset_id: ASSET_ID,
|
||||
|
Loading…
Reference in New Issue
Block a user