提交 83fcc63e 编写于 作者: Z zengyawen

update media english docs

Signed-off-by: Nzengyawen <zengyawen1@huawei.com>
上级 4acbb773
......@@ -63,6 +63,11 @@ You use audio playback APIs to convert audio data into audible analog signals, p
<td class="cellrowborder" valign="top" width="57.02%" headers="mcps1.2.3.1.2 "><p id="p1140814471274"><a name="p1140814471274"></a><a name="p1140814471274"></a>Stops playback.</p>
</td>
</tr>
<tr id="row93063645415"><td class="cellrowborder" valign="top" width="42.980000000000004%" headers="mcps1.2.3.1.1 "><p id="p230715618541"><a name="p230715618541"></a><a name="p230715618541"></a>reset()<sup id="sup15868135520538"><a name="sup15868135520538"></a><a name="sup15868135520538"></a>7+</sup></p>
</td>
<td class="cellrowborder" valign="top" width="57.02%" headers="mcps1.2.3.1.2 "><p id="p530714615545"><a name="p530714615545"></a><a name="p530714615545"></a>Resets the audio source to be played.</p>
</td>
</tr>
<tr id="row36221450105715"><td class="cellrowborder" valign="top" width="42.980000000000004%" headers="mcps1.2.3.1.1 "><p id="p162210506572"><a name="p162210506572"></a><a name="p162210506572"></a>setVolume(vol: number)</p>
</td>
<td class="cellrowborder" valign="top" width="57.02%" headers="mcps1.2.3.1.2 "><p id="p166221550165720"><a name="p166221550165720"></a><a name="p166221550165720"></a>Sets playback volume.</p>
......@@ -78,17 +83,12 @@ You use audio playback APIs to convert audio data into audible analog signals, p
<td class="cellrowborder" valign="top" width="57.02%" headers="mcps1.2.3.1.2 "><p id="p1040814782716"><a name="p1040814782716"></a><a name="p1040814782716"></a>Defines the URI of an audio file to play.</p>
</td>
</tr>
<tr id="row155026127182"><td class="cellrowborder" valign="top" width="42.980000000000004%" headers="mcps1.2.3.1.1 "><p id="p5503812121819"><a name="p5503812121819"></a><a name="p5503812121819"></a>state:string</p>
<tr id="row155026127182"><td class="cellrowborder" valign="top" width="42.980000000000004%" headers="mcps1.2.3.1.1 "><p id="p633012347"><a name="p633012347"></a><a name="p633012347"></a>state:AudioState</p>
</td>
<td class="cellrowborder" valign="top" width="57.02%" headers="mcps1.2.3.1.2 "><p id="p105031612141811"><a name="p105031612141811"></a><a name="p105031612141811"></a>Defines a playback state.</p>
</td>
</tr>
<tr id="row19408114732719"><td class="cellrowborder" valign="top" width="42.980000000000004%" headers="mcps1.2.3.1.1 "><p id="p12209729141817"><a name="p12209729141817"></a><a name="p12209729141817"></a>autoplay:boolean</p>
</td>
<td class="cellrowborder" valign="top" width="57.02%" headers="mcps1.2.3.1.2 "><p id="p19189929171811"><a name="p19189929171811"></a><a name="p19189929171811"></a>Defines whether playback starts automatically.</p>
</td>
</tr>
<tr id="row340854714273"><td class="cellrowborder" valign="top" width="42.980000000000004%" headers="mcps1.2.3.1.1 "><p id="p1840914712277"><a name="p1840914712277"></a><a name="p1840914712277"></a>currenttime:number</p>
<tr id="row340854714273"><td class="cellrowborder" valign="top" width="42.980000000000004%" headers="mcps1.2.3.1.1 "><p id="p16234263330"><a name="p16234263330"></a><a name="p16234263330"></a>currentTime:number</p>
</td>
<td class="cellrowborder" valign="top" width="57.02%" headers="mcps1.2.3.1.2 "><p id="p3409174762710"><a name="p3409174762710"></a><a name="p3409174762710"></a>Defines the current playback position.</p>
</td>
......@@ -103,11 +103,6 @@ You use audio playback APIs to convert audio data into audible analog signals, p
<td class="cellrowborder" valign="top" width="57.02%" headers="mcps1.2.3.1.2 "><p id="p94091847102711"><a name="p94091847102711"></a><a name="p94091847102711"></a>Defines whether to loop audio playback.</p>
</td>
</tr>
<tr id="row19915911171916"><td class="cellrowborder" valign="top" width="42.980000000000004%" headers="mcps1.2.3.1.1 "><p id="p20915111121918"><a name="p20915111121918"></a><a name="p20915111121918"></a>muted:boolean</p>
</td>
<td class="cellrowborder" valign="top" width="57.02%" headers="mcps1.2.3.1.2 "><p id="p12915211131910"><a name="p12915211131910"></a><a name="p12915211131910"></a>Defines whether to mute the audio.</p>
</td>
</tr>
<tr id="row44091647192718"><td class="cellrowborder" valign="top" width="42.980000000000004%" headers="mcps1.2.3.1.1 "><p id="p18937155862412"><a name="p18937155862412"></a><a name="p18937155862412"></a>on('play', function callback)</p>
</td>
<td class="cellrowborder" valign="top" width="57.02%" headers="mcps1.2.3.1.2 "><p id="p13409164722717"><a name="p13409164722717"></a><a name="p13409164722717"></a>Listens for the playback start event.</p>
......@@ -123,7 +118,12 @@ You use audio playback APIs to convert audio data into audible analog signals, p
<td class="cellrowborder" valign="top" width="57.02%" headers="mcps1.2.3.1.2 "><p id="p1409164772714"><a name="p1409164772714"></a><a name="p1409164772714"></a>Listens for the playback stop event.</p>
</td>
</tr>
<tr id="row11409747202711"><td class="cellrowborder" valign="top" width="42.980000000000004%" headers="mcps1.2.3.1.1 "><p id="p189901420102514"><a name="p189901420102514"></a><a name="p189901420102514"></a>on('ended',function callback)</p>
<tr id="row712184163016"><td class="cellrowborder" valign="top" width="42.980000000000004%" headers="mcps1.2.3.1.1 "><p id="p1167517115311"><a name="p1167517115311"></a><a name="p1167517115311"></a>on('reset', function callback)</p>
</td>
<td class="cellrowborder" valign="top" width="57.02%" headers="mcps1.2.3.1.2 "><p id="p1113134115301"><a name="p1113134115301"></a><a name="p1113134115301"></a>Listens for the playback reset event.</p>
</td>
</tr>
<tr id="row11409747202711"><td class="cellrowborder" valign="top" width="42.980000000000004%" headers="mcps1.2.3.1.1 "><p id="p189901420102514"><a name="p189901420102514"></a><a name="p189901420102514"></a>on('finish',function callback)</p>
</td>
<td class="cellrowborder" valign="top" width="57.02%" headers="mcps1.2.3.1.2 "><p id="p8410124742713"><a name="p8410124742713"></a><a name="p8410124742713"></a>Listens for the playback end event.</p>
</td>
......@@ -133,7 +133,7 @@ You use audio playback APIs to convert audio data into audible analog signals, p
<td class="cellrowborder" valign="top" width="57.02%" headers="mcps1.2.3.1.2 "><p id="p54101047102712"><a name="p54101047102712"></a><a name="p54101047102712"></a>Listens for the playback error event.</p>
</td>
</tr>
<tr id="row1410154715273"><td class="cellrowborder" valign="top" width="42.980000000000004%" headers="mcps1.2.3.1.1 "><p id="p135217361257"><a name="p135217361257"></a><a name="p135217361257"></a>on('loaderdata', function callback)</p>
<tr id="row1410154715273"><td class="cellrowborder" valign="top" width="42.980000000000004%" headers="mcps1.2.3.1.1 "><p id="p135217361257"><a name="p135217361257"></a><a name="p135217361257"></a>on('dataload', function callback)</p>
</td>
<td class="cellrowborder" valign="top" width="57.02%" headers="mcps1.2.3.1.2 "><p id="p1541054719271"><a name="p1541054719271"></a><a name="p1541054719271"></a>Listens for the data loading event.</p>
</td>
......@@ -143,7 +143,7 @@ You use audio playback APIs to convert audio data into audible analog signals, p
<td class="cellrowborder" valign="top" width="57.02%" headers="mcps1.2.3.1.2 "><p id="p116527483584"><a name="p116527483584"></a><a name="p116527483584"></a>Listens for the volume change event.</p>
</td>
</tr>
<tr id="row1410124732711"><td class="cellrowborder" valign="top" width="42.980000000000004%" headers="mcps1.2.3.1.1 "><p id="p942310426254"><a name="p942310426254"></a><a name="p942310426254"></a>on('timeupdate', function callback)</p>
<tr id="row1410124732711"><td class="cellrowborder" valign="top" width="42.980000000000004%" headers="mcps1.2.3.1.1 "><p id="p942310426254"><a name="p942310426254"></a><a name="p942310426254"></a>on('timeUpdate', function callback)</p>
</td>
<td class="cellrowborder" valign="top" width="57.02%" headers="mcps1.2.3.1.2 "><p id="p18410144715271"><a name="p18410144715271"></a><a name="p18410144715271"></a>Listens for the progress change event.</p>
</td>
......@@ -162,73 +162,70 @@ You use audio playback APIs to convert audio data into audible analog signals, p
```
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, current 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}`);
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 success, new time : '+newTime);
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. Start playback.
......@@ -237,7 +234,6 @@ You use audio playback APIs to convert audio data into audible analog signals, p
var audioSourceMp3 = 'file://test.mp3';
player.src = audioSourceMp3;
player.loop = true;
player.play();
```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册