LINXD-2270-p2 #19

Closed
sergiu wants to merge 58 commits from LINXD-2270-p2 into develop
2 changed files with 50 additions and 44 deletions
Showing only changes of commit 68c80d563f - Show all commits

View File

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

View File

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