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

!9828 示例代码错误修改

Merge pull request !9828 from 一杯丞丞汁儿/master
......@@ -161,6 +161,8 @@ createAudioCapturer(options: AudioCapturerOptions, callback: AsyncCallback<Audio
**系统能力:** SystemCapability.Multimedia.Audio.Capturer
**需要权限:** ohos.permission.MICROPHONE
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -207,6 +209,8 @@ createAudioCapturer(options: AudioCapturerOptions): Promise<AudioCapturer\>
**系统能力:** SystemCapability.Multimedia.Audio.Capturer
**需要权限:** ohos.permission.MICROPHONE
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -2149,12 +2153,13 @@ getStreamManager(callback: AsyncCallback\<AudioStreamManager>): void
```js
var audioManager = audio.getAudioManager();
let audioStreamManager;
audioManager.getStreamManager((err, data) => {
if (err) {
console.error(`getStreamManager : Error: ${err}`);
} else {
console.info('getStreamManager : Success : SUCCESS');
let audioStreamManager = data;
audioStreamManager = data;
}
});
```
......@@ -2343,23 +2348,6 @@ setVolume(volumeType: AudioVolumeType, volume: number, callback: AsyncCallback&l
**示例:**
```js
var audioManager = audio.getAudioManager();
var audioGroupManager;
async function getGroupManager(){
let value = await audioManager.getVolumeGroups(audio.LOCAL_NETWORK_ID);
if (value.length > 0) {
let groupid = value[0].groupId;
audioManager.getGroupManager(groupid, (err, value) => {
if (err) {
console.error(`Failed to obtain the volume group infos list. ${err}`);
return;
}
audioGroupManager = value
console.info('Callback invoked to indicate that the volume group infos list is obtained.');
});
}
}
audioGroupManager.setVolume(audio.AudioVolumeType.MEDIA, 10, (err) => {
if (err) {
console.error(`Failed to set the volume. ${err}`);
......@@ -2399,24 +2387,6 @@ setVolume(volumeType: AudioVolumeType, volume: number): Promise&lt;void&gt;
**示例:**
```js
var audioManager = audio.getAudioManager();
var audioGroupManager;
async function getGroupManager(){
let value = await audioManager.getVolumeGroups(audio.LOCAL_NETWORK_ID);
if (value.length > 0) {
let groupid = value[0].groupId;
audioManager.getGroupManager(groupid, (err, value) => {
if (err) {
console.error(`Failed to obtain the volume group infos list. ${err}`);
return;
}
audioGroupManager = value
console.info('Callback invoked to indicate that the volume group infos list is obtained.');
});
}
}
audioGroupManager.setVolume(audio.AudioVolumeType.MEDIA, 10).then(() => {
console.info('Promise returned to indicate a successful volume setting.');
});
......@@ -2442,23 +2412,6 @@ getVolume(volumeType: AudioVolumeType, callback: AsyncCallback&lt;number&gt;): v
**示例:**
```js
var audioManager = audio.getAudioManager();
var audioGroupManager;
async function getGroupManager(){
let value = await audioManager.getVolumeGroups(audio.LOCAL_NETWORK_ID);
if (value.length > 0) {
let groupid = value[0].groupId;
audioManager.getGroupManager(groupid, (err, value) => {
if (err) {
console.error(`Failed to obtain the volume group infos list. ${err}`);
return;
}
audioGroupManager = value
console.info('Callback invoked to indicate that the volume group infos list is obtained.');
});
}
}
audioGroupManager.getVolume(audio.AudioVolumeType.MEDIA, (err, value) => {
if (err) {
console.error(`Failed to obtain the volume. ${err}`);
......@@ -2493,23 +2446,6 @@ getVolume(volumeType: AudioVolumeType): Promise&lt;number&gt;
**示例:**
```js
var audioManager = audio.getAudioManager();
var audioGroupManager;
async function getGroupManager(){
let value = await audioManager.getVolumeGroups(audio.LOCAL_NETWORK_ID);
if (value.length > 0) {
let groupid = value[0].groupId;
audioManager.getGroupManager(groupid, (err, value) => {
if (err) {
console.error(`Failed to obtain the volume group infos list. ${err}`);
return;
}
audioGroupManager = value
console.info('Callback invoked to indicate that the volume group infos list is obtained.');
});
}
}
audioGroupManager.getVolume(audio.AudioVolumeType.MEDIA).then((value) => {
console.info(`Promise returned to indicate that the volume is obtained ${value}.`);
});
......@@ -2535,23 +2471,6 @@ getMinVolume(volumeType: AudioVolumeType, callback: AsyncCallback&lt;number&gt;)
**示例:**
```js
var audioManager = audio.getAudioManager();
var audioGroupManager;
async function getGroupManager(){
let value = await audioManager.getVolumeGroups(audio.LOCAL_NETWORK_ID);
if (value.length > 0) {
let groupid = value[0].groupId;
audioManager.getGroupManager(groupid, (err, value) => {
if (err) {
console.error(`Failed to obtain the volume group infos list. ${err}`);
return;
}
audioGroupManager = value
console.info('Callback invoked to indicate that the volume group infos list is obtained.');
});
}
}
audioGroupManager.getMinVolume(audio.AudioVolumeType.MEDIA, (err, value) => {
if (err) {
console.error(`Failed to obtain the minimum volume. ${err}`);
......@@ -2586,23 +2505,6 @@ getMinVolume(volumeType: AudioVolumeType): Promise&lt;number&gt;
**示例:**
```js
var audioManager = audio.getAudioManager();
var audioGroupManager;
async function getGroupManager(){
let value = await audioManager.getVolumeGroups(audio.LOCAL_NETWORK_ID);
if (value.length > 0) {
let groupid = value[0].groupId;
audioManager.getGroupManager(groupid, (err, value) => {
if (err) {
console.error(`Failed to obtain the volume group infos list. ${err}`);
return;
}
audioGroupManager = value
console.info('Callback invoked to indicate that the volume group infos list is obtained.');
});
}
}
audioGroupManager.getMinVolume(audio.AudioVolumeType.MEDIA).then((value) => {
console.info(`Promised returned to indicate that the minimum volume is obtained ${value}.`);
});
......@@ -2628,23 +2530,6 @@ getMaxVolume(volumeType: AudioVolumeType, callback: AsyncCallback&lt;number&gt;)
**示例:**
```js
var audioManager = audio.getAudioManager();
var audioGroupManager;
async function getGroupManager(){
let value = await audioManager.getVolumeGroups(audio.LOCAL_NETWORK_ID);
if (value.length > 0) {
let groupid = value[0].groupId;
audioManager.getGroupManager(groupid, (err, value) => {
if (err) {
console.error(`Failed to obtain the volume group infos list. ${err}`);
return;
}
audioGroupManager = value
console.info('Callback invoked to indicate that the volume group infos list is obtained.');
});
}
}
audioGroupManager.getMaxVolume(audio.AudioVolumeType.MEDIA, (err, value) => {
if (err) {
console.error(`Failed to obtain the maximum volume. ${err}`);
......@@ -2679,23 +2564,6 @@ getMaxVolume(volumeType: AudioVolumeType): Promise&lt;number&gt;
**示例:**
```js
var audioManager = audio.getAudioManager();
var audioGroupManager;
async function getGroupManager(){
let value = await audioManager.getVolumeGroups(audio.LOCAL_NETWORK_ID);
if (value.length > 0) {
let groupid = value[0].groupId;
audioManager.getGroupManager(groupid, (err, value) => {
if (err) {
console.error(`Failed to obtain the volume group infos list. ${err}`);
return;
}
audioGroupManager = value
console.info('Callback invoked to indicate that the volume group infos list is obtained.');
});
}
}
audioGroupManager.getMaxVolume(audio.AudioVolumeType.MEDIA).then((data) => {
console.info('Promised returned to indicate that the maximum volume is obtained.');
});
......@@ -2726,23 +2594,6 @@ mute(volumeType: AudioVolumeType, mute: boolean, callback: AsyncCallback&lt;void
**示例:**
```js
var audioManager = audio.getAudioManager();
var audioGroupManager;
async function getGroupManager(){
let value = await audioManager.getVolumeGroups(audio.LOCAL_NETWORK_ID);
if (value.length > 0) {
let groupid = value[0].groupId;
audioManager.getGroupManager(groupid, (err, value) => {
if (err) {
console.error(`Failed to obtain the volume group infos list. ${err}`);
return;
}
audioGroupManager = value
console.info('Callback invoked to indicate that the volume group infos list is obtained.');
});
}
}
audioGroupManager.mute(audio.AudioVolumeType.MEDIA, true, (err) => {
if (err) {
console.error(`Failed to mute the stream. ${err}`);
......@@ -2782,23 +2633,6 @@ mute(volumeType: AudioVolumeType, mute: boolean): Promise&lt;void&gt;
**示例:**
```js
var audioManager = audio.getAudioManager();
var audioGroupManager;
async function getGroupManager(){
let value = await audioManager.getVolumeGroups(audio.LOCAL_NETWORK_ID);
if (value.length > 0) {
let groupid = value[0].groupId;
audioManager.getGroupManager(groupid, (err, value) => {
if (err) {
console.error(`Failed to obtain the volume group infos list. ${err}`);
return;
}
audioGroupManager = value
console.info('Callback invoked to indicate that the volume group infos list is obtained.');
});
}
}
audioGroupManager.mute(audio.AudioVolumeType.MEDIA, true).then(() => {
console.info('Promise returned to indicate that the stream is muted.');
});
......@@ -2824,23 +2658,6 @@ isMute(volumeType: AudioVolumeType, callback: AsyncCallback&lt;boolean&gt;): voi
**示例:**
```js
var audioManager = audio.getAudioManager();
var audioGroupManager;
async function getGroupManager(){
let value = await audioManager.getVolumeGroups(audio.LOCAL_NETWORK_ID);
if (value.length > 0) {
let groupid = value[0].groupId;
audioManager.getGroupManager(groupid, (err, value) => {
if (err) {
console.error(`Failed to obtain the volume group infos list. ${err}`);
return;
}
audioGroupManager = value
console.info('Callback invoked to indicate that the volume group infos list is obtained.');
});
}
}
audioGroupManager.isMute(audio.AudioVolumeType.MEDIA, (err, value) => {
if (err) {
console.error(`Failed to obtain the mute status. ${err}`);
......@@ -2875,23 +2692,6 @@ isMute(volumeType: AudioVolumeType): Promise&lt;boolean&gt;
**示例:**
```js
var audioManager = audio.getAudioManager();
var audioGroupManager;
async function getGroupManager(){
let value = await audioManager.getVolumeGroups(audio.LOCAL_NETWORK_ID);
if (value.length > 0) {
let groupid = value[0].groupId;
audioManager.getGroupManager(groupid, (err, value) => {
if (err) {
console.error(`Failed to obtain the volume group infos list. ${err}`);
return;
}
audioGroupManager = value
console.info('Callback invoked to indicate that the volume group infos list is obtained.');
});
}
}
audioGroupManager.isMute(audio.AudioVolumeType.MEDIA).then((value) => {
console.info(`Promise returned to indicate that the mute status of the stream is obtained ${value}.`);
});
......@@ -2918,17 +2718,6 @@ getCurrentAudioRendererInfoArray(callback: AsyncCallback&lt;AudioRendererChangeI
**示例:**
```js
var audioManager = audio.getAudioManager();
let audioStreamManager;
audioManager.getStreamManager((err, data) => {
if (err) {
console.error(`getStreamManager : Error: ${err}`);
} else {
console.info('getStreamManager : Success : SUCCESS');
audioStreamManager = data;
}
});
audioStreamManager.getCurrentAudioRendererInfoArray(async (err, AudioRendererChangeInfoArray) => {
console.info('getCurrentAudioRendererInfoArray **** Get Callback Called ****');
if (err) {
......@@ -2976,43 +2765,34 @@ getCurrentAudioRendererInfoArray(): Promise&lt;AudioRendererChangeInfoArray&gt;
**示例:**
```js
var audioManager = audio.getAudioManager();
let audioStreamManager;
audioManager.getStreamManager((err, data) => {
if (err) {
console.error(`getStreamManager : Error: ${err}`);
} else {
console.info('getStreamManager : Success : SUCCESS');
audioStreamManager = data;
}
});
await audioStreamManager.getCurrentAudioRendererInfoArray().then( function (AudioRendererChangeInfoArray) {
console.info(`getCurrentAudioRendererInfoArray ######### Get Promise is called ##########`);
if (AudioRendererChangeInfoArray != null) {
for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) {
let 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}`);
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}`);
async function getCurrentAudioRendererInfoArray(){
await audioStreamManager.getCurrentAudioRendererInfoArray().then( function (AudioRendererChangeInfoArray) {
console.info(`getCurrentAudioRendererInfoArray ######### Get Promise is called ##########`);
if (AudioRendererChangeInfoArray != null) {
for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) {
let 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}`);
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.error(`getCurrentAudioRendererInfoArray :ERROR: ${err}`);
});
}).catch((err) => {
console.error(`getCurrentAudioRendererInfoArray :ERROR: ${err}`);
});
}
```
### getCurrentAudioCapturerInfoArray<sup>9+</sup>
......@@ -3032,17 +2812,6 @@ getCurrentAudioCapturerInfoArray(callback: AsyncCallback&lt;AudioCapturerChangeI
**示例:**
```js
var audioManager = audio.getAudioManager();
let audioStreamManager;
audioManager.getStreamManager((err, data) => {
if (err) {
console.error(`getStreamManager : Error: ${err}`);
} else {
console.info('getStreamManager : Success : SUCCESS');
audioStreamManager = data;
}
});
audioStreamManager.getCurrentAudioCapturerInfoArray(async (err, AudioCapturerChangeInfoArray) => {
console.info('getCurrentAudioCapturerInfoArray **** Get Callback Called ****');
if (err) {
......@@ -3088,41 +2857,32 @@ getCurrentAudioCapturerInfoArray(): Promise&lt;AudioCapturerChangeInfoArray&gt;
**示例:**
```js
var audioManager = audio.getAudioManager();
let audioStreamManager;
audioManager.getStreamManager((err, data) => {
if (err) {
console.error(`getStreamManager : Error: ${err}`);
} else {
console.info('getStreamManager : Success : SUCCESS');
audioStreamManager = data;
}
});
await audioStreamManager.getCurrentAudioCapturerInfoArray().then( function (AudioCapturerChangeInfoArray) {
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}`);
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}`);
async function getCurrentAudioCapturerInfoArray(){
await audioStreamManager.getCurrentAudioCapturerInfoArray().then( function (AudioCapturerChangeInfoArray) {
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}`);
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}`);
}
}
}
}
}).catch((err) => {
console.error(`getCurrentAudioCapturerInfoArray :ERROR: ${err}`);
});
}).catch((err) => {
console.error(`getCurrentAudioCapturerInfoArray :ERROR: ${err}`);
});
}
```
### on('audioRendererChange')<sup>9+</sup>
......@@ -3143,17 +2903,6 @@ on(type: "audioRendererChange", callback: Callback&lt;AudioRendererChangeInfoArr
**示例:**
```js
var audioManager = audio.getAudioManager();
let audioStreamManager;
audioManager.getStreamManager((err, data) => {
if (err) {
console.error(`getStreamManager : Error: ${err}`);
} else {
console.info('getStreamManager : Success : SUCCESS');
audioStreamManager = data;
}
});
audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => {
for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) {
let AudioRendererChangeInfo = AudioRendererChangeInfoArray[i];
......@@ -3195,17 +2944,6 @@ off(type: "audioRendererChange");
**示例:**
```js
var audioManager = audio.getAudioManager();
let audioStreamManager;
audioManager.getStreamManager((err, data) => {
if (err) {
console.error(`getStreamManager : Error: ${err}`);
} else {
console.info('getStreamManager : Success : SUCCESS');
audioStreamManager = data;
}
});
audioStreamManager.off('audioRendererChange');
console.info('######### RendererChange Off is called #########');
```
......@@ -3228,17 +2966,6 @@ on(type: "audioCapturerChange", callback: Callback&lt;AudioCapturerChangeInfoArr
**示例:**
```js
var audioManager = audio.getAudioManager();
let audioStreamManager;
audioManager.getStreamManager((err, data) => {
if (err) {
console.error(`getStreamManager : Error: ${err}`);
} else {
console.info('getStreamManager : Success : SUCCESS');
audioStreamManager = data;
}
});
audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => {
for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) {
console.info(`## CapChange on is called for element ${i} ##`);
......@@ -3279,17 +3006,6 @@ off(type: "audioCapturerChange");
**示例:**
```js
var audioManager = audio.getAudioManager();
let audioStreamManager;
audioManager.getStreamManager((err, data) => {
if (err) {
console.error(`getStreamManager : Error: ${err}`);
} else {
console.info('getStreamManager : Success : SUCCESS');
audioStreamManager = data;
}
});
audioStreamManager.off('audioCapturerChange');
console.info('######### CapturerChange Off is called #########');
......@@ -3416,7 +3132,6 @@ off(type: 'deviceChange', callback?: Callback<DeviceChangeAction\>): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------------------------------- | ---- | ------------------------------------------ |
| type | string | 是 | 订阅的事件的类型。支持事件:'deviceChange' |
| deviceFlag | [DeviceFlag](#deviceflag) | 是 | 设备类型的flag。 |
| callback | Callback<[DeviceChangeAction](#devicechangeaction)> | 否 | 获取设备更新详情。 |
**示例:**
......@@ -3426,9 +3141,8 @@ var audioManager = audio.getAudioManager();
audioManager.getRoutingManager((err,AudioRoutingManager)=>{
if (err) {
console.error(`AudioFrameworkTest:Callback:failed to get RoutingManager ${err}`);
}
else {
AudioRoutingManager.off('deviceChange', audio.DeviceFlag.OUTPUT_DEVICES_FLAG, (deviceChanged) => {
} else {
AudioRoutingManager.off('deviceChange', (deviceChanged) => {
console.info('Should be no callback.');
});
}
......@@ -5041,6 +4755,11 @@ var audioCapturerInfo = {
capturerFlags: 0
}
var audioCapturerOptions = {
streamInfo: audioStreamInfo,
capturerInfo: audioCapturerInfo
}
var audioCapturer;
audio.createAudioCapturer(audioCapturerOptions).then((data) => {
audioCapturer = data;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册