提交 8876649d 编写于 作者: J jiao_yanlin

Modify log output calls and use of single quotes

Signed-off-by: Njiao_yanlin <jiaoyanlin@huawei.com>
上级 d88a10fa
......@@ -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}`);
});
```
......@@ -699,7 +699,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.');
});
```
......@@ -730,7 +730,7 @@ setVolume(volumeType: AudioVolumeType, volume: number): Promise&lt;void&gt;
```
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.');
});
```
......@@ -757,7 +757,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.');
});
```
......@@ -785,7 +785,7 @@ getVolume(volumeType: AudioVolumeType): Promise&lt;number&gt;
```
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} .`);
});
```
......@@ -812,7 +812,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}`);
});
```
......@@ -840,7 +840,7 @@ getMinVolume(volumeType: AudioVolumeType): Promise&lt;number&gt;
```
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}`);
});
```
......@@ -867,7 +867,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}`);
});
```
......@@ -895,7 +895,7 @@ getMaxVolume(volumeType: AudioVolumeType): Promise&lt;number&gt;
```
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.');
});
```
......@@ -925,7 +925,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.');
});
```
......@@ -957,7 +957,7 @@ mute(volumeType: AudioVolumeType, mute: boolean): Promise&lt;void&gt;
```
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.');
});
```
......@@ -985,7 +985,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}`);
});
```
......@@ -1014,7 +1014,7 @@ isMute(volumeType: AudioVolumeType): Promise&lt;boolean&gt;
```
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}.`);
});
```
......@@ -1041,7 +1041,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}.`);
});
```
......@@ -1069,7 +1069,7 @@ isActive(volumeType: AudioVolumeType): Promise&lt;boolean&gt;
```
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}.`);
});
```
......@@ -1098,7 +1098,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.');
});
```
......@@ -1128,7 +1128,7 @@ setRingerMode(mode: AudioRingMode): Promise&lt;void&gt;
```
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.');
});
```
......@@ -1155,7 +1155,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}.`);
});
```
......@@ -1178,8 +1178,8 @@ getRingerMode(): Promise&lt;AudioRingMode&gt;
```
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}.`);
})
```
### setAudioParameter
......@@ -1210,7 +1210,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.');
});
```
......@@ -1243,7 +1243,7 @@ setAudioParameter(key: string, value: string): Promise&lt;void&gt;
```
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.');
});
```
......@@ -1272,7 +1272,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}.`);
});
```
......@@ -1302,7 +1302,7 @@ getAudioParameter(key: string): Promise&lt;string&gt;
```
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}.`);
});
```
......@@ -1328,7 +1328,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.');
});
```
......@@ -1356,7 +1356,7 @@ getDevices(deviceFlag: DeviceFlag): Promise&lt;AudioDeviceDescriptors&gt;
```
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.');
});
```
......@@ -1384,7 +1384,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.');
});
```
......@@ -1414,7 +1414,7 @@ setDeviceActive(deviceType: ActiveDeviceType, active: boolean): Promise&lt;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.');
});
```
......@@ -1441,7 +1441,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.');
});
```
......@@ -1470,7 +1470,7 @@ isDeviceActive(deviceType: ActiveDeviceType): Promise&lt;boolean&gt;
```
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}.`);
});
```
......@@ -1499,7 +1499,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.');
});
```
......@@ -1529,7 +1529,7 @@ setMicrophoneMute(mute: boolean): Promise&lt;void&gt;
```
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.');
});
```
......@@ -1557,7 +1557,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}.`);
});
```
......@@ -1579,10 +1579,9 @@ isMicrophoneMute(): Promise&lt;boolean&gt;
**示例:**
```
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}.`);
});
```
......@@ -1609,9 +1608,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} `);
});
```
......@@ -1636,7 +1635,7 @@ on(type: 'ringerModeChange', callback: Callback\<AudioRingMode>): void
```
audioManager.on('ringerModeChange', (ringerMode) => {
console.log(`Updated ringermode: ` + ringerMode);
console.info(`Updated ringermode: ${ringerMode}`);
});
```
......@@ -1659,10 +1658,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} `);
});
```
......@@ -1685,7 +1684,7 @@ off(type: 'deviceChange', callback?: Callback<DeviceChangeAction\>): void
```
audioManager.off('deviceChange', (deviceChanged) => {
console.log(`Should be no callback.`);
console.info('Should be no callback.');
});
```
......@@ -1715,12 +1714,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} `);
}
});
```
......@@ -1751,8 +1750,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} `);
}
});
```
......@@ -1782,7 +1781,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.');
});
```
......@@ -1812,9 +1811,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}`);
});
```
......@@ -1840,7 +1839,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}.`);
});
```
......@@ -1863,9 +1862,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}`);
});
```
......@@ -1890,30 +1889,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}`);
}
}
}
......@@ -1942,27 +1939,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}`);
});
```
......@@ -1983,27 +1979,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}`);
}
}
}
......@@ -2028,29 +2023,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}`);
});
```
......@@ -2074,23 +2068,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}`);
}
}
});
......@@ -2113,7 +2106,7 @@ off(type: "audioRendererChange");
**示例:**
```
audioStreamManager.off('audioRendererChange');
console.info(`######### RendererChange Off is called #########`);
console.info('######### RendererChange Off is called #########');
```
### on('audioCapturerChange')<sup>9+</sup>
......@@ -2135,21 +2128,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}`);
}
}
});
......@@ -2172,7 +2166,7 @@ off(type: "audioCapturerChange");
**示例:**
```
audioStreamManager.off('audioCapturerChange');
console.info(`######### CapturerChange Off is called #########`);
console.info('######### CapturerChange Off is called #########');
```
......@@ -2202,48 +2196,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}`);
}
}
});
......@@ -2274,30 +2267,29 @@ 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}`);
}
}
});
......@@ -2338,12 +2330,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');
}
});
```
......@@ -2384,10 +2376,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}`);
});
```
......@@ -2408,15 +2400,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}`);
});
```
......@@ -2438,11 +2428,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}`);
});
```
......@@ -2464,13 +2454,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}`);
});
```
......@@ -2493,9 +2483,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.');
}
});
```
......@@ -2518,9 +2508,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}`);
});
```
......@@ -2543,9 +2533,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.');
}
});
```
......@@ -2568,9 +2558,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}`);
});
```
......@@ -2593,9 +2583,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.');
}
});
```
......@@ -2618,9 +2608,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}`);
});
```
......@@ -2643,9 +2633,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.');
}
});
```
......@@ -2668,9 +2658,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}`);
});
```
......@@ -2693,9 +2683,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.');
}
});
```
......@@ -2718,9 +2708,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}`);
});
```
......@@ -2766,29 +2756,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}`);
}
});
```
......@@ -2834,18 +2824,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';
......@@ -2854,12 +2844,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}`);
});
```
......@@ -2881,7 +2871,7 @@ getAudioTime(callback: AsyncCallback\<number>): void
```
audioRenderer.getAudioTime((err, timestamp) => {
console.log(`Current timestamp: ` + timestamp);
console.info(`Current timestamp: ${timestamp}`);
});
```
......@@ -2903,9 +2893,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}`);
});
```
......@@ -2928,7 +2918,7 @@ getBufferSize(callback: AsyncCallback\<number>): void
```
var bufferSize = audioRenderer.getBufferSize(async(err, bufferSize) => {
if (err) {
console.error(`getBufferSize error`);
console.error('getBufferSize error');
}
});
```
......@@ -2975,14 +2965,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}`);
});
```
......@@ -3006,9 +2996,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.');
}
});
```
......@@ -3037,9 +3027,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}`);
});
```
......@@ -3061,7 +3051,7 @@ getRenderRate(callback: AsyncCallback\<AudioRendererRate>): void
```
audioRenderer.getRenderRate((err, renderrate) => {
console.log(`getRenderRate: ` + renderrate);
console.info(`getRenderRate: ${renderrate}`);
});
```
......@@ -3083,9 +3073,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>
......@@ -3129,9 +3119,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>
......@@ -3171,9 +3161,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>
......@@ -3200,40 +3190,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;
}
......@@ -3262,7 +3252,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');
}
});
```
......@@ -3309,7 +3299,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');
}
});
```
......@@ -3354,10 +3344,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');
}
});
```
......@@ -3399,11 +3389,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}`);
}
});
```
......@@ -3428,15 +3418,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}`);
});
```
......@@ -3459,13 +3449,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}`);
}
});
```
......@@ -3488,13 +3478,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}`);
});
```
......@@ -3517,9 +3507,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.');
}
});
```
......@@ -3561,20 +3551,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;
});
```
......@@ -3598,9 +3588,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.');
}
});
```
......@@ -3624,13 +3614,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}`);
});
```
......@@ -3653,9 +3643,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.');
}
});
```
......@@ -3680,12 +3670,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}`);
});
```
......@@ -3711,14 +3701,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');
}
});
```
......@@ -3750,16 +3740,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}`);
});
```
......@@ -3782,7 +3772,7 @@ getAudioTime(callback: AsyncCallback<number\>): void
```
audioCapturer.getAudioTime((err, timestamp) => {
console.log(`Current timestamp: ` + timestamp);
console.info(`Current timestamp: ${timestamp}`);
});
```
......@@ -3805,9 +3795,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}`);
});
```
......@@ -3831,11 +3821,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}`);
});
}
});
......@@ -3861,10 +3851,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}`);
});
```
......@@ -3890,7 +3880,7 @@ on(type: 'markReach', frame: number, callback: (position: number) => {}): void
```
audioCapturer.on('markReach', 1000, (position) => {
if (position == 1000) {
console.log(`ON Triggered successfully`);
console.info('ON Triggered successfully');
}
});
```
......@@ -3936,7 +3926,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');
}
});
```
......@@ -3981,10 +3971,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.
先完成此消息的编辑!
想要评论请 注册