提交 9069f3c4 编写于 作者: B bmeangel

update docs

Signed-off-by: Nbmeangel <wangjiangying@huawei.com>
上级 5b1b3b32
...@@ -64,7 +64,7 @@ media.createVideoPlayer((error, video) => { ...@@ -64,7 +64,7 @@ media.createVideoPlayer((error, video) => {
videoPlayer = video; videoPlayer = video;
console.info('video createVideoPlayer success'); console.info('video createVideoPlayer success');
} else { } else {
console.info(`video createVideoPlayer fail, error:${error.message}`); console.info(`video createVideoPlayer fail, error:${error}`);
} }
}); });
``` ```
...@@ -96,7 +96,7 @@ media.createVideoPlayer().then((video) => { ...@@ -96,7 +96,7 @@ media.createVideoPlayer().then((video) => {
console.info('video createVideoPlayer fail'); console.info('video createVideoPlayer fail');
} }
}).catch((error) => { }).catch((error) => {
console.info(`video catchCallback, error:${error.message}`); console.info(`video catchCallback, error:${error}`);
}); });
``` ```
...@@ -146,7 +146,7 @@ media.createVideoRecorder((error, video) => { ...@@ -146,7 +146,7 @@ media.createVideoRecorder((error, video) => {
videoRecorder = video; videoRecorder = video;
console.info('video createVideoRecorder success'); console.info('video createVideoRecorder success');
} else { } else {
console.info(`video createVideoRecorder fail, error:${error.message}`); console.info(`video createVideoRecorder fail, error:${error}`);
} }
}); });
``` ```
...@@ -179,7 +179,7 @@ media.createVideoRecorder().then((video) => { ...@@ -179,7 +179,7 @@ media.createVideoRecorder().then((video) => {
console.info('video createVideoRecorder fail'); console.info('video createVideoRecorder fail');
} }
}).catch((error) => { }).catch((error) => {
console.info(`video catchCallback, error:${error.message}`); console.info(`video catchCallback, error:${error}`);
}); });
``` ```
...@@ -447,7 +447,7 @@ audioPlayer.getTrackDescription((error, arrlist) => { ...@@ -447,7 +447,7 @@ audioPlayer.getTrackDescription((error, arrlist) => {
printfDescription(arrlist[i]); printfDescription(arrlist[i]);
} }
} else { } else {
console.log(`audio getTrackDescription fail, error:${error.message}`); console.log(`audio getTrackDescription fail, error:${error}`);
} }
}); });
``` ```
...@@ -484,7 +484,7 @@ audioPlayer.getTrackDescription().then((arrlist) => { ...@@ -484,7 +484,7 @@ audioPlayer.getTrackDescription().then((arrlist) => {
console.log('audio getTrackDescription fail'); console.log('audio getTrackDescription fail');
} }
}).catch((error) => { }).catch((error) => {
console.info(`audio catchCallback, error:${error.message}`); console.info(`audio catchCallback, error:${error}`);
}); });
for (let i = 0; i < arrayDescription.length; i++) { for (let i = 0; i < arrayDescription.length; i++) {
...@@ -569,9 +569,7 @@ audioPlayer.on('finish', () => { //设置'finish'事件回调 ...@@ -569,9 +569,7 @@ audioPlayer.on('finish', () => { //设置'finish'事件回调
audioPlayer.stop(); //停止播放,并触发'stop'事件回调 audioPlayer.stop(); //停止播放,并触发'stop'事件回调
}); });
audioPlayer.on('error', (error) => { //设置'error'事件回调 audioPlayer.on('error', (error) => { //设置'error'事件回调
console.info(`audio error called, errName is ${error.name}`); console.info(`audio error called, error: ${error}`);
console.info(`audio error called, errCode is ${error.code}`);
console.info(`audio error called, errMessage is ${error.message}`);
}); });
// 用户选择视频设置fd(本地播放) // 用户选择视频设置fd(本地播放)
...@@ -636,9 +634,7 @@ on(type: 'error', callback: ErrorCallback): void ...@@ -636,9 +634,7 @@ on(type: 'error', callback: ErrorCallback): void
```js ```js
audioPlayer.on('error', (error) => { //设置'error'事件回调 audioPlayer.on('error', (error) => { //设置'error'事件回调
console.info(`audio error called, errName is ${error.name}`); //打印错误类型名称 console.info(`audio error called, error: ${error}`);
console.info(`audio error called, errCode is ${error.code}`); //打印错误码
console.info(`audio error called, errMessage is ${error.message}`);//打印错误类型详细描述
}); });
audioPlayer.setVolume(3); //设置volume为无效值,触发'error'事件 audioPlayer.setVolume(3); //设置volume为无效值,触发'error'事件
``` ```
...@@ -762,7 +758,7 @@ setDisplaySurface(surfaceId: string): Promise\<void> ...@@ -762,7 +758,7 @@ setDisplaySurface(surfaceId: string): Promise\<void>
videoPlayer.setDisplaySurface(surfaceId).then(() => { videoPlayer.setDisplaySurface(surfaceId).then(() => {
console.info('setDisplaySurface success'); console.info('setDisplaySurface success');
}).catch((error) => { }).catch((error) => {
console.info(`video catchCallback, error:${error.message}`); console.info(`video catchCallback, error:${error}`);
}); });
``` ```
...@@ -812,7 +808,7 @@ prepare(): Promise\<void> ...@@ -812,7 +808,7 @@ prepare(): Promise\<void>
videoPlayer.prepare().then(() => { videoPlayer.prepare().then(() => {
console.info('prepare success'); console.info('prepare success');
}).catch((error) => { }).catch((error) => {
console.info(`video catchCallback, error:${error.message}`); console.info(`video catchCallback, error:${error}`);
}); });
``` ```
...@@ -862,7 +858,7 @@ play(): Promise\<void>; ...@@ -862,7 +858,7 @@ play(): Promise\<void>;
videoPlayer.play().then(() => { videoPlayer.play().then(() => {
console.info('play success'); console.info('play success');
}).catch((error) => { }).catch((error) => {
console.info(`video catchCallback, error:${error.message}`); console.info(`video catchCallback, error:${error}`);
}); });
``` ```
...@@ -912,7 +908,7 @@ pause(): Promise\<void> ...@@ -912,7 +908,7 @@ pause(): Promise\<void>
videoPlayer.pause().then(() => { videoPlayer.pause().then(() => {
console.info('pause success'); console.info('pause success');
}).catch((error) => { }).catch((error) => {
console.info(`video catchCallback, error:${error.message}`); console.info(`video catchCallback, error:${error}`);
}); });
``` ```
...@@ -962,7 +958,7 @@ stop(): Promise\<void> ...@@ -962,7 +958,7 @@ stop(): Promise\<void>
videoPlayer.stop().then(() => { videoPlayer.stop().then(() => {
console.info('stop success'); console.info('stop success');
}).catch((error) => { }).catch((error) => {
console.info(`video catchCallback, error:${error.message}`); console.info(`video catchCallback, error:${error}`);
}); });
``` ```
...@@ -1012,7 +1008,7 @@ reset(): Promise\<void> ...@@ -1012,7 +1008,7 @@ reset(): Promise\<void>
videoPlayer.reset().then(() => { videoPlayer.reset().then(() => {
console.info('reset success'); console.info('reset success');
}).catch((error) => { }).catch((error) => {
console.info(`video catchCallback, error:${error.message}`); console.info(`video catchCallback, error:${error}`);
}); });
``` ```
...@@ -1103,13 +1099,13 @@ let seekTime = 5000; ...@@ -1103,13 +1099,13 @@ let seekTime = 5000;
videoPlayer.seek(seekTime).then((seekDoneTime) => { // seekDoneTime表示seek完成后的时间点 videoPlayer.seek(seekTime).then((seekDoneTime) => { // seekDoneTime表示seek完成后的时间点
console.info('seek success'); console.info('seek success');
}).catch((error) => { }).catch((error) => {
console.info(`video catchCallback, error:${error.message}`); console.info(`video catchCallback, error:${error}`);
}); });
videoPlayer.seek(seekTime, seekMode).then((seekDoneTime) => { videoPlayer.seek(seekTime, seekMode).then((seekDoneTime) => {
console.info('seek success'); console.info('seek success');
}).catch((error) => { }).catch((error) => {
console.info(`video catchCallback, error:${error.message}`); console.info(`video catchCallback, error:${error}`);
}); });
``` ```
...@@ -1168,7 +1164,7 @@ let vol = 0.5; ...@@ -1168,7 +1164,7 @@ let vol = 0.5;
videoPlayer.setVolume(vol).then() => { videoPlayer.setVolume(vol).then() => {
console.info('setVolume success'); console.info('setVolume success');
}).catch((error) => { }).catch((error) => {
console.info(`video catchCallback, error:${error.message}`); console.info(`video catchCallback, error:${error}`);
}); });
``` ```
...@@ -1218,7 +1214,7 @@ release(): Promise\<void> ...@@ -1218,7 +1214,7 @@ release(): Promise\<void>
videoPlayer.release().then() => { videoPlayer.release().then() => {
console.info('release success'); console.info('release success');
}).catch((error) => { }).catch((error) => {
console.info(`video catchCallback, error:${error.message}`); console.info(`video catchCallback, error:${error}`);
}); });
``` ```
...@@ -1253,7 +1249,7 @@ videoPlayer.getTrackDescription((error, arrlist) => { ...@@ -1253,7 +1249,7 @@ videoPlayer.getTrackDescription((error, arrlist) => {
printfDescription(arrlist[i]); printfDescription(arrlist[i]);
} }
} else { } else {
console.log(`video getTrackDescription fail, error:${error.message}`); console.log(`video getTrackDescription fail, error:${error}`);
} }
}); });
``` ```
...@@ -1291,7 +1287,7 @@ videoPlayer.getTrackDescription().then((arrlist) => { ...@@ -1291,7 +1287,7 @@ videoPlayer.getTrackDescription().then((arrlist) => {
console.log('video getTrackDescription fail'); console.log('video getTrackDescription fail');
} }
}).catch((error) => { }).catch((error) => {
console.info(`video catchCallback, error:${error.message}`); console.info(`video catchCallback, error:${error}`);
}); });
for (let i = 0; i < arrayDescription.length; i++) { for (let i = 0; i < arrayDescription.length; i++) {
printfDescription(arrayDescription[i]); printfDescription(arrayDescription[i]);
...@@ -1357,7 +1353,7 @@ let speed = media.PlaybackSpeed.SPEED_FORWARD_2_00_X; ...@@ -1357,7 +1353,7 @@ let speed = media.PlaybackSpeed.SPEED_FORWARD_2_00_X;
videoPlayer.setSpeed(speed).then() => { videoPlayer.setSpeed(speed).then() => {
console.info('setSpeed success'); console.info('setSpeed success');
}).catch((error) => { }).catch((error) => {
console.info(`video catchCallback, error:${error.message}`); console.info(`video catchCallback, error:${error}`);
}); });
``` ```
...@@ -1416,7 +1412,7 @@ let bitrate = 1024000; ...@@ -1416,7 +1412,7 @@ let bitrate = 1024000;
videoPlayer.selectBitrate(bitrate).then() => { videoPlayer.selectBitrate(bitrate).then() => {
console.info('selectBitrate success'); console.info('selectBitrate success');
}).catch((error) => { }).catch((error) => {
console.info(`video catchCallback, error:${error.message}`); console.info(`video catchCallback, error:${error}`);
}); });
``` ```
...@@ -1533,9 +1529,7 @@ on(type: 'error', callback: ErrorCallback): void ...@@ -1533,9 +1529,7 @@ on(type: 'error', callback: ErrorCallback): void
```js ```js
videoPlayer.on('error', (error) => { // 设置'error'事件回调 videoPlayer.on('error', (error) => { // 设置'error'事件回调
console.info(`video error called, errName is ${error.name}`); // 打印错误类型名称 console.info(`video error called, error: ${error}`);
console.info(`video error called, errCode is ${error.code}`); // 打印错误码
console.info(`video error called, errMessage is ${error.message}`);// 打印错误类型详细描述
}); });
videoPlayer.url = 'fd://error'; //设置错误的播放地址,触发'error'事件 videoPlayer.url = 'fd://error'; //设置错误的播放地址,触发'error'事件
``` ```
...@@ -1644,7 +1638,7 @@ audioPlayer.getTrackDescription((error, arrlist) => { ...@@ -1644,7 +1638,7 @@ audioPlayer.getTrackDescription((error, arrlist) => {
printfItemDescription(arrlist[i], MD_KEY_TRACK_TYPE); //打印出每条轨道MD_KEY_TRACK_TYPE的值 printfItemDescription(arrlist[i], MD_KEY_TRACK_TYPE); //打印出每条轨道MD_KEY_TRACK_TYPE的值
} }
} else { } else {
console.log(`audio getTrackDescription fail, error:${error.message}`); console.log(`audio getTrackDescription fail, error:${error}`);
} }
}); });
``` ```
...@@ -1824,9 +1818,7 @@ let audioRecorderConfig = { ...@@ -1824,9 +1818,7 @@ let audioRecorderConfig = {
location : { latitude : 30, longitude : 130}, location : { latitude : 30, longitude : 130},
} }
audioRecorder.on('error', (error) => { // 设置'error'事件回调 audioRecorder.on('error', (error) => { // 设置'error'事件回调
console.info(`audio error called, errName is ${error.name}`); console.info(`audio error called, error: ${error}`);
console.info(`audio error called, errCode is ${error.code}`);
console.info(`audio error called, errMessage is ${error.message}`);
}); });
audioRecorder.on('prepare', () => { // 设置'prepare'事件回调 audioRecorder.on('prepare', () => { // 设置'prepare'事件回调
console.log('prepare success'); console.log('prepare success');
...@@ -1872,9 +1864,7 @@ on(type: 'error', callback: ErrorCallback): void ...@@ -1872,9 +1864,7 @@ on(type: 'error', callback: ErrorCallback): void
```js ```js
audioRecorder.on('error', (error) => { // 设置'error'事件回调 audioRecorder.on('error', (error) => { // 设置'error'事件回调
console.info(`audio error called, errName is ${error.name}`); // 打印错误类型名称 console.info(`audio error called, error: ${error}`);
console.info(`audio error called, errCode is ${error.code}`); // 打印错误码
console.info(`audio error called, errMessage is ${error.message}`); // 打印错误类型详细描述
}); });
audioRecorder.prepare(); // prepare不设置参数,触发'error'事件 audioRecorder.prepare(); // prepare不设置参数,触发'error'事件
``` ```
...@@ -2492,10 +2482,7 @@ on(type: 'error', callback: ErrorCallback): void ...@@ -2492,10 +2482,7 @@ on(type: 'error', callback: ErrorCallback): void
```js ```js
videoRecorder.on('error', (error) => { // 设置'error'事件回调 videoRecorder.on('error', (error) => { // 设置'error'事件回调
console.info(`audio error called, errName is ${error.name}`); // 打印错误类型名称 console.info(`audio error called, error: ${error}`);
console.info(`audio error called, errCode is ${error.code}`); // 打印错误码
console.info(`audio error called, errMessage is ${error.message}`); // 打印错误类型详细描述
});
// 当获取videoRecordState接口出错时通过此订阅事件上报 // 当获取videoRecordState接口出错时通过此订阅事件上报
``` ```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册