未验证 提交 bfb52020 编写于 作者: O openharmony_ci 提交者: Gitee

!8050 修改日志输出调用以及单引号的使用

Merge pull request !8050 from 一杯丞丞汁儿/master
......@@ -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.error(`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.error(`AudioCapturer Created : ERROR : ${err.message}`);
});
```
......@@ -721,7 +721,7 @@ audioManager.setVolume(audio.AudioVolumeType.MEDIA, 10, (err) => {
console.error(`Failed to set the volume. ${err.message}`);
return;
}
console.log(`Callback invoked to indicate a successful volume setting.`);
console.info('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.info('Promise returned to indicate a successful volume setting.');
});
```
......@@ -779,7 +779,7 @@ audioManager.getVolume(audio.AudioVolumeType.MEDIA, (err, value) => {
console.error(`Failed to obtain the volume. ${err.message}`);
return;
}
console.log(`Callback invoked to indicate that the volume is obtained.`);
console.info('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.info(`Promise returned to indicate that the volume is obtained ${value} .`);
});
```
......@@ -834,7 +834,7 @@ audioManager.getMinVolume(audio.AudioVolumeType.MEDIA, (err, value) => {
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.info(`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.info(`Promised returned to indicate that the minimum volume is obtained. ${value}`);
});
```
......@@ -889,7 +889,7 @@ audioManager.getMaxVolume(audio.AudioVolumeType.MEDIA, (err, value) => {
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.info(`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.info('Promised returned to indicate that the maximum volume is obtained.');
});
```
......@@ -947,7 +947,7 @@ audioManager.mute(audio.AudioVolumeType.MEDIA, true, (err) => {
console.error(`Failed to mute the stream. ${err.message}`);
return;
}
console.log(`Callback invoked to indicate that the stream is muted.`);
console.info('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.info('Promise returned to indicate that the stream is muted.');
});
```
......@@ -1007,7 +1007,7 @@ audioManager.isMute(audio.AudioVolumeType.MEDIA, (err, value) => {
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.info(`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.info(`Promise returned to indicate that the mute status of the stream is obtained ${value}.`);
});
```
......@@ -1063,7 +1063,7 @@ audioManager.isActive(audio.AudioVolumeType.MEDIA, (err, value) => {
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.info(`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.info(`Promise returned to indicate that the active status of the stream is obtained ${value}.`);
});
```
......@@ -1120,7 +1120,7 @@ audioManager.setRingerMode(audio.AudioRingMode.RINGER_MODE_NORMAL, (err) => {
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.info('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.info('Promise returned to indicate a successful setting of the ringer mode.');
});
```
......@@ -1177,7 +1177,7 @@ audioManager.getRingerMode((err, value) => {
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.info(`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.info(`Promise returned to indicate that the ringer mode is obtained ${value}.`);
});
```
......@@ -1232,7 +1232,7 @@ audioManager.setAudioParameter('key_example', 'value_example', (err) => {
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.info('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.info('Promise returned to indicate a successful setting of the audio parameter.');
});
```
......@@ -1294,7 +1294,7 @@ audioManager.getAudioParameter('key_example', (err, value) => {
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.info(`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.info(`Promise returned to indicate that the value of the audio parameter is obtained ${value}.`);
});
```
......@@ -1350,7 +1350,7 @@ audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG, (err, value) => {
console.error(`Failed to obtain the device list. ${err.message}`);
return;
}
console.log(`Callback invoked to indicate that the device list is obtained.`);
console.info('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.info('Promise returned to indicate that the device list is obtained.');
});
```
......@@ -1406,7 +1406,7 @@ audioManager.setDeviceActive(audio.ActiveDeviceType.SPEAKER, true, (err) => {
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.info('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.info('Promise returned to indicate that the device is set to the active status.');
});
```
......@@ -1463,7 +1463,7 @@ audioManager.isDeviceActive(audio.ActiveDeviceType.SPEAKER, (err, value) => {
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.info('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.info(`Promise returned to indicate that the active status of the device is obtained ${value}.`);
});
```
......@@ -1521,7 +1521,7 @@ audioManager.setMicrophoneMute(true, (err) => {
console.error(`Failed to mute the microphone. ${err.message}`);
return;
}
console.log(`Callback invoked to indicate that the microphone is muted.`);
console.info('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.info('Promise returned to indicate that the microphone is muted.');
});
```
......@@ -1579,7 +1579,7 @@ audioManager.isMicrophoneMute((err, value) => {
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.info(`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.info(`Promise returned to indicate that the mute status of the microphone is obtained ${value}.`);
});
```
......@@ -1631,9 +1631,9 @@ on(type: 'volumeChange', callback: Callback\<VolumeEvent>): 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.info(`VolumeType of stream: ${volumeEvent.volumeType} `);
console.info(`Volume level: ${volumeEvent.volume} `);
console.info(`Whether to updateUI: ${volumeEvent.updateUi} `);
});
```
......@@ -1658,7 +1658,7 @@ on(type: 'ringerModeChange', callback: Callback\<AudioRingMode>): void
```
audioManager.on('ringerModeChange', (ringerMode) => {
console.log(`Updated ringermode: ` + ringerMode);
console.info(`Updated ringermode: ${ringerMode}`);
});
```
......@@ -1681,10 +1681,10 @@ on(type: 'deviceChange', callback: Callback<DeviceChangeAction\>): 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<DeviceChangeAction\>): void
```
audioManager.off('deviceChange', (deviceChanged) => {
console.log(`Should be no callback.`);
console.info('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.info('An event to gain the audio focus starts.');
console.info(`Focus gain event: ${InterruptAction} `);
}
if (InterruptAction.actionType === 1) {
console.log(`An audio interruption event starts.`);
console.log(`Audio interruption event:` + JSON.stringify(InterruptAction));
console.info('An audio interruption event starts.');
console.info(`Audio interruption event: ${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.info('An event to release the audio focus starts.');
console.info(`Focus release event: ${InterruptAction} `);
}
});
```
......@@ -1804,7 +1804,7 @@ audioManager.setAudioScene(audio.AudioScene.AUDIO_SCENE_PHONE_CALL, (err) => {
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.info('Callback invoked to indicate a successful setting of the audio scene mode.');
});
```
......@@ -1834,9 +1834,9 @@ setAudioScene\(scene: AudioScene\): Promise<void\>
```
audioManager.setAudioScene(audio.AudioScene.AUDIO_SCENE_PHONE_CALL).then(() => {
console.log(`Promise returned to indicate a successful setting of the audio scene mode.`);
console.info('Promise returned to indicate a successful setting of the audio scene mode.');
}).catch ((err) => {
console.log(`Failed to set the audio scene mode`);
console.error(`Failed to set the audio scene mode ${err.message}`);
});
```
......@@ -1862,7 +1862,7 @@ audioManager.getAudioScene((err, value) => {
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.info(`Callback invoked to indicate that the audio scene mode is obtained ${value}.`);
});
```
......@@ -1885,9 +1885,9 @@ getAudioScene\(\): Promise<AudioScene\>
```
audioManager.getAudioScene().then((value) => {
console.log(`Promise returned to indicate that the audio scene mode is obtained.` + value);
console.info(`Promise returned to indicate that the audio scene mode is obtained ${value}.`);
}).catch ((err) => {
console.log(`Failed to obtain the audio scene mode`);
console.error(`Failed to obtain the audio scene mode ${err.message}`);
});
```
......@@ -1912,30 +1912,28 @@ getCurrentAudioRendererInfoArray(callback: AsyncCallback&lt;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);
resultFlag = false;
console.error(`getCurrentAudioRendererInfoArray :ERROR: ${err.message}`);
} 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);
var devDescriptor = AudioRendererChangeInfo.deviceDescriptors;
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}`);
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}`);
}
}
}
......@@ -1964,27 +1962,26 @@ await audioStreamManager.getCurrentAudioRendererInfoArray().then( function (Audi
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);
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(`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}`);
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}`);
}
}
}
}).catch((err) => {
console.log(`getCurrentAudioRendererInfoArray :ERROR: ` + err.message);
console.error(`getCurrentAudioRendererInfoArray :ERROR: ${err.message}`);
});
```
......@@ -2005,27 +2002,26 @@ getCurrentAudioCapturerInfoArray(callback: AsyncCallback&lt;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.error(`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);
var devDescriptor = AudioCapturerChangeInfoArray[i].deviceDescriptors;
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}`);
}
}
}
......@@ -2050,29 +2046,28 @@ getCurrentAudioCapturerInfoArray(): Promise&lt;AudioCapturerChangeInfoArray&gt;
**示例:**
```
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);
var devDescriptor = AudioCapturerChangeInfoArray[i].deviceDescriptors;
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}`);
}
}
}
}).catch((err) => {
console.log(`getCurrentAudioCapturerInfoArray :ERROR: ` + err.message);
console.error(`getCurrentAudioCapturerInfoArray :ERROR: ${err.message}`);
});
```
......@@ -2096,23 +2091,22 @@ on(type: "audioRendererChange", callback: Callback&lt;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);
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(`## 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 ${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}`);
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}`);
}
}
});
......@@ -2135,7 +2129,7 @@ off(type: "audioRendererChange");
**示例:**
```
audioStreamManager.off('audioRendererChange');
console.info(`######### RendererChange Off is called #########`);
console.info('######### RendererChange Off is called #########');
```
### on('audioCapturerChange')<sup>9+</sup>
......@@ -2157,21 +2151,22 @@ on(type: "audioCapturerChange", callback: Callback&lt;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}`);
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}`);
}
}
});
......@@ -2194,7 +2189,7 @@ off(type: "audioCapturerChange");
**示例:**
```
audioStreamManager.off('audioCapturerChange');
console.info(`######### CapturerChange Off is called #########`);
console.info('######### CapturerChange Off is called #########');
```
......@@ -2227,7 +2222,7 @@ var AudioStreamInfo = {
var audioStreamManager = audioManager.getStreamManager();
audioStreamManager.isAudioRendererLowLatencySupported(AudioStreamInfo, (result) => {
console.info(`isAudioRendererLowLatencySupported success var = ` + result);
console.info(`isAudioRendererLowLatencySupported success var ${result}`);
});
```
......@@ -2264,8 +2259,8 @@ var AudioStreamInfo = {
}
var audioStreamManager = await audioManager.getStreamManager();
var result = audioStreamManager.isAudioRendererLowLatencySupported(AudioStreamInfo);
console.info(`isAudioRendererLowLatencySupported success var =` + result);
let result = audioStreamManager.isAudioRendererLowLatencySupported(AudioStreamInfo);
console.info(`isAudioRendererLowLatencySupported success var ${result}`);
```
## AudioRendererChangeInfo<sup>9+</sup>
......@@ -2285,7 +2280,7 @@ console.info(`isAudioRendererLowLatencySupported success var =` + result);
AudioRenderChangeInfo数组,只读。
**系统能力:**: SystemCapability.Multimedia.Audio.Renderer
**系统能力:** SystemCapability.Multimedia.Audio.Renderer
**示例:**
......@@ -2294,48 +2289,47 @@ import audio from '@ohos.multimedia.audio';
var audioStreamManager;
var audioStreamManagerCB;
var Tag = "AFCapLog : ";
var resultFlag = false;
await audioManager.getStreamManager().then(async function (data) {
audioStreamManager = data;
console.info(Tag + `Get AudioStream Manager : Success `);
console.info('Get AudioStream Manager : Success');
}).catch((err) => {
console.info(Tag + `Get AudioStream Manager : ERROR : ` + err.message);
console.error(`Get AudioStream Manager : ERROR : ${err.message}`);
});
audioManager.getStreamManager((err, data) => {
if (err) {
console.error(Tag + `Get AudioStream Manager : ERROR : ` + err.message);
console.error(`Get AudioStream Manager : ERROR : ${err.message}`);
} else {
audioStreamManagerCB = data;
console.info(Tag + `Get AudioStream Manager : Success `);
console.info('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(`## RendererChange on is called for ${i} ##`);
console.info(`StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`);
console.info(`ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`);
console.info(`Content for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`);
console.info(`Stream for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`);
console.info(`Flag ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`);
console.info(`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(`Id: ${i} : ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].id}`);
console.info(`Type: ${i} : ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType}`);
console.info(`Role: ${i} : ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole}`);
console.info(`Name: ${i} : ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`);
console.info(`Addr: ${i} : ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`);
console.info(`SR: ${i} : ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`);
console.info(`C ${i} : ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`);
console.info(`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(`ResultFlag for ${i} is: ${resultFlag}`);
}
}
});
......@@ -2366,31 +2360,30 @@ AudioCapturerChangeInfo数组,只读。
import audio from '@ohos.multimedia.audio';
const audioManager = audio.getAudioManager();
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(`## CapChange on is called for element ${i} ##`);
console.info(`StrId for ${i} is: ${AudioCapturerChangeInfoArray[i].streamId}`);
console.info(`CUid for ${i} is: ${AudioCapturerChangeInfoArray[i].clientUid}`);
console.info(`Src 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(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(`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(`Addr: ${i} : ${AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address}`);
console.info(`SR: ${i} : ${AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`);
console.info(`C ${i} : ${AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`);
console.info(`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(`ResultFlag for element ${i} is: ${resultFlag}`);
}
}
});
```
......@@ -2430,12 +2423,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.error('AudioFrameworkTest: Promise: getDevices : OUTPUT_DEVICES_FLAG : FAIL');
}
});
```
......@@ -2476,10 +2469,10 @@ getRendererInfo(callback: AsyncCallback<AudioRendererInfo\>): 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.info('Renderer GetRendererInfo:');
console.info(`Renderer content: ${rendererInfo.content}`);
console.info(`Renderer usage: ${rendererInfo.usage}`);
console.info(`Renderer flags: ${rendererInfo.rendererFlags}`);
});
```
......@@ -2500,15 +2493,13 @@ getRendererInfo(): Promise<AudioRendererInfo\>
**示例:**
```
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.info('Renderer GetRendererInfo:');
console.info(`Renderer content: ${rendererInfo.content}`);
console.info(`Renderer usage: ${rendererInfo.usage}`);
console.info(`Renderer flags: ${rendererInfo.rendererFlags}`)
}).catch((err) => {
console.log(`AudioFrameworkRenderLog: RendererInfo :ERROR: ` + err.message);
resultFlag = false;
console.error(`AudioFrameworkRenderLog: RendererInfo :ERROR: ${err.message}`);
});
```
......@@ -2530,11 +2521,11 @@ getStreamInfo(callback: AsyncCallback<AudioStreamInfo\>): 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.info('Renderer GetStreamInfo:');
console.info(`Renderer sampling rate: ${streamInfo.samplingRate}`);
console.info(`Renderer channel: ${streamInfo.channels}`);
console.info(`Renderer format: ${streamInfo.sampleFormat}`);
console.info(`Renderer encoding type: ${streamInfo.encodingType}`);
});
```
......@@ -2556,13 +2547,13 @@ getStreamInfo(): Promise<AudioStreamInfo\>
```
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.info('Renderer GetStreamInfo:');
console.info(`Renderer sampling rate: ${streamInfo.samplingRate}`);
console.info(`Renderer channel: ${streamInfo.channels}`);
console.info(`Renderer format: ${streamInfo.sampleFormat}`);
console.info(`Renderer encoding type: ${streamInfo.encodingType}`);
}).catch((err) => {
console.log(`ERROR: ` + err.message);
console.error(`ERROR: ${err.message}`);
});
```
......@@ -2585,9 +2576,9 @@ start(callback: AsyncCallback<void\>): 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 +2601,9 @@ start(): Promise<void\>
```
audioRenderer.start().then(() => {
console.log(`Renderer started`);
console.info('Renderer started');
}).catch((err) => {
console.log(`ERROR: ` + err.message);
console.error(`ERROR: ${err.message}`);
});
```
......@@ -2635,9 +2626,9 @@ pause(callback: AsyncCallback\<void>): void
```
audioRenderer.pause((err) => {
if (err) {
console.error(`Renderer pause failed`);
console.error('Renderer pause failed');
} else {
console.log(`Renderer paused.`);
console.info('Renderer paused.');
}
});
```
......@@ -2660,9 +2651,9 @@ pause(): Promise\<void>
```
audioRenderer.pause().then(() => {
console.log(`Renderer paused`);
console.info('Renderer paused');
}).catch((err) => {
console.log(`ERROR: ` + err.message);
console.error(`ERROR: ${err.message}`);
});
```
......@@ -2685,9 +2676,9 @@ drain(callback: AsyncCallback\<void>): void
```
audioRenderer.drain((err) => {
if (err) {
console.error(`Renderer drain failed`);
console.error('Renderer drain failed');
} else {
console.log(`Renderer drained.`);
console.info('Renderer drained.');
}
});
```
......@@ -2710,9 +2701,9 @@ drain(): Promise\<void>
```
audioRenderer.drain().then(() => {
console.log(`Renderer drained successfully`);
console.info('Renderer drained successfully');
}).catch((err) => {
console.log(`ERROR: ` + err.message);
console.error(`ERROR: ${err.message}`);
});
```
......@@ -2735,9 +2726,9 @@ stop(callback: AsyncCallback\<void>): void
```
audioRenderer.stop((err) => {
if (err) {
console.error(`Renderer stop failed`);
console.error('Renderer stop failed');
} else {
console.log(`Renderer stopped.`);
console.info('Renderer stopped.');
}
});
```
......@@ -2760,9 +2751,9 @@ stop(): Promise\<void>
```
audioRenderer.stop().then(() => {
console.log(`Renderer stopped successfully`);
console.info('Renderer stopped successfully');
}).catch((err) => {
console.log(`ERROR: ` + err.message);
console.error(`ERROR: ${err.message}`);
});
```
......@@ -2785,9 +2776,9 @@ release(callback: AsyncCallback\<void>): void
```
audioRenderer.release((err) => {
if (err) {
console.error(`Renderer release failed`);
console.error('Renderer release failed');
} else {
console.log(`Renderer released.`);
console.info('Renderer released.');
}
});
```
......@@ -2810,9 +2801,9 @@ release(): Promise\<void>
```
audioRenderer.release().then(() => {
console.log(`Renderer released successfully`);
console.info('Renderer released successfully');
}).catch((err) => {
console.log(`ERROR: ` + err.message);
console.error(`ERROR: ${err.message}`);
});
```
......@@ -2858,29 +2849,29 @@ 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.error(`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.error.(`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";
var filePath = path + '/StarWars10s-2C-48000-4SW.wav';
let ss = fileio.createStreamSync(filePath, 'r');
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.info(`Actual written bytes: ${writtenbytes}`);
}
});
```
......@@ -2926,18 +2917,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.error(`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 +2937,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.info(`Actual written bytes: ${writtenbytes}`);
}
}).catch((err) => {
console.log(`ERROR: ` + err.message);
console.error(`ERROR: ${err.message}`);
});
```
......@@ -2973,7 +2964,7 @@ getAudioTime(callback: AsyncCallback\<number>): void
```
audioRenderer.getAudioTime((err, timestamp) => {
console.log(`Current timestamp: ` + timestamp);
console.info(`Current timestamp: ${timestamp}`);
});
```
......@@ -2995,9 +2986,9 @@ getAudioTime(): Promise\<number>
```
audioRenderer.getAudioTime().then((timestamp) => {
console.log(`Current timestamp: ` + timestamp);
console.info(`Current timestamp: ${timestamp}`);
}).catch((err) => {
console.log(`ERROR: ` + err.message);
console.error(`ERROR: ${err.message}`);
});
```
......@@ -3020,7 +3011,7 @@ getBufferSize(callback: AsyncCallback\<number>): void
```
var bufferSize = audioRenderer.getBufferSize(async(err, bufferSize) => {
if (err) {
console.error(`getBufferSize error`);
console.error('getBufferSize error');
}
});
```
......@@ -3067,14 +3058,14 @@ audio.createAudioRenderer(audioRendererOptions).then((data) => {
audioRenderer = data;
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.error(`AudioFrameworkRenderLog: getBufferSize: ERROR: ${err.message}`);
});
```
......@@ -3098,9 +3089,9 @@ setRenderRate(rate: AudioRendererRate, callback: AsyncCallback\<void>): 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.info('Callback invoked to indicate a successful render rate setting.');
}
});
```
......@@ -3129,9 +3120,9 @@ setRenderRate(rate: AudioRendererRate): Promise\<void>
```
audioRenderer.setRenderRate(audio.AudioRendererRate.RENDER_RATE_NORMAL).then(() => {
console.log(`setRenderRate SUCCESS`);
console.info('setRenderRate SUCCESS');
}).catch((err) => {
console.log(`ERROR: ` + err.message);
console.error(`ERROR: ${err.message}`);
});
```
......@@ -3153,7 +3144,7 @@ getRenderRate(callback: AsyncCallback\<AudioRendererRate>): void
```
audioRenderer.getRenderRate((err, renderrate) => {
console.log(`getRenderRate: ` + renderrate);
console.info(`getRenderRate: ${renderrate}`);
});
```
......@@ -3175,9 +3166,9 @@ getRenderRate(): Promise\<AudioRendererRate>
```
audioRenderer.getRenderRate().then((renderRate) => {
console.log(`getRenderRate: ` + renderRate);
console.info(`getRenderRate: ${renderRate}`);
}).catch((err) => {
console.log(`ERROR: ` + err.message);
console.error(`ERROR: ${err.message}`);
});
```
### setInterruptMode<sup>9+</sup>
......@@ -3221,9 +3212,9 @@ var audioRendererOptions = {
let audioRenderer = await audio.createAudioRenderer(audioRendererOptions);
let mode = 0;
audioRenderer.setInterruptMode(mode).then(data=>{
console.log(`setInterruptMode Success!`);
}).catch(err=>{
console.log(`setInterruptMode Fail:` + err.message);
console.info('setInterruptMode Success!');
}).catch((err) => {
console.error(`setInterruptMode Fail: ${err.message}`);
});
```
### setInterruptMode<sup>9+</sup>
......@@ -3263,9 +3254,9 @@ let audioRenderer = await audio.createAudioRenderer(audioRendererOptions);
let mode = 1;
audioRenderer.setInterruptMode(mode, (err, data)=>{
if(err){
console.log(`setInterruptMode Fail:` + err.message);
console.error(`setInterruptMode Fail: ${err.message}`);
}
console.log(`setInterruptMode Success!`);
console.info('setInterruptMode Success!');
});
```
### on('interrupt')<sup>9+</sup>
......@@ -3292,40 +3283,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.info('Force paused. Stop writing');
isPlay = false;
break;
case audio.InterruptHint.INTERRUPT_HINT_STOP:
console.log(`Force stopped. Stop writing`);
console.info('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.info('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.error(`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');
console.info('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 +3345,7 @@ on(type: 'markReach', frame: number, callback: (position: number) => {}): void
```
audioRenderer.on('markReach', 1000, (position) => {
if (position == 1000) {
console.log(`ON Triggered successfully`);
console.info('ON Triggered successfully');
}
});
```
......@@ -3401,7 +3392,7 @@ on(type: "periodReach", frame: number, callback: (position: number) => {}): void
```
audioRenderer.on('periodReach', 1000, (position) => {
if (position == 1000) {
console.log(`ON Triggered successfully`);
console.info('ON Triggered successfully');
}
});
```
......@@ -3446,10 +3437,10 @@ on(type: 'stateChange', callback: Callback<AudioState\>): void
```
audioRenderer.on('stateChange', (state) => {
if (state == 1) {
console.log(`audio renderer state is: STATE_PREPARED`);
console.info('audio renderer state is: STATE_PREPARED');
}
if (state == 2) {
console.log(`audio renderer state is: STATE_RUNNING`);
console.info('audio renderer state is: STATE_RUNNING');
}
});
```
......@@ -3471,7 +3462,7 @@ on(type: "dataRequest", callback: Callback\<AudioRendererDataInfo>): void;
**示例:**
```
const path = '/data/storage/el2/ba se/haps/entry/cache/PinkPanther60-44100-1c.wav';
const path = '/data/storage/el2/base/haps/entry/cache/PinkPanther60-44100-1c.wav';
let ss = fileio.createStreamSync(path, 'r');
let discardHeader = new ArrayBuffer(44);
ss.readSync(discardHeader);
......@@ -3479,7 +3470,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 +3511,11 @@ getCapturerInfo(callback: AsyncCallback<AudioCapturerInfo\>): 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.info('Capturer getCapturerInfo:');
console.info(`Capturer source: ${capturerInfo.source}`);
console.info(`Capturer flags: ${capturerInfo.capturerFlags}`);
}
});
```
......@@ -3549,15 +3540,15 @@ getCapturerInfo(): Promise<AudioCapturerInfo\>
```
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.error(`AudioFrameworkRecLog: CapturerInfo :ERROR: ${err.message}`);
});
```
......@@ -3580,13 +3571,13 @@ getStreamInfo(callback: AsyncCallback<AudioStreamInfo\>): 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.info('Capturer GetStreamInfo:');
console.info(`Capturer sampling rate: ${streamInfo.samplingRate}`);
console.info(`Capturer channel: ${streamInfo.channels}`);
console.info(`Capturer format: ${streamInfo.sampleFormat}`);
console.info(`Capturer encoding type: ${streamInfo.encodingType}`);
}
});
```
......@@ -3609,13 +3600,13 @@ getStreamInfo(): Promise<AudioStreamInfo\>
```
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.error(`getStreamInfo :ERROR: ${err.message}`);
});
```
......@@ -3638,9 +3629,9 @@ start(callback: AsyncCallback<void\>): 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 +3673,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 +3710,9 @@ stop(callback: AsyncCallback<void\>): void
```
audioCapturer.stop((err) => {
if (err) {
console.error(`Capturer stop failed`);
console.error('Capturer stop failed');
} else {
console.log(`Capturer stopped.`);
console.info('Capturer stopped.');
}
});
```
......@@ -3745,13 +3736,13 @@ stop(): Promise<void\>
```
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 +3765,9 @@ release(callback: AsyncCallback<void\>): void
```
audioCapturer.release((err) => {
if (err) {
console.error(`capturer release failed`);
console.error('capturer release failed');
} else {
console.log(`capturer released.`);
console.info('capturer released.');
}
});
```
......@@ -3801,12 +3792,12 @@ release(): Promise<void\>
```
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 +3823,14 @@ read(size: number, isBlockingRead: boolean, callback: AsyncCallback<ArrayBuffer\
```
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: EROOR: ` + err.message);
console.error(`AudioFrameworkRecLog: getBufferSize: EROOR: ${err.message}`);
});
audioCapturer.read(bufferSize, true, async(err, buffer) => {
if (!err) {
console.log(`Success in reading the buffer data`);
console.info('Success in reading the buffer data');
}
});
```
......@@ -3871,16 +3862,16 @@ read(size: number, isBlockingRead: boolean): Promise<ArrayBuffer\>
```
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 +3894,7 @@ getAudioTime(callback: AsyncCallback<number\>): void
```
audioCapturer.getAudioTime((err, timestamp) => {
console.log(`Current timestamp: ` + timestamp);
console.info(`Current timestamp: ${timestamp}`);
});
```
......@@ -3926,9 +3917,9 @@ getAudioTime(): Promise<number\>
```
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 +3943,11 @@ getBufferSize(callback: AsyncCallback<number\>): void
```
audioCapturer.getBufferSize((err, bufferSize) => {
if (!err) {
console.log(`BufferSize : ` + bufferSize);
console.info(`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.error(`AudioFrameworkRecLog: AudioCapturer Created : ERROR : ${err.message}`);
});
}
});
......@@ -3982,10 +3973,10 @@ getBufferSize(): Promise<number\>
```
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}`);
});
```
......@@ -4000,18 +3991,18 @@ on(type: 'markReach', frame: number, callback: (position: number) => {}): void
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| :------- | :---------------------- | :--- | :----------------------------------------- |
| type | string | 是 | 事件回调类型,支持的事件为:'markReach'。 |
| frame | number | 是 | 触发事件的帧数。 该值必须大于0。 |
| callback | position: number) => {} | 是 | 使用callback方式异步返回被触发事件的回调。 |
| 参数名 | 类型 | 必填 | 说明 |
| :------- | :---------------------- | :--- | :----------------------------------------- |
| type | string | 是 | 事件回调类型,支持的事件为:'markReach'。 |
| frame | number | 是 | 触发事件的帧数。 该值必须大于0。 |
| callback | (position: number) => {} | 是 | 使用callback方式异步返回被触发事件的回调。 |
**示例:**
```
audioCapturer.on('markReach', 1000, (position) => {
if (position == 1000) {
console.log(`ON Triggered successfully`);
console.info('ON Triggered successfully');
}
});
```
......@@ -4057,7 +4048,7 @@ on(type: "periodReach", frame: number, callback: (position: number) => {}): void
```
audioCapturer.on('periodReach', 1000, (position) => {
if (position == 1000) {
console.log(`ON Triggered successfully`);
console.info('ON Triggered successfully');
}
});
```
......@@ -4102,10 +4093,10 @@ on(type: 'stateChange', callback: Callback<AudioState\>): void
```
audioCapturer.on('stateChange', (state) => {
if (state == 1) {
console.log(`audio capturer state is: STATE_PREPARED`);
console.info('audio capturer state is: STATE_PREPARED');
}
if (state == 2) {
console.log(`audio capturer state is: STATE_RUNNING`);
console.info('audio capturer state is: STATE_RUNNING');
}
});
```
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册