diff --git a/zh-cn/application-dev/reference/apis/js-apis-audio.md b/zh-cn/application-dev/reference/apis/js-apis-audio.md index f42b90abb0d58da82d213a56dff3f0a9bad5b56a..3de8a3406c1d720aaa11ecaeefafe7ecb9430246 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-audio.md +++ b/zh-cn/application-dev/reference/apis/js-apis-audio.md @@ -95,7 +95,7 @@ audio.createAudioRenderer(audioRendererOptions,(err, data) => { if (err) { console.error(`AudioRenderer Created: Error: ${err.message}`); } else { - console.info('AudioRenderer Created: Success: SUCCESS'); + console.info(`AudioRenderer Created: Success: SUCCESS`); let audioRenderer = data; } }); @@ -147,9 +147,9 @@ var audioRendererOptions = { var audioRenderer; audio.createAudioRenderer(audioRendererOptions).then((data) => { audioRenderer = data; - console.info('AudioFrameworkRenderLog: AudioRenderer Created : Success : Stream Type: SUCCESS'); + console.info(`AudioFrameworkRenderLog: AudioRenderer Created : Success : Stream Type: SUCCESS`); }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRenderer Created : ERROR : ' + err.message); + console.info(`AudioFrameworkRenderLog: AudioRenderer Created : ERROR :` + err.message); }); ``` @@ -193,7 +193,7 @@ audio.createAudioCapturer(audioCapturerOptions, (err, data) => { if (err) { console.error(`AudioCapturer Created : Error: ${err.message}`); } else { - console.info('AudioCapturer Created : Success : SUCCESS'); + console.info(`AudioCapturer Created : Success : SUCCESS`); let audioCapturer = data; } }); @@ -244,9 +244,9 @@ var audioCapturerOptions = { var audioCapturer; audio.createAudioCapturer(audioCapturerOptions).then((data) => { audioCapturer = data; - console.info('AudioCapturer Created : Success : Stream Type: SUCCESS'); + console.info(`AudioCapturer Created : Success : Stream Type: SUCCESS`); }).catch((err) => { - console.info('AudioCapturer Created : ERROR : ' + err.message); + console.info(`AudioCapturer Created : ERROR : ` + err.message); }); ``` @@ -718,10 +718,10 @@ setVolume(volumeType: AudioVolumeType, volume: number, callback: AsyncCallback&l ``` audioManager.setVolume(audio.AudioVolumeType.MEDIA, 10, (err) => { if (err) { - console.error('Failed to set the volume. ${err.message}'); + console.error(`Failed to set the volume. ${err.message}`); return; } - console.log('Callback invoked to indicate a successful volume setting.'); + console.log(`Callback invoked to indicate a successful volume setting.`); }); ``` @@ -752,7 +752,7 @@ setVolume(volumeType: AudioVolumeType, volume: number): Promise<void> ``` audioManager.setVolume(audio.AudioVolumeType.MEDIA, 10).then(() => { - console.log('Promise returned to indicate a successful volume setting.'); + console.log(`Promise returned to indicate a successful volume setting.`); }); ``` @@ -776,10 +776,10 @@ getVolume(volumeType: AudioVolumeType, callback: AsyncCallback<number>): v ``` audioManager.getVolume(audio.AudioVolumeType.MEDIA, (err, value) => { if (err) { - console.error('Failed to obtain the volume. ${err.message}'); + console.error(`Failed to obtain the volume. ${err.message}`); return; } - console.log('Callback invoked to indicate that the volume is obtained.'); + console.log(`Callback invoked to indicate that the volume is obtained.`); }); ``` @@ -807,7 +807,7 @@ getVolume(volumeType: AudioVolumeType): Promise<number> ``` audioManager.getVolume(audio.AudioVolumeType.MEDIA).then((value) => { - console.log('Promise returned to indicate that the volume is obtained.' + value); + console.log(`Promise returned to indicate that the volume is obtained.` + value); }); ``` @@ -831,10 +831,10 @@ getMinVolume(volumeType: AudioVolumeType, callback: AsyncCallback<number>) ``` audioManager.getMinVolume(audio.AudioVolumeType.MEDIA, (err, value) => { if (err) { - console.error('Failed to obtain the minimum volume. ${err.message}'); + console.error(`Failed to obtain the minimum volume. ${err.message}`); return; } - console.log('Callback invoked to indicate that the minimum volume is obtained.' + value); + console.log(`Callback invoked to indicate that the minimum volume is obtained.` + value); }); ``` @@ -862,7 +862,7 @@ getMinVolume(volumeType: AudioVolumeType): Promise<number> ``` audioManager.getMinVolume(audio.AudioVolumeType.MEDIA).then((value) => { - console.log('Promised returned to indicate that the minimum volume is obtained.' + value); + console.log(`Promised returned to indicate that the minimum volume is obtained.` + value); }); ``` @@ -886,10 +886,10 @@ getMaxVolume(volumeType: AudioVolumeType, callback: AsyncCallback<number>) ``` audioManager.getMaxVolume(audio.AudioVolumeType.MEDIA, (err, value) => { if (err) { - console.error('Failed to obtain the maximum volume. ${err.message}'); + console.error(`Failed to obtain the maximum volume. ${err.message}`); return; } - console.log('Callback invoked to indicate that the maximum volume is obtained.' + value); + console.log(`Callback invoked to indicate that the maximum volume is obtained.` + value); }); ``` @@ -917,7 +917,7 @@ getMaxVolume(volumeType: AudioVolumeType): Promise<number> ``` audioManager.getMaxVolume(audio.AudioVolumeType.MEDIA).then((data) => { - console.log('Promised returned to indicate that the maximum volume is obtained.'); + console.log(`Promised returned to indicate that the maximum volume is obtained.`); }); ``` @@ -944,10 +944,10 @@ mute(volumeType: AudioVolumeType, mute: boolean, callback: AsyncCallback<void ``` audioManager.mute(audio.AudioVolumeType.MEDIA, true, (err) => { if (err) { - console.error('Failed to mute the stream. ${err.message}'); + console.error(`Failed to mute the stream. ${err.message}`); return; } - console.log('Callback invoked to indicate that the stream is muted.'); + console.log(`Callback invoked to indicate that the stream is muted.`); }); ``` @@ -979,7 +979,7 @@ mute(volumeType: AudioVolumeType, mute: boolean): Promise<void> ``` audioManager.mute(audio.AudioVolumeType.MEDIA, true).then(() => { - console.log('Promise returned to indicate that the stream is muted.'); + console.log(`Promise returned to indicate that the stream is muted.`); }); ``` @@ -1004,10 +1004,10 @@ isMute(volumeType: AudioVolumeType, callback: AsyncCallback<boolean>): voi ``` audioManager.isMute(audio.AudioVolumeType.MEDIA, (err, value) => { if (err) { - console.error('Failed to obtain the mute status. ${err.message}'); + console.error(`Failed to obtain the mute status. ${err.message}`); return; } - console.log('Callback invoked to indicate that the mute status of the stream is obtained.' + value); + console.log(`Callback invoked to indicate that the mute status of the stream is obtained.` + value); }); ``` @@ -1036,7 +1036,7 @@ isMute(volumeType: AudioVolumeType): Promise<boolean> ``` audioManager.isMute(audio.AudioVolumeType.MEDIA).then((value) => { - console.log('Promise returned to indicate that the mute status of the stream is obtained.' + value); + console.log(`Promise returned to indicate that the mute status of the stream is obtained.` + value); }); ``` @@ -1060,10 +1060,10 @@ isActive(volumeType: AudioVolumeType, callback: AsyncCallback<boolean>): v ``` audioManager.isActive(audio.AudioVolumeType.MEDIA, (err, value) => { if (err) { - console.error('Failed to obtain the active status of the stream. ${err.message}'); + console.error(`Failed to obtain the active status of the stream. ${err.message}`); return; } - console.log('Callback invoked to indicate that the active status of the stream is obtained.' + value); + console.log(`Callback invoked to indicate that the active status of the stream is obtained.` + value); }); ``` @@ -1091,7 +1091,7 @@ isActive(volumeType: AudioVolumeType): Promise<boolean> ``` audioManager.isActive(audio.AudioVolumeType.MEDIA).then((value) => { - console.log('Promise returned to indicate that the active status of the stream is obtained.' + value); + console.log(`Promise returned to indicate that the active status of the stream is obtained.` + value); }); ``` @@ -1117,10 +1117,10 @@ setRingerMode(mode: AudioRingMode, callback: AsyncCallback<void>): void ``` audioManager.setRingerMode(audio.AudioRingMode.RINGER_MODE_NORMAL, (err) => { if (err) { - console.error('Failed to set the ringer mode.​ ${err.message}'); + console.error(`Failed to set the ringer mode.​ ${err.message}`); return; } - console.log('Callback invoked to indicate a successful setting of the ringer mode.'); + console.log(`Callback invoked to indicate a successful setting of the ringer mode.`); }); ``` @@ -1150,7 +1150,7 @@ setRingerMode(mode: AudioRingMode): Promise<void> ``` audioManager.setRingerMode(audio.AudioRingMode.RINGER_MODE_NORMAL).then(() => { - console.log('Promise returned to indicate a successful setting of the ringer mode.'); + console.log(`Promise returned to indicate a successful setting of the ringer mode.`); }); ``` @@ -1174,10 +1174,10 @@ getRingerMode(callback: AsyncCallback<AudioRingMode>): void ``` audioManager.getRingerMode((err, value) => { if (err) { - console.error('Failed to obtain the ringer mode.​ ${err.message}'); + console.error(`Failed to obtain the ringer mode.​ ${err.message}`); return; } - console.log('Callback invoked to indicate that the ringer mode is obtained.' + value); + console.log(`Callback invoked to indicate that the ringer mode is obtained.` + value); }); ``` @@ -1200,7 +1200,7 @@ getRingerMode(): Promise<AudioRingMode> ``` audioManager.getRingerMode().then((value) => { - console.log('Promise returned to indicate that the ringer mode is obtained.' + value); + console.log(`Promise returned to indicate that the ringer mode is obtained.` + value); }); ``` @@ -1229,10 +1229,10 @@ setAudioParameter(key: string, value: string, callback: AsyncCallback<void> ``` audioManager.setAudioParameter('key_example', 'value_example', (err) => { if (err) { - console.error('Failed to set the audio parameter. ${err.message}'); + console.error(`Failed to set the audio parameter. ${err.message}`); return; } - console.log('Callback invoked to indicate a successful setting of the audio parameter.'); + console.log(`Callback invoked to indicate a successful setting of the audio parameter.`); }); ``` @@ -1265,7 +1265,7 @@ setAudioParameter(key: string, value: string): Promise<void> ``` audioManager.setAudioParameter('key_example', 'value_example').then(() => { - console.log('Promise returned to indicate a successful setting of the audio parameter.'); + console.log(`Promise returned to indicate a successful setting of the audio parameter.`); }); ``` @@ -1291,10 +1291,10 @@ getAudioParameter(key: string, callback: AsyncCallback<string>): void ``` audioManager.getAudioParameter('key_example', (err, value) => { if (err) { - console.error('Failed to obtain the value of the audio parameter. ${err.message}'); + console.error(`Failed to obtain the value of the audio parameter. ${err.message}`); return; } - console.log('Callback invoked to indicate that the value of the audio parameter is obtained.' + value); + console.log(`Callback invoked to indicate that the value of the audio parameter is obtained.` + value); }); ``` @@ -1324,7 +1324,7 @@ getAudioParameter(key: string): Promise<string> ``` audioManager.getAudioParameter('key_example').then((value) => { - console.log('Promise returned to indicate that the value of the audio parameter is obtained.' + value); + console.log(`Promise returned to indicate that the value of the audio parameter is obtained.` + value); }); ``` @@ -1347,10 +1347,10 @@ getDevices(deviceFlag: DeviceFlag, callback: AsyncCallback<AudioDeviceDescrip ``` audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG, (err, value) => { if (err) { - console.error('Failed to obtain the device list. ${err.message}'); + console.error(`Failed to obtain the device list. ${err.message}`); return; } - console.log('Callback invoked to indicate that the device list is obtained.'); + console.log(`Callback invoked to indicate that the device list is obtained.`); }); ``` @@ -1378,7 +1378,7 @@ getDevices(deviceFlag: DeviceFlag): Promise<AudioDeviceDescriptors> ``` audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG).then((data) => { - console.log('Promise returned to indicate that the device list is obtained.'); + console.log(`Promise returned to indicate that the device list is obtained.`); }); ``` @@ -1403,10 +1403,10 @@ setDeviceActive(deviceType: ActiveDeviceType, active: boolean, callback: AsyncCa ``` audioManager.setDeviceActive(audio.ActiveDeviceType.SPEAKER, true, (err) => { if (err) { - console.error('Failed to set the active status of the device. ${err.message}'); + console.error(`Failed to set the active status of the device. ${err.message}`); return; } - console.log('Callback invoked to indicate that the device is set to the active status.'); + console.log(`Callback invoked to indicate that the device is set to the active status.`); }); ``` @@ -1436,7 +1436,7 @@ setDeviceActive(deviceType: ActiveDeviceType, active: boolean): Promise<void& ``` audioManager.setDeviceActive(audio.ActiveDeviceType.SPEAKER, true).then(() => { - console.log('Promise returned to indicate that the device is set to the active status.'); + console.log(`Promise returned to indicate that the device is set to the active status.`); }); ``` @@ -1460,10 +1460,10 @@ isDeviceActive(deviceType: ActiveDeviceType, callback: AsyncCallback<boolean& ``` audioManager.isDeviceActive(audio.ActiveDeviceType.SPEAKER, (err, value) => { if (err) { - console.error('Failed to obtain the active status of the device. ${err.message}'); + console.error(`Failed to obtain the active status of the device. ${err.message}`); return; } - console.log('Callback invoked to indicate that the active status of the device is obtained.'); + console.log(`Callback invoked to indicate that the active status of the device is obtained.`); }); ``` @@ -1492,7 +1492,7 @@ isDeviceActive(deviceType: ActiveDeviceType): Promise<boolean> ``` audioManager.isDeviceActive(audio.ActiveDeviceType.SPEAKER).then((value) => { - console.log('Promise returned to indicate that the active status of the device is obtained.' + value); + console.log(`Promise returned to indicate that the active status of the device is obtained.` + value); }); ``` @@ -1518,10 +1518,10 @@ setMicrophoneMute(mute: boolean, callback: AsyncCallback<void>): void ``` audioManager.setMicrophoneMute(true, (err) => { if (err) { - console.error('Failed to mute the microphone. ${err.message}'); + console.error(`Failed to mute the microphone. ${err.message}`); return; } - console.log('Callback invoked to indicate that the microphone is muted.'); + console.log(`Callback invoked to indicate that the microphone is muted.`); }); ``` @@ -1551,7 +1551,7 @@ setMicrophoneMute(mute: boolean): Promise<void> ``` audioManager.setMicrophoneMute(true).then(() => { - console.log('Promise returned to indicate that the microphone is muted.'); + console.log(`Promise returned to indicate that the microphone is muted.`); }); ``` @@ -1576,10 +1576,10 @@ isMicrophoneMute(callback: AsyncCallback<boolean>): void ``` audioManager.isMicrophoneMute((err, value) => { if (err) { - console.error('Failed to obtain the mute status of the microphone. ${err.message}'); + console.error(`Failed to obtain the mute status of the microphone. ${err.message}`); return; } - console.log('Callback invoked to indicate that the mute status of the microphone is obtained.' + value); + console.log(`Callback invoked to indicate that the mute status of the microphone is obtained.` + value); }); ``` @@ -1604,7 +1604,7 @@ isMicrophoneMute(): Promise<boolean> ``` audioManager.isMicrophoneMute().then((value) => { - console.log('Promise returned to indicate that the mute status of the microphone is obtained.', + value); + console.log(`Promise returned to indicate that the mute status of the microphone is obtained.`, + value); }); ``` @@ -1631,9 +1631,9 @@ on(type: 'volumeChange', callback: Callback\): void ``` audioManager.on('volumeChange', (volumeEvent) => { - console.log('VolumeType of stream: ' + volumeEvent.volumeType); - console.log('Volume level: ' + volumeEvent.volume); - console.log('Whether to updateUI: ' + volumeEvent.updateUi); + console.log(`VolumeType of stream: ` + volumeEvent.volumeType); + console.log(`Volume level: ` + volumeEvent.volume); + console.log(`Whether to updateUI: ` + volumeEvent.updateUi); }); ``` @@ -1658,7 +1658,7 @@ on(type: 'ringerModeChange', callback: Callback\): void ``` audioManager.on('ringerModeChange', (ringerMode) => { - console.log('Updated ringermode: ' + ringerMode); + console.log(`Updated ringermode: ` + ringerMode); }); ``` @@ -1681,10 +1681,10 @@ on(type: 'deviceChange', callback: Callback): void ``` audioManager.on('deviceChange', (deviceChanged) => { - console.info("device change type : " + deviceChanged.type); - console.info("device descriptor size : " + deviceChanged.deviceDescriptors.length); - console.info("device change descriptor : " + deviceChanged.deviceDescriptors[0].deviceRole); - console.info("device change descriptor : " + deviceChanged.deviceDescriptors[0].deviceType); + console.info(`device change type : ` + deviceChanged.type); + console.info(`device descriptor size : ` + deviceChanged.deviceDescriptors.length); + console.info(`device change descriptor : ` + deviceChanged.deviceDescriptors[0].deviceRole); + console.info(`device change descriptor : ` + deviceChanged.deviceDescriptors[0].deviceType); }); ``` @@ -1707,7 +1707,7 @@ off(type: 'deviceChange', callback?: Callback): void ``` audioManager.off('deviceChange', (deviceChanged) => { - console.log("Should be no callback."); + console.log(`Should be no callback.`); }); ``` @@ -1737,12 +1737,12 @@ var interAudioInterrupt = { }; audioManager.on('interrupt', interAudioInterrupt, (InterruptAction) => { if (InterruptAction.actionType === 0) { - console.log("An event to gain the audio focus starts."); - console.log("Focus gain event:" + JSON.stringify(InterruptAction)); + console.log(`An event to gain the audio focus starts.`); + console.log(`Focus gain event:` + JSON.stringify(InterruptAction)); } if (InterruptAction.actionType === 1) { - console.log("An audio interruption event starts."); - console.log("Audio interruption event:" + JSON.stringify(InterruptAction)); + console.log(`An audio interruption event starts.`); + console.log(`Audio interruption event:` + JSON.stringify(InterruptAction)); } }); ``` @@ -1773,8 +1773,8 @@ var interAudioInterrupt = { }; audioManager.off('interrupt', interAudioInterrupt, (InterruptAction) => { if (InterruptAction.actionType === 0) { - console.log("An event to release the audio focus starts."); - console.log("Focus release event:" + JSON.stringify(InterruptAction)); + console.log(`An event to release the audio focus starts.`); + console.log(`Focus release event:` + JSON.stringify(InterruptAction)); } }); ``` @@ -1801,10 +1801,10 @@ setAudioScene\(scene: AudioScene, callback: AsyncCallback\): void ``` audioManager.setAudioScene(audio.AudioScene.AUDIO_SCENE_PHONE_CALL, (err) => { if (err) { - console.error('Failed to set the audio scene mode.​ ${err.message}'); + console.error(`Failed to set the audio scene mode.​ ${err.message}`); return; } - console.log('Callback invoked to indicate a successful setting of the audio scene mode.'); + console.log(`Callback invoked to indicate a successful setting of the audio scene mode.`); }); ``` @@ -1834,9 +1834,9 @@ setAudioScene\(scene: AudioScene\): Promise ``` audioManager.setAudioScene(audio.AudioScene.AUDIO_SCENE_PHONE_CALL).then(() => { - console.log('Promise returned to indicate a successful setting of the audio scene mode.'); + console.log(`Promise returned to indicate a successful setting of the audio scene mode.`); }).catch ((err) => { - console.log('Failed to set the audio scene mode'); + console.log(`Failed to set the audio scene mode`); }); ``` @@ -1859,10 +1859,10 @@ getAudioScene\(callback: AsyncCallback\): void ``` audioManager.getAudioScene((err, value) => { if (err) { - console.error('Failed to obtain the audio scene mode.​ ${err.message}'); + console.error(`Failed to obtain the audio scene mode.​ ${err.message}`); return; } - console.log('Callback invoked to indicate that the audio scene mode is obtained.' + value); + console.log(`Callback invoked to indicate that the audio scene mode is obtained.` + value); }); ``` @@ -1885,9 +1885,9 @@ getAudioScene\(\): Promise ``` audioManager.getAudioScene().then((value) => { - console.log('Promise returned to indicate that the audio scene mode is obtained.' + value); + console.log(`Promise returned to indicate that the audio scene mode is obtained.` + value); }).catch ((err) => { - console.log('Failed to obtain the audio scene mode'); + console.log(`Failed to obtain the audio scene mode`); }); ``` @@ -1912,30 +1912,30 @@ getCurrentAudioRendererInfoArray(callback: AsyncCallback<AudioRendererChangeI **示例:** ``` audioStreamManager.getCurrentAudioRendererInfoArray(async (err, AudioRendererChangeInfoArray) => { - console.info('getCurrentAudioRendererInfoArray **** Get Callback Called ****'); + console.info(`getCurrentAudioRendererInfoArray **** Get Callback Called ****`); if (err) { - console.log('getCurrentAudioRendererInfoArray :ERROR: '+ err.message); + console.log(`getCurrentAudioRendererInfoArray :ERROR: `+ err.message); resultFlag = false; } else { if (AudioRendererChangeInfoArray != null) { for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { AudioRendererChangeInfo = AudioRendererChangeInfoArray[i]; - console.info('StreamId for' + i + 'is:' + AudioRendererChangeInfo.streamId); - console.info('ClientUid for' + i + 'is:' + AudioRendererChangeInfo.clientUid); - console.info('Content' + i + 'is:' + AudioRendererChangeInfo.rendererInfo.content); - console.info('Stream'+ i + 'is:' + AudioRendererChangeInfo.rendererInfo.usage); - console.info('Flag'+ i +' is:' + AudioRendererChangeInfo.rendererInfo.rendererFlags); - console.info('State for' + i +' is:' + AudioRendererChangeInfo.rendererState); + console.info(`StreamId for` + i + `is:` + AudioRendererChangeInfo.streamId); + console.info(`ClientUid for` + i + `is:` + AudioRendererChangeInfo.clientUid); + console.info(`Content` + i + `is:` + AudioRendererChangeInfo.rendererInfo.content); + console.info(`Stream`+ i + `is:` + AudioRendererChangeInfo.rendererInfo.usage); + console.info(`Flag`+ i + `is:` + AudioRendererChangeInfo.rendererInfo.rendererFlags); + console.info(`State for` + i + `is:` + AudioRendererChangeInfo.rendererState); var devDescriptor = AudioRendererChangeInfo.deviceDescriptors; for (let j = 0;j < AudioRendererChangeInfo.deviceDescriptors.length; j++) { - console.info('Id:' + i +':' + AudioRendererChangeInfo.deviceDescriptors[j].id); - console.info('Type:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].deviceType); - console.info('Role:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].deviceRole); - console.info('Name:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].name); - console.info('Address:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].address); - console.info('SampleRates:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].sampleRates[0]); - console.info('ChannelCount' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].channelCounts[0]); - console.info('ChannelMask:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].channelMasks); + console.info(`Id:` + i + `:` + AudioRendererChangeInfo.deviceDescriptors[j].id); + console.info(`Type:` + i + `:` + AudioRendererChangeInfo.deviceDescriptors[j].deviceType); + console.info(`Role:` + i + `:` + AudioRendererChangeInfo.deviceDescriptors[j].deviceRole); + console.info(`Name:` + i + `:` + AudioRendererChangeInfo.deviceDescriptors[j].name); + console.info(`Address:` + i + `:` + AudioRendererChangeInfo.deviceDescriptors[j].address); + console.info(`SampleRates:` + i + `:` + AudioRendererChangeInfo.deviceDescriptors[j].sampleRates[0]); + console.info(`ChannelCount` + i + `:` + AudioRendererChangeInfo.deviceDescriptors[j].channelCounts[0]); + console.info(`ChannelMask:` + i + `:` + AudioRendererChangeInfo.deviceDescriptors[j].channelMasks); } } } @@ -1960,31 +1960,31 @@ getCurrentAudioRendererInfoArray(): Promise<AudioRendererChangeInfoArray> **示例:** ``` await audioStreamManager.getCurrentAudioRendererInfoArray().then( function (AudioRendererChangeInfoArray) { - console.info('getCurrentAudioRendererInfoArray ######### Get Promise is called ##########'); + console.info(`getCurrentAudioRendererInfoArray ######### Get Promise is called ##########`); if (AudioRendererChangeInfoArray != null) { for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { AudioRendererChangeInfo = AudioRendererChangeInfoArray[i]; - console.info('StreamId for ' + i +' is:' + AudioRendererChangeInfo.streamId); - console.info('ClientUid for ' + i + ' is:' + AudioRendererChangeInfo.clientUid); - console.info('Content ' + i + ' is:' + AudioRendererChangeInfo.rendererInfo.content); - console.info('Stream' + i +' is:' + AudioRendererChangeInfo.rendererInfo.usage); - console.info('Flag' + i + ' is:' + AudioRendererChangeInfo.rendererInfo.rendererFlags); - console.info('State for ' + i + ' is:' + AudioRendererChangeInfo.rendererState); + console.info(`StreamId for` + i + ` is:` + AudioRendererChangeInfo.streamId); + console.info(`ClientUid for` + i + ` is:` + AudioRendererChangeInfo.clientUid); + console.info(`Content` + i + ` is:` + AudioRendererChangeInfo.rendererInfo.content); + console.info(`Stream` + i + ` is:` + AudioRendererChangeInfo.rendererInfo.usage); + console.info(`Flag` + i + ` is:` + AudioRendererChangeInfo.rendererInfo.rendererFlags); + console.info(`State for` + i + ` is:` + AudioRendererChangeInfo.rendererState); var devDescriptor = AudioRendererChangeInfo.deviceDescriptors; for (let j = 0; j < AudioRendererChangeInfo.deviceDescriptors.length; j++) { - console.info('Id:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].id); - console.info('Type:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].deviceType); - console.info('Role:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].deviceRole); - console.info('Name:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].name); - console.info('Address:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].address); - console.info('SampleRates:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].sampleRates[0]); - console.info('ChannelCounts' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].channelCounts[0]); - console.info('ChannnelMask:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].channelMasks); + console.info(`Id:` + i + `:` + AudioRendererChangeInfo.deviceDescriptors[j].id); + console.info(`Type:` + i + `:` + AudioRendererChangeInfo.deviceDescriptors[j].deviceType); + console.info(`Role:` + i + `:` + AudioRendererChangeInfo.deviceDescriptors[j].deviceRole); + console.info(`Name:` + i + `:` + AudioRendererChangeInfo.deviceDescriptors[j].name); + console.info(`Address:` + i + `:` + AudioRendererChangeInfo.deviceDescriptors[j].address); + console.info(`SampleRates:` + i + `:` + AudioRendererChangeInfo.deviceDescriptors[j].sampleRates[0]); + console.info(`ChannelCounts` + i + `:` + AudioRendererChangeInfo.deviceDescriptors[j].channelCounts[0]); + console.info(`ChannnelMask:` + i + `:` + AudioRendererChangeInfo.deviceDescriptors[j].channelMasks); } } } }).catch((err) => { - console.log('getCurrentAudioRendererInfoArray :ERROR: ' + err.message); + console.log(`getCurrentAudioRendererInfoArray :ERROR: ` + err.message); }); ``` @@ -2005,27 +2005,27 @@ getCurrentAudioCapturerInfoArray(callback: AsyncCallback<AudioCapturerChangeI **示例:** ``` audioStreamManager.getCurrentAudioCapturerInfoArray(async (err, AudioCapturerChangeInfoArray) => { - console.info('getCurrentAudioCapturerInfoArray **** Get Callback Called ****'); + console.info(`getCurrentAudioCapturerInfoArray **** Get Callback Called ****`); if (err) { - console.log('getCurrentAudioCapturerInfoArray :ERROR: '+err.message); + console.log(`getCurrentAudioCapturerInfoArray :ERROR: ` + err.message); } else { if (AudioCapturerChangeInfoArray != null) { for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { - console.info('StreamId for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].streamId); - console.info('ClientUid for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].clientUid); - console.info('Source for '+ i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.source); - console.info('Flag ' + i +'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); - console.info('State for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerState); + console.info(`StreamId for ` + i + `is:` + AudioCapturerChangeInfoArray[i].streamId); + console.info(`ClientUid for ` + i + `is:` + AudioCapturerChangeInfoArray[i].clientUid); + console.info(`Source for `+ i + `is:` + AudioCapturerChangeInfoArray[i].capturerInfo.source); + console.info(`Flag ` + i + `is:` + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); + console.info(`State for ` + i + `is:` + AudioCapturerChangeInfoArray[i].capturerState); var devDescriptor = AudioCapturerChangeInfoArray[i].deviceDescriptors; for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { - console.info('Id:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id); - console.info('Type:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType); - console.info('Role:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole); - console.info('Name:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name); - console.info('Address:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); - console.info('SampleRates:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]); - console.info('ChannelCounts' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]); - console.info('ChannelMask:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks); + console.info(`Id:` + i + `:` + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id); + console.info(`Type:` + i + `:` + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType); + console.info(`Role:` + i + `:` + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole); + console.info(`Name:` + i + `:` + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name); + console.info(`Address:` + i + `:` + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); + console.info(`SampleRates:` + i + `:` + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]); + console.info(`ChannelCounts` + i + `:` + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]); + console.info(`ChannelMask:` + i + `:` + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks); } } } @@ -2050,29 +2050,29 @@ getCurrentAudioCapturerInfoArray(): Promise<AudioCapturerChangeInfoArray> **示例:** ``` await audioStreamManager.getCurrentAudioCapturerInfoArray().then( function (AudioCapturerChangeInfoArray) { - console.info('getCurrentAudioCapturerInfoArray **** Get Promise Called ****'); + console.info(`getCurrentAudioCapturerInfoArray **** Get Promise Called ****`); if (AudioCapturerChangeInfoArray != null) { for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { - console.info('StreamId for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].streamId); - console.info('ClientUid for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].clientUid); - console.info('Source for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.source); - console.info('Flag ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); - console.info('State for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerState); + console.info(`StreamId for ` + i + `is:` + AudioCapturerChangeInfoArray[i].streamId); + console.info(`ClientUid for ` + i + `is:` + AudioCapturerChangeInfoArray[i].clientUid); + console.info(`Source for ` + i + `is:` + AudioCapturerChangeInfoArray[i].capturerInfo.source); + console.info(`Flag ` + i + `is:` + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); + console.info(`State for ` + i + `is:` + AudioCapturerChangeInfoArray[i].capturerState); var devDescriptor = AudioCapturerChangeInfoArray[i].deviceDescriptors; for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { - console.info('Id:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id); - console.info('Type:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType); - console.info('Role:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole); - console.info('Name:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name) - console.info('Address:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); - console.info('SampleRates:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]); - console.info('ChannelCounts' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]); - console.info('ChannelMask:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks); + console.info(`Id:` + i + `:` + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id); + console.info(`Type:` + i + `:` + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType); + console.info(`Role:` + i + `:` + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole); + console.info(`Name:` + i + `:` + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name) + console.info(`Address:` + i + `:` + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); + console.info(`SampleRates:` + i + `:` + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]); + console.info(`ChannelCounts` + i + `:` + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]); + console.info(`ChannelMask:` + i + `:` + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks); } } } }).catch((err) => { - console.log('getCurrentAudioCapturerInfoArray :ERROR: ' + err.message); + console.log(`getCurrentAudioCapturerInfoArray :ERROR: ` + err.message); }); ``` @@ -2096,23 +2096,23 @@ on(type: "audioRendererChange", callback: Callback<AudioRendererChangeInfoArr audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { AudioRendererChangeInfo = AudioRendererChangeInfoArray[i]; - console.info('## RendererChange on is called for ' + i + ' ##'); - console.info('StreamId for ' + i + ' is:' + AudioRendererChangeInfo.streamId); - console.info('ClientUid for ' + i + ' is:' + AudioRendererChangeInfo.clientUid); - console.info('Content for ' + i + ' is:' + AudioRendererChangeInfo.rendererInfo.content); - console.info('Stream for ' + i + ' is:' + AudioRendererChangeInfo.rendererInfo.usage); - console.info('Flag ' + i + ' is:' + AudioRendererChangeInfo.rendererInfo.rendererFlags); - console.info('State for ' + i + ' is:' + AudioRendererChangeInfo.rendererState); + console.info(`## RendererChange on is called for ` + i + ` ##`); + console.info(`StreamId for ` + i + ` is:` + AudioRendererChangeInfo.streamId); + console.info(`ClientUid for ` + i + ` is:` + AudioRendererChangeInfo.clientUid); + console.info(`Content for ` + i + ` is:` + AudioRendererChangeInfo.rendererInfo.content); + console.info(`Stream for ` + i + ` is:` + AudioRendererChangeInfo.rendererInfo.usage); + console.info(`Flag ` + i + ` is:` + AudioRendererChangeInfo.rendererInfo.rendererFlags); + console.info(`State for ` + i + ` is:` + AudioRendererChangeInfo.rendererState); var devDescriptor = AudioRendererChangeInfo.deviceDescriptors; for (let j = 0; j < AudioRendererChangeInfo.deviceDescriptors.length; j++) { - console.info('Id:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].id); - console.info('Type:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].deviceType); - console.info('Role:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].deviceRole); - console.info('Name:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].name); - console.info('Address:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].address); - console.info('SampleRates:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].sampleRates[0]); - console.info('ChannelCounts' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].channelCounts[0]); - console.info('ChannelMask:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].channelMasks); + console.info(`Id:` + i + `:` + AudioRendererChangeInfo.deviceDescriptors[j].id); + console.info(`Type:` + i + `:` + AudioRendererChangeInfo.deviceDescriptors[j].deviceType); + console.info(`Role:` + i + `:` + AudioRendererChangeInfo.deviceDescriptors[j].deviceRole); + console.info(`Name:` + i + `:` + AudioRendererChangeInfo.deviceDescriptors[j].name); + console.info(`Address:` + i + `:` + AudioRendererChangeInfo.deviceDescriptors[j].address); + console.info(`SampleRates:` + i + `:` + AudioRendererChangeInfo.deviceDescriptors[j].sampleRates[0]); + console.info(`ChannelCounts` + i + `:` + AudioRendererChangeInfo.deviceDescriptors[j].channelCounts[0]); + console.info(`ChannelMask:` + i + `:` + AudioRendererChangeInfo.deviceDescriptors[j].channelMasks); } } }); @@ -2135,7 +2135,7 @@ off(type: "audioRendererChange"); **示例:** ``` audioStreamManager.off('audioRendererChange'); -console.info('######### RendererChange Off is called #########'); +console.info(`######### RendererChange Off is called #########`); ``` ### on('audioCapturerChange')9+ @@ -2157,21 +2157,21 @@ on(type: "audioCapturerChange", callback: Callback<AudioCapturerChangeInfoArr ``` audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { - console.info(' ## CapChange on is called for element ' + i + ' ##'); - console.info('StreamId for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].streamId); - console.info('ClientUid for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].clientUid); - console.info('Source for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.source); - console.info('Flag ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); - console.info('State for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerState); + console.info(` ## CapChange on is called for element ' + i + ' ##'); + console.info(`StreamId for ` + i + `is:` + AudioCapturerChangeInfoArray[i].streamId); + console.info(`ClientUid for ` + i + `is:` + AudioCapturerChangeInfoArray[i].clientUid); + console.info(`Source for ` + i + `is:` + AudioCapturerChangeInfoArray[i].capturerInfo.source); + console.info(`Flag ` + i + `is:` + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); + console.info(`State for ` + i + `is:` + AudioCapturerChangeInfoArray[i].capturerState); for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { - console.info('Id:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id); - console.info('Type:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType); - console.info('Role:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole); - console.info('Name:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name); - console.info('Address:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); - console.info('SampleRates:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]); - console.info('ChannelCounts' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]); - console.info('ChannelMask:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks); + console.info(`Id:` + i + `:` + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id); + console.info(`Type:` + i + `:` + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType); + console.info(`Role:` + i + `:` + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole); + console.info(`Name:` + i + `:` + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name); + console.info(`Address:` + i + `:` + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); + console.info(`SampleRates:` + i + `:` + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]); + console.info(`ChannelCounts` + i + `:` + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]); + console.info(`ChannelMask:` + i + `:` + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks); } } }); @@ -2194,7 +2194,7 @@ off(type: "audioCapturerChange"); **示例:** ``` audioStreamManager.off('audioCapturerChange'); -console.info('######### CapturerChange Off is called #########'); +console.info(`######### CapturerChange Off is called #########`); ``` @@ -2227,7 +2227,7 @@ var AudioStreamInfo = { var audioStreamManager = audioManager.getStreamManager(); audioStreamManager.isAudioRendererLowLatencySupported(AudioStreamInfo, (result) => { - console.info('isAudioRendererLowLatencySupported success var = ' + result); + console.info(`isAudioRendererLowLatencySupported success var = ` + result); }); ``` @@ -2265,7 +2265,7 @@ var AudioStreamInfo = { var audioStreamManager = await audioManager.getStreamManager(); var result = audioStreamManager.isAudioRendererLowLatencySupported(AudioStreamInfo); -console.info('isAudioRendererLowLatencySupported success var =' + result); +console.info(`isAudioRendererLowLatencySupported success var =` + result); ``` ## AudioRendererChangeInfo9+ @@ -2299,43 +2299,43 @@ var resultFlag = false; await audioManager.getStreamManager().then(async function (data) { audioStreamManager = data; - console.info(Tag + 'Get AudioStream Manager : Success '); + console.info(Tag + `Get AudioStream Manager : Success `); }).catch((err) => { - console.info(Tag + 'Get AudioStream Manager : ERROR : ' + err.message); + console.info(Tag + `Get AudioStream Manager : ERROR : ` + err.message); }); audioManager.getStreamManager((err, data) => { if (err) { - console.error(Tag + 'Get AudioStream Manager : ERROR : ' + err.message); + console.error(Tag + `Get AudioStream Manager : ERROR : ` + err.message); } else { audioStreamManagerCB = data; - console.info(Tag + 'Get AudioStream Manager : Success '); + console.info(Tag + `Get AudioStream Manager : Success `); } }); audioStreamManagerCB.on('audioRendererChange', (AudioRendererChangeInfoArray) => { for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { - console.info(Tag+'## RendererChange on is called for ' + i + ' ##'); - console.info(Tag+'StreamId for ' + i + 'is:' + AudioRendererChangeInfoArray[i].streamId); - console.info(Tag+'ClientUid for ' + i + 'is:' + AudioRendererChangeInfoArray[i].clientUid); - console.info(Tag+'Content for ' + i + 'is:' + AudioRendererChangeInfoArray[i].rendererInfo.content); - console.info(Tag+'Stream for ' + i + 'is:' + AudioRendererChangeInfoArray[i].rendererInfo.usage); - console.info(Tag+'Flag ' + i + 'is:' + AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags); - console.info(Tag+'State for ' + i + 'is:' + AudioRendererChangeInfoArray[i].rendererState); + console.info(Tag + `## RendererChange on is called for ` + i + ` ##`); + console.info(Tag + `StreamId for ` + i + `is:` + AudioRendererChangeInfoArray[i].streamId); + console.info(Tag + `ClientUid for ` + i + `is:` + AudioRendererChangeInfoArray[i].clientUid); + console.info(Tag + `Content for ` + i + `is:` + AudioRendererChangeInfoArray[i].rendererInfo.content); + console.info(Tag + `Stream for ` + i + `is:` + AudioRendererChangeInfoArray[i].rendererInfo.usage); + console.info(Tag + `Flag ` + i + `is:` + AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags); + console.info(Tag + `State for ` + i + `is:` + AudioRendererChangeInfoArray[i].rendererState); var devDescriptor = AudioRendererChangeInfoArray[i].deviceDescriptors; for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { - console.info(Tag+'Id:' + i + ':' + AudioRendererChangeInfoArray[i].deviceDescriptors[j].id); - console.info(Tag+'Type:' + i + ':' + AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType); - console.info(Tag+'Role:' + i + ':' + AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole); - console.info(Tag+'Name:' + i + ':' + AudioRendererChangeInfoArray[i].deviceDescriptors[j].name); - console.info(Tag+'Addr:' + i + ':' + AudioRendererChangeInfoArray[i].deviceDescriptors[j].address); - console.info(Tag+'SR:' + i + ':' + AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]); - console.info(Tag+'C' + i + ':' + AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]); - console.info(Tag+'CM:' + i + ':' + AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks); + console.info(Tag + `Id:` + i + `:` + AudioRendererChangeInfoArray[i].deviceDescriptors[j].id); + console.info(Tag + `Type:` + i + `:` + AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType); + console.info(Tag + `Role:` + i + `:` + AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole); + console.info(Tag + `Name:` + i + `:` + AudioRendererChangeInfoArray[i].deviceDescriptors[j].name); + console.info(Tag + `Addr:` + i + `:` + AudioRendererChangeInfoArray[i].deviceDescriptors[j].address); + console.info(Tag + `SR:` + i + `:` + AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]); + console.info(Tag + `C` + i + `:` + AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]); + console.info(Tag + `CM:` + i + `:` + AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks); } if (AudioRendererChangeInfoArray[i].rendererState == 1 && devDescriptor != null) { resultFlag = true; - console.info(Tag + 'ResultFlag for '+ i +' is:'+ resultFlag); + console.info(Tag + `ResultFlag for ` + i + ` is:` + resultFlag); } } }); @@ -2370,26 +2370,26 @@ var Tag = "AFCapLog : "; var resultFlag = false; audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { - console.info(Tag + ' ## CapChange on is called for element ' + i + ' ##'); - console.info(Tag + 'StrId for ' + i +'is:' + AudioCapturerChangeInfoArray[i].streamId); - console.info(Tag + 'CUid for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].clientUid); - console.info(Tag + 'Src for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.source); - console.info(Tag + 'Flag ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); - console.info(Tag + 'State for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerState); + console.info(Tag + ` ## CapChange on is called for element ' + i + ' ##'); + console.info(Tag + `StrId for ` + i + `is:` + AudioCapturerChangeInfoArray[i].streamId); + console.info(Tag + `CUid for ` + i + `is:` + AudioCapturerChangeInfoArray[i].clientUid); + console.info(Tag + `Src for ` + i + `is:` + AudioCapturerChangeInfoArray[i].capturerInfo.source); + console.info(Tag + `Flag ` + i + `is:` + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); + console.info(Tag + `State for ` + i + `is:` + AudioCapturerChangeInfoArray[i].capturerState); var devDescriptor = AudioCapturerChangeInfoArray[i].deviceDescriptors; for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { - console.info(Tag + 'Id:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id); - console.info(Tag + 'Type:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType); - console.info(Tag + 'Role:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole); - console.info(Tag + 'Name:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name); - console.info(Tag + 'Addr:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); - console.info(Tag + 'SR:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]); - console.info(Tag + 'C' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]); - console.info(Tag + 'CM:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks); + console.info(Tag + `Id:` + i + `:` + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id); + console.info(Tag + `Type:` + i + `:` + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType); + console.info(Tag + `Role:` + i + `:` + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole); + console.info(Tag + `Name:` + i + `:` + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name); + console.info(Tag + `Addr:` + i + `:` + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); + console.info(Tag + `SR:` + i + `:` + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]); + console.info(Tag + `C` + i + `:` + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]); + console.info(Tag + `CM:` + i + `:` + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks); } if (AudioCapturerChangeInfoArray[i].capturerState == 1 && devDescriptor != null) { resultFlag = true; - console.info(Tag + 'ResultFlag for element ' + i + ' is: ' + resultFlag); + console.info(Tag + `ResultFlag for element ` + i + ` is: ` + resultFlag); } } }); @@ -2430,12 +2430,12 @@ var deviceRoleValue = null; var deviceTypeValue = null; const promise = audio.getAudioManager().getDevices(1); promise.then(function (value) { - console.info('AudioFrameworkTest: Promise: getDevices OUTPUT_DEVICES_FLAG'); + console.info(`AudioFrameworkTest: Promise: getDevices OUTPUT_DEVICES_FLAG`); value.forEach(displayDeviceProp); if (deviceTypeValue != null && deviceRoleValue != null){ - console.info('AudioFrameworkTest: Promise: getDevices : OUTPUT_DEVICES_FLAG : PASS'); + console.info(`AudioFrameworkTest: Promise: getDevices : OUTPUT_DEVICES_FLAG : PASS`); } else { - console.info('AudioFrameworkTest: Promise: getDevices : OUTPUT_DEVICES_FLAG : FAIL'); + console.info(`AudioFrameworkTest: Promise: getDevices : OUTPUT_DEVICES_FLAG : FAIL`); } }); ``` @@ -2476,10 +2476,10 @@ getRendererInfo(callback: AsyncCallback): void ``` audioRenderer.getRendererInfo((err, rendererInfo) => { - console.log('Renderer GetRendererInfo:'); - console.log('Renderer content:' + rendererInfo.content); - console.log('Renderer usage:' + rendererInfo.usage); - console.log('Renderer flags:' + rendererInfo.rendererFlags); + console.log(`Renderer GetRendererInfo:`); + console.log(`Renderer content:` + rendererInfo.content); + console.log(`Renderer usage:` + rendererInfo.usage); + console.log(`Renderer flags:` + rendererInfo.rendererFlags); }); ``` @@ -2502,12 +2502,12 @@ getRendererInfo(): Promise ``` var resultFlag = true; audioRenderer.getRendererInfo().then((rendererInfo) => { - console.log('Renderer GetRendererInfo:'); - console.log('Renderer content:' + rendererInfo.content); - console.log('Renderer usage:' + rendererInfo.usage); - console.log('Renderer flags:' + rendererInfo.rendererFlags); + console.log(`Renderer GetRendererInfo:`); + console.log(`Renderer content:` + rendererInfo.content); + console.log(`Renderer usage:` + rendererInfo.usage); + console.log(`Renderer flags:` + rendererInfo.rendererFlags); }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); + console.log(`AudioFrameworkRenderLog: RendererInfo :ERROR: ` + err.message); resultFlag = false; }); ``` @@ -2530,11 +2530,11 @@ getStreamInfo(callback: AsyncCallback): void ``` audioRenderer.getStreamInfo((err, streamInfo) => { - console.log('Renderer GetStreamInfo:'); - console.log('Renderer sampling rate:' + streamInfo.samplingRate); - console.log('Renderer channel:' + streamInfo.channels); - console.log('Renderer format:' + streamInfo.sampleFormat); - console.log('Renderer encoding type:' + streamInfo.encodingType); + console.log(`Renderer GetStreamInfo:`); + console.log(`Renderer sampling rate:` + streamInfo.samplingRate); + console.log(`Renderer channel:` + streamInfo.channels); + console.log(`Renderer format:` + streamInfo.sampleFormat); + console.log(`Renderer encoding type:` + streamInfo.encodingType); }); ``` @@ -2556,13 +2556,13 @@ getStreamInfo(): Promise ``` audioRenderer.getStreamInfo().then((streamInfo) => { - console.log('Renderer GetStreamInfo:'); - console.log('Renderer sampling rate:' + streamInfo.samplingRate); - console.log('Renderer channel:' + streamInfo.channels); - console.log('Renderer format:' + streamInfo.sampleFormat); - console.log('Renderer encoding type:' + streamInfo.encodingType); + console.log(`Renderer GetStreamInfo:`); + console.log(`Renderer sampling rate:` + streamInfo.samplingRate); + console.log(`Renderer channel:` + streamInfo.channels); + console.log(`Renderer format:` + streamInfo.sampleFormat); + console.log(`Renderer encoding type:` + streamInfo.encodingType); }).catch((err) => { - console.log('ERROR: '+err.message); + console.log(`ERROR: ` + err.message); }); ``` @@ -2585,9 +2585,9 @@ start(callback: AsyncCallback): void ``` audioRenderer.start((err) => { if (err) { - console.error('Renderer start failed.'); + console.error(`Renderer start failed.`); } else { - console.info('Renderer start success.'); + console.info(`Renderer start success.`); } }); ``` @@ -2610,9 +2610,9 @@ start(): Promise ``` audioRenderer.start().then(() => { - console.log('Renderer started'); + console.log(`Renderer started`); }).catch((err) => { - console.log('ERROR: ' + err.message); + console.log(`ERROR: ` + err.message); }); ``` @@ -2635,9 +2635,9 @@ pause(callback: AsyncCallback\): void ``` audioRenderer.pause((err) => { if (err) { - console.error('Renderer pause failed'); + console.error(`Renderer pause failed`); } else { - console.log('Renderer paused.'); + console.log(`Renderer paused.`); } }); ``` @@ -2660,9 +2660,9 @@ pause(): Promise\ ``` audioRenderer.pause().then(() => { - console.log('Renderer paused'); + console.log(`Renderer paused`); }).catch((err) => { - console.log('ERROR: '+err.message); + console.log(`ERROR: ` + err.message); }); ``` @@ -2685,9 +2685,9 @@ drain(callback: AsyncCallback\): void ``` audioRenderer.drain((err) => { if (err) { - console.error('Renderer drain failed'); + console.error(`Renderer drain failed`); } else { - console.log('Renderer drained.'); + console.log(`Renderer drained.`); } }); ``` @@ -2710,9 +2710,9 @@ drain(): Promise\ ``` audioRenderer.drain().then(() => { - console.log('Renderer drained successfully'); + console.log(`Renderer drained successfully`); }).catch((err) => { - console.log('ERROR: '+ err.message); + console.log(`ERROR: ` + err.message); }); ``` @@ -2735,9 +2735,9 @@ stop(callback: AsyncCallback\): void ``` audioRenderer.stop((err) => { if (err) { - console.error('Renderer stop failed'); + console.error(`Renderer stop failed`); } else { - console.log('Renderer stopped.'); + console.log(`Renderer stopped.`); } }); ``` @@ -2760,9 +2760,9 @@ stop(): Promise\ ``` audioRenderer.stop().then(() => { - console.log('Renderer stopped successfully'); + console.log(`Renderer stopped successfully`); }).catch((err) => { - console.log('ERROR: ' + err.message); + console.log(`ERROR: ` + err.message); }); ``` @@ -2785,9 +2785,9 @@ release(callback: AsyncCallback\): void ``` audioRenderer.release((err) => { if (err) { - console.error('Renderer release failed'); + console.error(`Renderer release failed`); } else { - console.log('Renderer released.'); + console.log(`Renderer released.`); } }); ``` @@ -2810,9 +2810,9 @@ release(): Promise\ ``` audioRenderer.release().then(() => { - console.log('Renderer released successfully'); + console.log(`Renderer released successfully`); }).catch((err) => { - console.log('ERROR: '+ err.message); + console.log(`ERROR: ` + err.message); }); ``` @@ -2858,18 +2858,18 @@ var audioRendererOptions = { var audioRenderer; audio.createAudioRenderer(audioRendererOptions).then((data)=> { audioRenderer = data; - console.info('AudioFrameworkRenderLog: AudioRenderer Created: SUCCESS'); + console.info(`AudioFrameworkRenderLog: AudioRenderer Created: SUCCESS`); }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRenderer Created: ERROR: ' + err.message); + console.info(`AudioFrameworkRenderLog: AudioRenderer Created: ERROR: ` + err.message); }); var bufferSize; audioRenderer.getBufferSize().then((data)=> { - console.info('AudioFrameworkRenderLog: getBufferSize: SUCCESS ' + data); + console.info(`AudioFrameworkRenderLog: getBufferSize: SUCCESS ` + data); bufferSize = data; }).catch((err) => { - console.info.('AudioFrameworkRenderLog: getBufferSize: ERROR: ' + err.message); + console.info.(`AudioFrameworkRenderLog: getBufferSize: ERROR: ` + err.message); }); -console.info('Buffer size:'+bufferSize); +console.info(`Buffer size:` + bufferSize); var context = featureAbility.getContext(); var path = await context.getCacheDir(); var filePath = path + "/StarWars10s-2C-48000-4SW.wav"; @@ -2878,9 +2878,9 @@ let buf = new ArrayBuffer(bufferSize); ss.readSync(buf); audioRenderer.write(buf, (err, writtenbytes) => { if (writtenbytes < 0) { - console.error('write failed.'); + console.error(`write failed.`); } else { - console.log('Actual written bytes: ' + writtenbytes); + console.log(`Actual written bytes: ` + writtenbytes); } }); ``` @@ -2926,18 +2926,18 @@ var audioRendererOptions = { var audioRenderer; audio.createAudioRenderer(audioRendererOptions).then((data) => { audioRenderer = data; - console.info('AudioFrameworkRenderLog: AudioRenderer Created: SUCCESS'); + console.info(`AudioFrameworkRenderLog: AudioRenderer Created: SUCCESS`); }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRenderer Created: ERROR: ' + err.message); + console.info(`AudioFrameworkRenderLog: AudioRenderer Created: ERROR: ` + err.message); }); var bufferSize; audioRenderer.getBufferSize().then((data) => { - console.info('AudioFrameworkRenderLog: getBufferSize: SUCCESS ' + data); + console.info(`AudioFrameworkRenderLog: getBufferSize: SUCCESS ` + data); bufferSize = data; }).catch((err) => { - console.info('AudioFrameworkRenderLog: getBufferSize: ERROR: ' + err.message); + console.info(`AudioFrameworkRenderLog: getBufferSize: ERROR: ` + err.message); }); -console.info('BufferSize: ' + bufferSize); +console.info(`BufferSize: ` + bufferSize); var context = featureAbility.getContext(); var path = await context.getCacheDir(); var filePath = 'data/StarWars10s-2C-48000-4SW.wav'; @@ -2946,12 +2946,12 @@ let buf = new ArrayBuffer(bufferSize); ss.readSync(buf); audioRenderer.write(buf).then((writtenbytes) => { if (writtenbytes < 0) { - console.error('write failed.'); + console.error(`write failed.`); } else { - console.log('Actual written bytes: ' + writtenbytes); + console.log(`Actual written bytes: ` + writtenbytes); } }).catch((err) => { - console.log('ERROR: '+ err.message); + console.log(`ERROR: ` + err.message); }); ``` @@ -2973,7 +2973,7 @@ getAudioTime(callback: AsyncCallback\): void ``` audioRenderer.getAudioTime((err, timestamp) => { - console.log('Current timestamp: ' + timestamp); + console.log(`Current timestamp: ` + timestamp); }); ``` @@ -2995,9 +2995,9 @@ getAudioTime(): Promise\ ``` audioRenderer.getAudioTime().then((timestamp) => { - console.log('Current timestamp: ' + timestamp); + console.log(`Current timestamp: ` + timestamp); }).catch((err) => { - console.log('ERROR: '+err.message); + console.log(`ERROR: ` + err.message); }); ``` @@ -3020,7 +3020,7 @@ getBufferSize(callback: AsyncCallback\): void ``` var bufferSize = audioRenderer.getBufferSize(async(err, bufferSize) => { if (err) { - console.error('getBufferSize error'); + console.error(`getBufferSize error`); } }); ``` @@ -3071,10 +3071,10 @@ audio.createAudioRenderer(audioRendererOptions).then((data) => { }); var bufferSize; audioRenderer.getBufferSize().then((data) => { - console.info('AudioFrameworkRenderLog: getBufferSize: SUCCESS ' + data); + console.info(`AudioFrameworkRenderLog: getBufferSize: SUCCESS ` + data); bufferSize = data; }).catch((err) => { - console.info('AudioFrameworkRenderLog: getBufferSize: ERROR: ' + err.message); + console.info(`AudioFrameworkRenderLog: getBufferSize: ERROR: ` + err.message); }); ``` @@ -3098,9 +3098,9 @@ setRenderRate(rate: AudioRendererRate, callback: AsyncCallback\): void ``` audioRenderer.setRenderRate(audio.AudioRendererRate.RENDER_RATE_NORMAL, (err) => { if (err) { - console.error('Failed to set params'); + console.error(`Failed to set params`); } else { - console.log('Callback invoked to indicate a successful render rate setting.'); + console.log(`Callback invoked to indicate a successful render rate setting.`); } }); ``` @@ -3129,9 +3129,9 @@ setRenderRate(rate: AudioRendererRate): Promise\ ``` audioRenderer.setRenderRate(audio.AudioRendererRate.RENDER_RATE_NORMAL).then(() => { - console.log('setRenderRate SUCCESS'); + console.log(`setRenderRate SUCCESS`); }).catch((err) => { - console.log('ERROR: '+ err.message); + console.log(`ERROR: ` + err.message); }); ``` @@ -3153,7 +3153,7 @@ getRenderRate(callback: AsyncCallback\): void ``` audioRenderer.getRenderRate((err, renderrate) => { - console.log('getRenderRate: ' + renderrate); + console.log(`getRenderRate: ` + renderrate); }); ``` @@ -3175,9 +3175,9 @@ getRenderRate(): Promise\ ``` audioRenderer.getRenderRate().then((renderRate) => { - console.log('getRenderRate: ' + renderRate); + console.log(`getRenderRate: ` + renderRate); }).catch((err) => { - console.log('ERROR: '+ err.message); + console.log(`ERROR: ` + err.message); }); ``` ### setInterruptMode9+ @@ -3221,9 +3221,9 @@ var audioRendererOptions = { let audioRenderer = await audio.createAudioRenderer(audioRendererOptions); let mode = 0; audioRenderer.setInterruptMode(mode).then(data=>{ - console.log("setInterruptMode Success!"); + console.log(`setInterruptMode Success!`); }).catch(err=>{ - console.log("setInterruptMode Fail:" + err.message); + console.log(`setInterruptMode Fail:` + err.message); }); ``` ### setInterruptMode9+ @@ -3263,9 +3263,9 @@ let audioRenderer = await audio.createAudioRenderer(audioRendererOptions); let mode = 1; audioRenderer.setInterruptMode(mode, (err, data)=>{ if(err){ - console.log("setInterruptMode Fail:" + err.message); + console.log(`setInterruptMode Fail:` + err.message); } - console.log("setInterruptMode Success!"); + console.log(`setInterruptMode Success!`); }); ``` ### on('interrupt')9+ @@ -3292,40 +3292,40 @@ audioRenderer.on('interrupt', async(interruptEvent) => { if (interruptEvent.forceType == audio.InterruptForceType.INTERRUPT_FORCE) { switch (interruptEvent.hintType) { case audio.InterruptHint.INTERRUPT_HINT_PAUSE: - console.log('Force paused. Stop writing'); + console.log(`Force paused. Stop writing`); isPlay = false; break; case audio.InterruptHint.INTERRUPT_HINT_STOP: - console.log('Force stopped. Stop writing'); + console.log(`Force stopped. Stop writing`); isPlay = false; break; } } else if (interruptEvent.forceType == audio.InterruptForceType.INTERRUPT_SHARE) { switch (interruptEvent.hintType) { case audio.InterruptHint.INTERRUPT_HINT_RESUME: - console.log('Resume force paused renderer or ignore'); + console.log(`Resume force paused renderer or ignore`); await audioRenderer.start().then(async function () { - console.info('AudioInterruptMusic: renderInstant started :SUCCESS '); + console.info(`AudioInterruptMusic: renderInstant started :SUCCESS `); started = true; }).catch((err) => { - console.info('AudioInterruptMusic: renderInstant start :ERROR : ' + err.message); + console.info(`AudioInterruptMusic: renderInstant start :ERROR : ` + err.message); started = false; }); if (started) { isPlay = true; - console.info('AudioInterruptMusic Renderer started : isPlay : ' + isPlay); + console.info(`AudioInterruptMusic Renderer started : isPlay : ` + isPlay); } else { - console.error('AudioInterruptMusic Renderer start failed'); + console.error(`AudioInterruptMusic Renderer start failed`); } break; case audio.InterruptHint.INTERRUPT_HINT_PAUSE: console.log('Choose to pause or ignore'); if (isPlay == true) { isPlay == false; - console.info('AudioInterruptMusic: Media PAUSE : TRUE'); + console.info(`AudioInterruptMusic: Media PAUSE : TRUE`); } else { isPlay = true; - console.info('AudioInterruptMusic: Media PLAY : TRUE'); + console.info(`AudioInterruptMusic: Media PLAY : TRUE`); } break; } @@ -3354,7 +3354,7 @@ on(type: 'markReach', frame: number, callback: (position: number) => {}): void ``` audioRenderer.on('markReach', 1000, (position) => { if (position == 1000) { - console.log('ON Triggered successfully'); + console.log(`ON Triggered successfully`); } }); ``` @@ -3401,7 +3401,7 @@ on(type: "periodReach", frame: number, callback: (position: number) => {}): void ``` audioRenderer.on('periodReach', 1000, (position) => { if (position == 1000) { - console.log('ON Triggered successfully'); + console.log(`ON Triggered successfully`); } }); ``` @@ -3446,10 +3446,10 @@ on(type: 'stateChange', callback: Callback): void ``` audioRenderer.on('stateChange', (state) => { if (state == 1) { - console.log("audio renderer state is: STATE_PREPARED"); + console.log(`audio renderer state is: STATE_PREPARED`); } if (state == 2) { - console.log("audio renderer state is: STATE_RUNNING"); + console.log(`audio renderer state is: STATE_RUNNING`); } }); ``` @@ -3479,7 +3479,7 @@ const path = '/data/storage/el2/ba se/haps/entry/cache/PinkPanther60-44100-1c.w audioRenderer.on('dataRequest', (audioRendererDataInfo) => { var viewObject = new DataView(audioRendererDataInfo.buffer); rlen += ss.readSync(viewObject.buffer); - console.info('AudioRenderLog: bytes read from file: ' + rlen); + console.info(`AudioRenderLog: bytes read from file: ` + rlen); }) ``` @@ -3520,11 +3520,11 @@ getCapturerInfo(callback: AsyncCallback): void ``` audioCapturer.getCapturerInfo((err, capturerInfo) => { if (err) { - console.error('Failed to get capture info'); + console.error(`Failed to get capture info`); } else { - console.log('Capturer getCapturerInfo:'); - console.log('Capturer source:' + capturerInfo.source); - console.log('Capturer flags:' + capturerInfo.capturerFlags); + console.log(`Capturer getCapturerInfo:`); + console.log(`Capturer source:` + capturerInfo.source); + console.log(`Capturer flags:` + capturerInfo.capturerFlags); } }); ``` @@ -3549,15 +3549,15 @@ getCapturerInfo(): Promise ``` audioCapturer.getCapturerInfo().then((audioParamsGet) => { if (audioParamsGet != undefined) { - console.info('AudioFrameworkRecLog: Capturer CapturerInfo:'); - console.info('AudioFrameworkRecLog: Capturer SourceType:' + audioParamsGet.source); - console.info('AudioFrameworkRecLog: Capturer capturerFlags:' + audioParamsGet.capturerFlags); + console.info(`AudioFrameworkRecLog: Capturer CapturerInfo:`); + console.info(`AudioFrameworkRecLog: Capturer SourceType:` + audioParamsGet.source); + console.info(`AudioFrameworkRecLog: Capturer capturerFlags:` + audioParamsGet.capturerFlags); } else { - console.info('AudioFrameworkRecLog: audioParamsGet is : '+ audioParamsGet); - console.info('AudioFrameworkRecLog: audioParams getCapturerInfo are incorrect: '); + console.info(`AudioFrameworkRecLog: audioParamsGet is : ` + audioParamsGet); + console.info(`AudioFrameworkRecLog: audioParams getCapturerInfo are incorrect: `); } }).catch((err) => { - console.log('AudioFrameworkRecLog: CapturerInfo :ERROR: '+ err.message); + console.log(`AudioFrameworkRecLog: CapturerInfo :ERROR: ` + err.message); }); ``` @@ -3580,13 +3580,13 @@ getStreamInfo(callback: AsyncCallback): void ``` audioCapturer.getStreamInfo((err, streamInfo) => { if (err) { - console.error('Failed to get stream info'); + console.error(`Failed to get stream info'); } else { - console.log('Capturer GetStreamInfo:'); - console.log('Capturer sampling rate:' + streamInfo.samplingRate); - console.log('Capturer channel:' + streamInfo.channels); - console.log('Capturer format:' + streamInfo.sampleFormat); - console.log('Capturer encoding type:' + streamInfo.encodingType); + console.log(`Capturer GetStreamInfo:`); + console.log(`Capturer sampling rate:` + streamInfo.samplingRate); + console.log(`Capturer channel:` + streamInfo.channels); + console.log(`Capturer format:` + streamInfo.sampleFormat); + console.log(`Capturer encoding type:` + streamInfo.encodingType); } }); ``` @@ -3609,13 +3609,13 @@ getStreamInfo(): Promise ``` audioCapturer.getStreamInfo().then((audioParamsGet) => { - console.info('getStreamInfo:'); - console.info('sampleFormat:' + audioParamsGet.sampleFormat); - console.info('samplingRate:' + audioParamsGet.samplingRate); - console.info('channels:' + audioParamsGet.channels); - console.info('encodingType:' + audioParamsGet.encodingType); + console.info(`getStreamInfo:`); + console.info(`sampleFormat:` + audioParamsGet.sampleFormat); + console.info(`samplingRate:` + audioParamsGet.samplingRate); + console.info(`channels:` + audioParamsGet.channels); + console.info(`encodingType:` + audioParamsGet.encodingType); }).catch((err) => { - console.log('getStreamInfo :ERROR: ' + err.message); + console.log(`getStreamInfo :ERROR: ` + err.message); }); ``` @@ -3638,9 +3638,9 @@ start(callback: AsyncCallback): void ``` audioCapturer.start((err) => { if (err) { - console.error('Capturer start failed.'); + console.error(`Capturer start failed.`); } else { - console.info('Capturer start success.'); + console.info(`Capturer start success.`); } }); ``` @@ -3682,20 +3682,20 @@ var audioCapturer; var stateFlag; audio.createAudioCapturer(audioCapturerOptions).then((data) => { audioCapturer = data; - console.info('AudioFrameworkRecLog: AudioCapturer Created: SUCCESS'); + console.info(`AudioFrameworkRecLog: AudioCapturer Created: SUCCESS`); }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created: ERROR: ' + err.message); + console.info(`AudioFrameworkRecLog: AudioCapturer Created: ERROR: ` + err.message); }); audioCapturer.start().then(() => { - console.info('AudioFrameworkRecLog: ---------START---------'); - console.info('AudioFrameworkRecLog: Capturer started: SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer: STATE: ' + audioCapturer.state); - console.info('AudioFrameworkRecLog: Capturer started: SUCCESS '); + console.info(`AudioFrameworkRecLog: ---------START---------`); + console.info(`AudioFrameworkRecLog: Capturer started: SUCCESS`); + console.info(`AudioFrameworkRecLog: AudioCapturer: STATE: ` + audioCapturer.state); + console.info(`AudioFrameworkRecLog: Capturer started: SUCCESS `); if ((audioCapturer.state == audio.AudioState.STATE_RUNNING)) { - console.info('AudioFrameworkRecLog: AudioCapturer is in Running State'); + console.info(`AudioFrameworkRecLog: AudioCapturer is in Running State`); } }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + console.info(`AudioFrameworkRecLog: Capturer start :ERROR : ` + err.message); stateFlag = false; }); ``` @@ -3719,9 +3719,9 @@ stop(callback: AsyncCallback): void ``` audioCapturer.stop((err) => { if (err) { - console.error('Capturer stop failed'); + console.error(`Capturer stop failed`); } else { - console.log('Capturer stopped.'); + console.log(`Capturer stopped.`); } }); ``` @@ -3745,13 +3745,13 @@ stop(): Promise ``` audioCapturer.stop().then(() => { - console.info('AudioFrameworkRecLog: ---------STOP RECORD---------'); - console.info('AudioFrameworkRecLog: Capturer stopped: SUCCESS'); + console.info(`AudioFrameworkRecLog: ---------STOP RECORD---------`); + console.info(`AudioFrameworkRecLog: Capturer stopped: SUCCESS`); if ((audioCapturer.state == audio.AudioState.STATE_STOPPED)){ - console.info('AudioFrameworkRecLog: State is Stopped': '); + console.info(`AudioFrameworkRecLog: State is Stopped: `); } }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer stop: ERROR: '+ err.message); + console.info(`AudioFrameworkRecLog: Capturer stop: ERROR: ` + err.message); }); ``` @@ -3774,9 +3774,9 @@ release(callback: AsyncCallback): void ``` audioCapturer.release((err) => { if (err) { - console.error('capturer release failed'); + console.error(`capturer release failed`); } else { - console.log('capturer released.'); + console.log(`capturer released.`); } }); ``` @@ -3801,12 +3801,12 @@ release(): Promise ``` var stateFlag; audioCapturer.release().then(() => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapturer.state); - console.info('AudioFrameworkRecLog: stateFlag : ' + stateFlag); + console.info(`AudioFrameworkRecLog: ---------RELEASE RECORD---------`); + console.info(`AudioFrameworkRecLog: Capturer release : SUCCESS`); + console.info(`AudioFrameworkRecLog: AudioCapturer : STATE : ` + audioCapturer.state); + console.info(`AudioFrameworkRecLog: stateFlag : ` + stateFlag); }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer stop: ERROR: ' + err.message); + console.info(`AudioFrameworkRecLog: Capturer stop: ERROR: ` + err.message); }); ``` @@ -3832,14 +3832,14 @@ read(size: number, isBlockingRead: boolean, callback: AsyncCallback { - console.info('AudioFrameworkRecLog: getBufferSize: SUCCESS ' + data); + console.info(`AudioFrameworkRecLog: getBufferSize: SUCCESS ` + data); bufferSize = data; }).catch((err) => { - console.info('AudioFrameworkRecLog: getBufferSize: EROOR: ' + err.message); + console.info(`AudioFrameworkRecLog: getBufferSize: EROOR: ` + err.message); }); audioCapturer.read(bufferSize, true, async(err, buffer) => { if (!err) { - console.log("Success in reading the buffer data"); + console.log(`Success in reading the buffer data`); } }); ``` @@ -3871,16 +3871,16 @@ read(size: number, isBlockingRead: boolean): Promise ``` var bufferSize; audioCapturer.getBufferSize().then((data) => { - console.info('AudioFrameworkRecLog: getBufferSize: SUCCESS ' + data); + console.info(`AudioFrameworkRecLog: getBufferSize: SUCCESS ` + data); bufferSize = data; }).catch((err) => { - console.info('AudioFrameworkRecLog: getBufferSize: ERROR ' + err.message); + console.info(`AudioFrameworkRecLog: getBufferSize: ERROR ` + err.message); }); -console.info('Buffer size: ' + bufferSize); +console.info(`Buffer size: ` + bufferSize); audioCapturer.read(bufferSize, true).then((buffer) => { - console.info('buffer read successfully'); + console.info(`buffer read successfully`); }).catch((err) => { - console.info('ERROR : ' + err.message); + console.info(`ERROR : ` + err.message); }); ``` @@ -3903,7 +3903,7 @@ getAudioTime(callback: AsyncCallback): void ``` audioCapturer.getAudioTime((err, timestamp) => { - console.log('Current timestamp: ' + timestamp); + console.log(`Current timestamp: ` + timestamp); }); ``` @@ -3926,9 +3926,9 @@ getAudioTime(): Promise ``` audioCapturer.getAudioTime().then((audioTime) => { - console.info('AudioFrameworkRecLog: AudioCapturer getAudioTime : Success' + audioTime ); + console.info(`AudioFrameworkRecLog: AudioCapturer getAudioTime : Success` + audioTime ); }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); + console.info(`AudioFrameworkRecLog: AudioCapturer Created : ERROR : ` + err.message); }); ``` @@ -3952,11 +3952,11 @@ getBufferSize(callback: AsyncCallback): void ``` audioCapturer.getBufferSize((err, bufferSize) => { if (!err) { - console.log('BufferSize : ' + bufferSize); + console.log(`BufferSize : ` + bufferSize); audioCapturer.read(bufferSize, true).then((buffer) => { - console.info('Buffer read is ' + buffer ); + console.info(`Buffer read is ` + buffer ); }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); + console.info(`AudioFrameworkRecLog: AudioCapturer Created : ERROR : ` + err.message); }); } }); @@ -3982,10 +3982,10 @@ getBufferSize(): Promise ``` var bufferSize; audioCapturer.getBufferSize().then((data) => { - console.info('AudioFrameworkRecLog: getBufferSize :SUCCESS ' + data); + console.info(`AudioFrameworkRecLog: getBufferSize :SUCCESS ` + data); bufferSize = data; }).catch((err) => { - console.info('AudioFrameworkRecLog: getBufferSize :ERROR : ' + err.message); + console.info(`AudioFrameworkRecLog: getBufferSize :ERROR : ` + err.message); }); ``` @@ -4011,7 +4011,7 @@ on(type: 'markReach', frame: number, callback: (position: number) => {}): void ``` audioCapturer.on('markReach', 1000, (position) => { if (position == 1000) { - console.log('ON Triggered successfully'); + console.log(`ON Triggered successfully`); } }); ``` @@ -4057,7 +4057,7 @@ on(type: "periodReach", frame: number, callback: (position: number) => {}): void ``` audioCapturer.on('periodReach', 1000, (position) => { if (position == 1000) { - console.log('ON Triggered successfully'); + console.log(`ON Triggered successfully`); } }); ``` @@ -4102,10 +4102,10 @@ on(type: 'stateChange', callback: Callback): void ``` audioCapturer.on('stateChange', (state) => { if (state == 1) { - console.log("audio capturer state is: STATE_PREPARED"); + console.log(`audio capturer state is: STATE_PREPARED`); } if (state == 2) { - console.log("audio capturer state is: STATE_RUNNING"); + console.log(`audio capturer state is: STATE_RUNNING`); } }); ``` \ No newline at end of file