名称
|
-描述
+ | 描述
|
-设备属性队列
+ |
设备属性数组
|
-AudioDeviceDescriptor的队列,只读。
+ | AudioDeviceDescriptor的数组,只读。
|
diff --git "a/zh-cn/application-dev/media/figures/\351\237\263\351\242\221\346\222\255\346\224\276\347\212\266\346\200\201\346\234\272.png" "b/zh-cn/application-dev/media/figures/\351\237\263\351\242\221\346\222\255\346\224\276\347\212\266\346\200\201\346\234\272.png"
index 2bd16cf5945b3347a2bebdb8f78e2e5fcab992f8..e0777e28838f6d2455233f2068339f8548f50c67 100755
Binary files "a/zh-cn/application-dev/media/figures/\351\237\263\351\242\221\346\222\255\346\224\276\347\212\266\346\200\201\346\234\272.png" and "b/zh-cn/application-dev/media/figures/\351\237\263\351\242\221\346\222\255\346\224\276\347\212\266\346\200\201\346\234\272.png" differ
diff --git "a/zh-cn/application-dev/media/\351\237\263\351\242\221\346\222\255\346\224\276\345\274\200\345\217\221\346\214\207\345\257\274.md" "b/zh-cn/application-dev/media/\351\237\263\351\242\221\346\222\255\346\224\276\345\274\200\345\217\221\346\214\207\345\257\274.md"
index 67e223951882bfcdad4219a76577cdf9226ac0c2..4bf8fc7269c5664de3c93c1c390245de98db2d93 100755
--- "a/zh-cn/application-dev/media/\351\237\263\351\242\221\346\222\255\346\224\276\345\274\200\345\217\221\346\214\207\345\257\274.md"
+++ "b/zh-cn/application-dev/media/\351\237\263\351\242\221\346\222\255\346\224\276\345\274\200\345\217\221\346\214\207\345\257\274.md"
@@ -63,6 +63,11 @@
停止播放。
|
+reset()7+
+ |
+重置播放音频源。
+ |
+
setVolume(vol: number)
|
改变音频播放音量
@@ -78,17 +83,12 @@
| 音频播放的媒体URI。
|
-state:string
+ |
state:AudioState
|
播放的状态属性。
|
-autoplay:boolean
- |
-音频的自动播放属性。
- |
-
-currenttime:number
+ |
currentTime:number
|
音频的当前播放位置。
|
@@ -103,11 +103,6 @@
音频的循环播放属性。
|
-muted:boolean
- |
-音频的静音属性。
- |
-
on('play', function callback)
|
监听音频播放开始事件。
@@ -123,7 +118,12 @@
| 监听音频播放停止事件。
|
-on('ended',function callback)
+ |
on('reset', function callback)
+ |
+监听音频播放重置事件。
+ |
+
+on('finish',function callback)
|
监听音频播放结束事件。
|
@@ -133,7 +133,7 @@
监听音频播放错误事件。
|
-on('loaderdata', function callback)
+ |
on('dataload', function callback)
|
监听音频播放加载数据事件。
|
@@ -143,7 +143,7 @@
监听音频播放音量变化事件。
|
-on('timeupdate', function callback)
+ |
on('timeUpdate', function callback)
|
监听音频播放进度改变事件。
|
@@ -162,73 +162,70 @@
```
player.on('play', (err, action) => {
if (err) {
- console.log(`err returned in play() callback`);
+ console.error('Error returned in the play() callback.');
return;
}
- console.info('Current Song duration: '+duration);
- console.log(`In play callback current time: ${player.currentTime}`);
- console.info('Current Player Status: '+player.state);
- console.info('Pause Mp3');
+ console.info('Current player duration: '+ player.duration);
+ console.info('Current player time: ' + player.currentTime);
+ console.info('Current player status: '+player.state);
+ console.info('Pause MP3');
player.pause();
});
player.on('pause', (err, action) => {
if (err) {
- console.log(`err returned in pause() callback`);
+ console.error('Error returned in the pause() callback.');
return;
}
- console.log(`pause callback, state: ${player.state}`);
- console.info('Current Player Status: '+player.state);
- var currentTime = player.currenTime;
- console.info('Current Player Time: '+currentTime);
- player.seek(30000); //seek for 30 seconds
+ console.info('Current player status: ' + player.state);
+ console.info('Current player time: ' + player.currentTime);
+ player.seek(30000); // Seek for 30 seconds.
});
player.on('stop', (err, action) => {
if (err) {
- console.log(`err returned in stop() callback`);
+ console.error('Error returned in the stop() callback.');
return;
}
- console.log(`stop callback, state: ${player.state}`);
+ console.info('stop callback invoked. State:' + player.state);
+ player.reset();
});
player.on('dataLoad', (err, action) => {
if (err) {
- console.log(`err returned in dataLoad() callback`);
+ console.error('Error returned in the dataLoad() callback.');
return;
}
- console.log(`dataLoad callback is called, cuurent time: ${player.currentTime}`);
- console.log(`Duration of the source: ${player.duration}`);
+ console.info('dataLoad callback invoked. Current time: ' + player.currentTime);
+ console.info('Duration of the source:' + player.duration);
+ player.play();
+ });
+ player.on('reset', (err, action) => {
+ if (err) {
+ console.error('Error returned in the reset() callback.');
+ return;
+ }
+ console.info('reset callback invoked.');
+ player.release();
});
player.on('finish', (err, action) => {
if (err) {
- console.log(`err returned in finish() callback`);
+ console.error('Error returned in the finish() callback.');
return;
}
- console.log(`Player finish callback is called`);
+ console.info('finish callback invoked.');
});
- player.on('timeUpdate', (err, action) => {
- if (err) {
- console.log(`err returned in timeUpdate() callback`);
- return;
- }
- console.log(`In timeupdate callback current time: ${player.currentTime}`);
- var newTime = player.currenTime;
- if(newTime = 30000) {
- console.info('Seek success, new time : '+newTime);
+ player.on('timeUpdate', (seekTime, action) => {
+ console.info('Seek time: ' + seekTime);
+ console.info('Current player time: ' + player.currentTime);
+ var newTime = player.currentTime;
+ if(newTime == 30000) {
+ console.info('Seek succeeded. New time: ' + newTime);
} else {
- console.info('Seek Failed');
+ console.error('Seek failed: ', + newTime);
}
player.stop();
});
- player.on('durationchange', (err, action) => {
- if (err) {
- console.log(`err returned in durationchange callback`);
- return;
- }
- console.log(`Durationchange callback is called`);
- });
player.on('error', (err) => {
- console.error(`player error: ${err.message}`);
+ console.error('Player error: ${err.message}');
});
-
```
3. 启动播放。
@@ -237,7 +234,6 @@
var audioSourceMp3 = 'file://test.mp3';
player.src = audioSourceMp3;
player.loop = true;
- player.play();
```