提交 4d029b0c 编写于 作者: W wangzx0705

modify docs format

Signed-off-by: Nwangzx0705 <wangzx0705@thundersoft.com>
上级 0afa6437
...@@ -2995,20 +2995,20 @@ isVolumeUnadjustable(): boolean ...@@ -2995,20 +2995,20 @@ isVolumeUnadjustable(): boolean
| 类型 | 说明 | | 类型 | 说明 |
| ---------------------- | ------------------------------------------------------ | | ---------------------- | ------------------------------------------------------ |
| boolean | 同步回调返回固定音量模式开关状态,true为固定音量模式,false为非固定音量模式。 | | boolean | 同步接口,返回固定音量模式开关状态,true为固定音量模式,false为非固定音量模式。 |
**示例:** **示例:**
```js ```js
bool switch = audioVolumeGroupManager.isVolumeUnadjustable(); bool switch = audioVolumeGroupManager.isVolumeUnadjustable();
console.info(`Whether it is volume unadjustable: ${switch} `); console.info(`Whether it is volume unadjustable: ${switch}.`);
``` ```
### adjustVolumeByStep<sup>10+</sup> ### adjustVolumeByStep<sup>10+</sup>
adjustVolumeByStep(adjustType: VolumeAdjustType, callback: AsyncCallback&lt;void&gt;): void adjustVolumeByStep(adjustType: VolumeAdjustType, callback: AsyncCallback&lt;void&gt;): void
调节当前最高优先级的流的音量,使音量值加一或减一,使用callback方式异步返回结果。 调节当前最高优先级的流的音量,使音量值按步长加或减,使用callback方式异步返回结果。
**需要权限:** ohos.permission.ACCESS_NOTIFICATION_POLICY **需要权限:** ohos.permission.ACCESS_NOTIFICATION_POLICY
...@@ -3032,8 +3032,9 @@ audioVolumeGroupManager.adjustVolumeByStep(audio.VolumeAdjustType.VOLUME_UP, (er ...@@ -3032,8 +3032,9 @@ audioVolumeGroupManager.adjustVolumeByStep(audio.VolumeAdjustType.VOLUME_UP, (er
if (err) { if (err) {
console.error(`Failed to adjust the volume by step. ${err}`); console.error(`Failed to adjust the volume by step. ${err}`);
return; return;
} } else {
console.info('Success to adjust the volume by step.'); console.info('Success to adjust the volume by step.');
}
}); });
``` ```
### adjustVolumeByStep<sup>10+</sup> ### adjustVolumeByStep<sup>10+</sup>
...@@ -3067,7 +3068,7 @@ adjustVolumeByStep(adjustType: VolumeAdjustType): Promise&lt;void&gt; ...@@ -3067,7 +3068,7 @@ adjustVolumeByStep(adjustType: VolumeAdjustType): Promise&lt;void&gt;
```js ```js
audioVolumeGroupManager.adjustVolumeByStep(audio.VolumeAdjustType.VOLUME_UP).then(() => { audioVolumeGroupManager.adjustVolumeByStep(audio.VolumeAdjustType.VOLUME_UP).then(() => {
console.info('Success to adjust the volume by step.'); console.info('Success to adjust the volume by step.');
}).catch((error)=>{ }).catch((error) => {
console.info('Fail to adjust the volume by step.'); console.info('Fail to adjust the volume by step.');
}); });
``` ```
...@@ -3099,10 +3100,10 @@ adjustSystemVolumeByStep(volumeType: AudioVolumeType, adjustType: VolumeAdjustTy ...@@ -3099,10 +3100,10 @@ adjustSystemVolumeByStep(volumeType: AudioVolumeType, adjustType: VolumeAdjustTy
```js ```js
audioVolumeGroupManager.adjustSystemVolumeByStep(audio.AudioVolumeType.MEDIA, audio.VolumeAdjustType.VOLUME_UP, (err) => { audioVolumeGroupManager.adjustSystemVolumeByStep(audio.AudioVolumeType.MEDIA, audio.VolumeAdjustType.VOLUME_UP, (err) => {
if (err) { if (err) {
console.error(`Failed to adjust the system volume by step. ${err}`); console.error(`Failed to adjust the system volume by step ${err}`);
return; } else {
}
console.info('Success to adjust the system volume by step.'); console.info('Success to adjust the system volume by step.');
}
}); });
``` ```
### adjustSystemVolumeByStep<sup>10+</sup> ### adjustSystemVolumeByStep<sup>10+</sup>
...@@ -3137,7 +3138,7 @@ adjustSystemVolumeByStep(volumeType: AudioVolumeType, adjustType: VolumeAdjustTy ...@@ -3137,7 +3138,7 @@ adjustSystemVolumeByStep(volumeType: AudioVolumeType, adjustType: VolumeAdjustTy
```js ```js
audioVolumeGroupManager.adjustSystemVolumeByStep(audio.AudioVolumeType.MEDIA, audio.VolumeAdjustType.VOLUME_UP).then(() => { audioVolumeGroupManager.adjustSystemVolumeByStep(audio.AudioVolumeType.MEDIA, audio.VolumeAdjustType.VOLUME_UP).then(() => {
console.info('Success to adjust the system volume by step.'); console.info('Success to adjust the system volume by step.');
}).catch((error)=>{ }).catch((error) => {
console.info('Fail to adjust the system volume by step.'); console.info('Fail to adjust the system volume by step.');
}); });
``` ```
...@@ -3167,9 +3168,9 @@ getSystemVolumeInDb(volumeType: AudioVolumeType, volumeLevel: number, device: De ...@@ -3167,9 +3168,9 @@ getSystemVolumeInDb(volumeType: AudioVolumeType, volumeLevel: number, device: De
audioVolumeGroupManager.getSystemVolumeInDb(audio.AudioVolumeType.MEDIA, 3, audio.DeviceType.SPEAKER, (err, dB) => { audioVolumeGroupManager.getSystemVolumeInDb(audio.AudioVolumeType.MEDIA, 3, audio.DeviceType.SPEAKER, (err, dB) => {
if (err) { if (err) {
console.error(`Failed to get the volume DB. ${err}`); console.error(`Failed to get the volume DB. ${err}`);
return; } else {
}
console.info(`Success to get the volume DB. ${dB}`); console.info(`Success to get the volume DB. ${dB}`);
}
}); });
``` ```
### getSystemVolumeInDb<sup>10+</sup> ### getSystemVolumeInDb<sup>10+</sup>
...@@ -3201,7 +3202,7 @@ getSystemVolumeInDb(volumeType: AudioVolumeType, volumeLevel: number, device: De ...@@ -3201,7 +3202,7 @@ getSystemVolumeInDb(volumeType: AudioVolumeType, volumeLevel: number, device: De
```js ```js
audioVolumeGroupManager.getSystemVolumeInDb(audio.AudioVolumeType.MEDIA, 3, audio.DeviceType.SPEAKER).then((dB) => { audioVolumeGroupManager.getSystemVolumeInDb(audio.AudioVolumeType.MEDIA, 3, audio.DeviceType.SPEAKER).then((dB) => {
console.info(`Success to get the volume DB. ${dB}`); console.info(`Success to get the volume DB. ${dB}`);
}).catch((error)=>{ }).catch((error) => {
console.info(`Fail to adjust the system volume by step. ${error}`); console.info(`Fail to adjust the system volume by step. ${error}`);
}); });
``` ```
...@@ -5495,10 +5496,11 @@ getMinStreamVolume(callback: AsyncCallback&lt;number&gt;): void ...@@ -5495,10 +5496,11 @@ getMinStreamVolume(callback: AsyncCallback&lt;number&gt;): void
```js ```js
audioRenderer.getMinStreamVolume((err, minVolume) => { audioRenderer.getMinStreamVolume((err, minVolume) => {
if(err){ if (err) {
console.error(`Get min stream volume Fail: ${err}`); console.error(`getMinStreamVolume error: ${err}`);
} else {
console.info(`getMinStreamVolume Success! ${minVolume}`);
} }
console.info(`Get min stream volume Success! ${minVolume}`);
}); });
``` ```
### getMinStreamVolume<sup>10+</sup> ### getMinStreamVolume<sup>10+</sup>
...@@ -5543,10 +5545,11 @@ getMaxStreamVolume(callback: AsyncCallback&lt;number&gt;): void ...@@ -5543,10 +5545,11 @@ getMaxStreamVolume(callback: AsyncCallback&lt;number&gt;): void
```js ```js
audioRenderer.getMaxStreamVolume((err, maxVolume) => { audioRenderer.getMaxStreamVolume((err, maxVolume) => {
if(err){ if (err) {
console.error(`Get max stream volume Fail: ${err}`); console.error(`getMaxStreamVolume Fail: ${err}`);
} else {
console.info(`getMaxStreamVolume Success! ${maxVolume}`);
} }
console.info(`Get max stream volume Success! ${maxVolume}`);
}); });
``` ```
### getMaxStreamVolume<sup>10+</sup> ### getMaxStreamVolume<sup>10+</sup>
...@@ -5591,10 +5594,11 @@ getUnderflowCount(callback: AsyncCallback&lt;number&gt;): void ...@@ -5591,10 +5594,11 @@ getUnderflowCount(callback: AsyncCallback&lt;number&gt;): void
```js ```js
audioRenderer.getUnderflowCount((err, underflowCount) => { audioRenderer.getUnderflowCount((err, underflowCount) => {
if(err){ if (err) {
console.error(`Get underflow count Fail: ${err}`); console.error(`getUnderflowCount Fail: ${err}`);
} else {
console.info(`getUnderflowCount Success! ${underflowCount}`);
} }
console.info(`Get underflow count Success! ${underflowCount}`);
}); });
``` ```
### getUnderflowCount<sup>10+</sup> ### getUnderflowCount<sup>10+</sup>
...@@ -5639,9 +5643,9 @@ getCurrentOutputDevices(callback: AsyncCallback&lt;AudioDeviceDescriptors&gt;): ...@@ -5639,9 +5643,9 @@ getCurrentOutputDevices(callback: AsyncCallback&lt;AudioDeviceDescriptors&gt;):
```js ```js
audioRenderer.getCurrentOutputDevices((err, deviceInfo) => { audioRenderer.getCurrentOutputDevices((err, deviceInfo) => {
if(err){ if (err) {
console.error(`Get underflow count Fail: ${err}`); console.error(`getCurrentOutputDevices Fail: ${err}`);
} } else {
console.info(`DeviceInfo id: ${deviceInfo.id}`); console.info(`DeviceInfo id: ${deviceInfo.id}`);
console.info(`DeviceInfo type: ${descriptor.deviceType}`); console.info(`DeviceInfo type: ${descriptor.deviceType}`);
console.info(`DeviceInfo role: ${descriptor.deviceRole}`); console.info(`DeviceInfo role: ${descriptor.deviceRole}`);
...@@ -5650,6 +5654,7 @@ audioRenderer.getCurrentOutputDevices((err, deviceInfo) => { ...@@ -5650,6 +5654,7 @@ audioRenderer.getCurrentOutputDevices((err, deviceInfo) => {
console.info(`DeviceInfo samplerates: ${descriptor.sampleRates[0]}`); console.info(`DeviceInfo samplerates: ${descriptor.sampleRates[0]}`);
console.info(`DeviceInfo channelcounts: ${descriptor.channelCounts[0]}`); console.info(`DeviceInfo channelcounts: ${descriptor.channelCounts[0]}`);
console.info(`DeviceInfo channelmask: ${descriptor.channelMasks}`); console.info(`DeviceInfo channelmask: ${descriptor.channelMasks}`);
}
}); });
``` ```
### getCurrentOutputDevices<sup>10+</sup> ### getCurrentOutputDevices<sup>10+</sup>
...@@ -5927,10 +5932,11 @@ on(type: 'outputDeviceChange', callback: Callback<AudioDeviceDescriptors\>): voi ...@@ -5927,10 +5932,11 @@ on(type: 'outputDeviceChange', callback: Callback<AudioDeviceDescriptors\>): voi
```js ```js
audioRenderer.on('outputDeviceChange', (deviceChangeInfo) => { audioRenderer.on('outputDeviceChange', (deviceChangeInfo) => {
if(err){ if (err) {
console.error(`Subscribes output device change event callback Fail: ${err}`); console.error(`Subscribes output device change event callback Fail: ${err}`);
} } else {
console.info(`Subscribes output device change event callback Success!`); console.info(`Subscribes output device change event callback Success!`);
}
}); });
``` ```
### off('outputDeviceChange') <sup>10+</sup> ### off('outputDeviceChange') <sup>10+</sup>
...@@ -5959,10 +5965,11 @@ off(type: 'outputDeviceChange', callback?: Callback<AudioDeviceDescriptors\>): v ...@@ -5959,10 +5965,11 @@ off(type: 'outputDeviceChange', callback?: Callback<AudioDeviceDescriptors\>): v
```js ```js
audioRenderer.off('outputDeviceChange', (deviceChangeInfo) => { audioRenderer.off('outputDeviceChange', (deviceChangeInfo) => {
if(err){ if (err) {
console.error(`Unsubscribes output device change event callback Fail: ${err}`); console.error(`Unsubscribes output device change event callback Fail: ${err}`);
} } else {
console.info(`Unsubscribes output device change event callback Success!`); console.info(`Unsubscribes output device change event callback Success!`);
}
}); });
``` ```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册