未验证 提交 296f3059 编写于 作者: Z zengyawen 提交者: Gitee

update zh-cn/application-dev/reference/apis/js-apis-media.md.

Signed-off-by: Nzengyawen <zengyawen1@huawei.com>
上级 76cdc343
......@@ -60,7 +60,7 @@ createVideoPlayer(callback: AsyncCallback\<[VideoPlayer](#videoplayer8)>): void
let videoPlayer
media.createVideoPlayer((error, video) => {
if (typeof(video) != 'undefined') {
if (video != null) {
videoPlayer = video;
console.info('video createVideoPlayer success');
} else {
......@@ -89,7 +89,7 @@ createVideoPlayer(): Promise<[VideoPlayer](#videoplayer8)>
let videoPlayer
media.createVideoPlayer().then((video) => {
if (typeof(video) != 'undefined') {
if (video != null) {
videoPlayer = video;
console.info('video createVideoPlayer success');
} else {
......@@ -142,7 +142,7 @@ createVideoRecorder(callback: AsyncCallback\<[VideoRecorder](#videorecorder9)>):
let videoRecorder
media.createVideoRecorder((error, video) => {
if (typeof(video) != 'undefined') {
if (video != null) {
videoRecorder = video;
console.info('video createVideoRecorder success');
} else {
......@@ -172,7 +172,7 @@ createVideoRecorder(): Promise<[VideoRecorder](#videorecorder9)>
let videoRecorder
media.createVideoRecorder().then((video) => {
if (typeof(video) != 'undefined') {
if (video != null) {
videoRecorder = video;
console.info('video createVideoRecorder success');
} else {
......@@ -369,7 +369,7 @@ seek(timeMs: number): void
```js
audioPlayer.on('timeUpdate', (seekDoneTime) => { //设置'timeUpdate'事件回调
if (typeof (seekDoneTime) == 'undefined') {
if (seekDoneTime == null) {
console.info('audio seek fail');
return;
}
......@@ -442,7 +442,7 @@ function printfDescription(obj) {
}
audioPlayer.getTrackDescription((error, arrlist) => {
if (typeof (arrlist) != 'undefined') {
if (arrlist != null) {
for (let i = 0; i < arrlist.length; i++) {
printfDescription(arrlist[i]);
}
......@@ -478,7 +478,7 @@ function printfDescription(obj) {
}
audioPlayer.getTrackDescription().then((arrlist) => {
if (typeof (arrlist) != 'undefined') {
if (arrlist != null) {
arrayDescription = arrlist;
} else {
console.log('audio getTrackDescription fail');
......@@ -553,7 +553,7 @@ audioPlayer.on('reset', () => { //设置'reset'事件回调
audioPlayer = undefined;
});
audioPlayer.on('timeUpdate', (seekDoneTime) => { //设置'timeUpdate'事件回调
if (typeof(seekDoneTime) == "undefined") {
if (seekDoneTime == null) {
console.info('audio seek fail');
return;
}
......@@ -608,7 +608,7 @@ on(type: 'timeUpdate', callback: Callback\<number>): void
```js
audioPlayer.on('timeUpdate', (seekDoneTime) => { //设置'timeUpdate'事件回调
if (typeof (seekDoneTime) == 'undefined') {
if (seekDoneTime == null) {
console.info('audio seek fail');
return;
}
......@@ -726,7 +726,7 @@ setDisplaySurface(surfaceId: string, callback: AsyncCallback\<void>): void
```js
videoPlayer.setDisplaySurface(surfaceId, (err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('setDisplaySurface success!');
} else {
console.info('setDisplaySurface fail!');
......@@ -784,7 +784,7 @@ prepare(callback: AsyncCallback\<void>): void
```js
videoPlayer.prepare((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('prepare success!');
} else {
console.info('prepare fail!');
......@@ -834,7 +834,7 @@ play(callback: AsyncCallback\<void>): void;
```js
videoPlayer.play((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('play success!');
} else {
console.info('play fail!');
......@@ -884,7 +884,7 @@ pause(callback: AsyncCallback\<void>): void
```js
videoPlayer.pause((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('pause success!');
} else {
console.info('pause fail!');
......@@ -934,7 +934,7 @@ stop(callback: AsyncCallback\<void>): void
```js
videoPlayer.stop((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('stop success!');
} else {
console.info('stop fail!');
......@@ -984,7 +984,7 @@ reset(callback: AsyncCallback\<void>): void
```js
videoPlayer.reset((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('reset success!');
} else {
console.info('reset fail!');
......@@ -1036,7 +1036,7 @@ seek(timeMs: number, callback: AsyncCallback\<number>): void
```js
let seekTime = 5000;
videoPlayer.seek(seekTime, (err, result) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('seek success!');
} else {
console.info('seek fail!');
......@@ -1067,7 +1067,7 @@ import media from '@ohos.multimedia.media'
let seekTime = 5000;
let seekMode = media.SeekMode.SEEK_NEXT_SYNC;
videoPlayer.seek(seekTime, seekMode, (err, result) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('seek success!');
} else {
console.info('seek fail!');
......@@ -1133,7 +1133,7 @@ setVolume(vol: number, callback: AsyncCallback\<void>): void
```js
let vol = 0.5;
videoPlayer.setVolume(vol, (err, result) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('setVolume success!');
} else {
console.info('setVolume fail!');
......@@ -1190,7 +1190,7 @@ release(callback: AsyncCallback\<void>): void
```js
videoPlayer.release((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('release success!');
} else {
console.info('release fail!');
......@@ -1248,7 +1248,7 @@ function printfDescription(obj) {
}
videoPlayer.getTrackDescription((error, arrlist) => {
if (typeof (arrlist) != 'undefined') {
if (arrlist) != null) {
for (let i = 0; i < arrlist.length; i++) {
printfDescription(arrlist[i]);
}
......@@ -1285,7 +1285,7 @@ function printfDescription(obj) {
let arrayDescription;
videoPlayer.getTrackDescription().then((arrlist) => {
if (typeof (arrlist) != 'undefined') {
if (arrlist != null) {
arrayDescription = arrlist;
} else {
console.log('video getTrackDescription fail');
......@@ -1320,7 +1320,7 @@ import media from '@ohos.multimedia.media'
let speed = media.PlaybackSpeed.SPEED_FORWARD_2_00_X;
videoPlayer.setSpeed(speed, (err, result) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('setSpeed success!');
} else {
console.info('setSpeed fail!');
......@@ -1381,7 +1381,7 @@ selectBitrate(bitrate:number, callback: AsyncCallback\<number>): void
```js
let bitrate = 1024000;
videoPlayer.selectBitrate(bitrate, (err, result) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('selectBitrate success!');
} else {
console.info('selectBitrate fail!');
......@@ -1639,7 +1639,7 @@ function printfItemDescription(obj, key) {
}
audioPlayer.getTrackDescription((error, arrlist) => {
if (typeof (arrlist) != 'undefined') {
if (arrlist != null) {
for (let i = 0; i < arrlist.length; i++) {
printfItemDescription(arrlist[i], MD_KEY_TRACK_TYPE); //打印出每条轨道MD_KEY_TRACK_TYPE的值
}
......@@ -1995,7 +1995,7 @@ let eventEmitter = new events.EventEmitter();
eventEmitter.on('prepare', () => {
videoRecorder.prepare(videoConfig, (err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('prepare success');
} else {
console.info('prepare failed and error is ' + err.message);
......@@ -2004,7 +2004,7 @@ eventEmitter.on('prepare', () => {
});
media.createVideoRecorder((err, recorder) => {
if (typeof (err) == 'undefined' && typeof (recorder) != 'undefined') {
if (err == null && recorder) != null) {
videoRecorder = recorder;
console.info('createVideoRecorder success');
eventEmitter.emit('prepare'); // prepare事件触发
......@@ -2064,7 +2064,7 @@ let videoConfig = {
// promise
let videoRecorder = null;
media.createVideoRecorder().then((recorder) => {
if (typeof (recorder) != 'undefined') {
if (recorder != null) {
videoRecorder = recorder;
console.info('createVideoRecorder success');
} else {
......@@ -2105,7 +2105,7 @@ getInputSurface(callback: AsyncCallback\<string>): void;
// asyncallback
let surfaceID = null; // 传递给外界的surfaceID
videoRecorder.getInputSurface((err, surfaceId) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('getInputSurface success');
surfaceID = surfaceId;
} else {
......@@ -2166,7 +2166,7 @@ start(callback: AsyncCallback\<void>): void;
```js
// asyncallback
videoRecorder.start((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('start videorecorder success');
} else {
console.info('start videorecorder failed and error is ' + err.message);
......@@ -2222,7 +2222,7 @@ pause(callback: AsyncCallback\<void>): void;
```js
// asyncallback
videoRecorder.pause((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('pause videorecorder success');
} else {
console.info('pause videorecorder failed and error is ' + err.message);
......@@ -2276,7 +2276,7 @@ resume(callback: AsyncCallback\<void>): void;
```js
// asyncallback
videoRecorder.resume((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('resume videorecorder success');
} else {
console.info('resume videorecorder failed and error is ' + err.message);
......@@ -2330,7 +2330,7 @@ stop(callback: AsyncCallback\<void>): void;
```js
// asyncallback
videoRecorder.stop((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('stop videorecorder success');
} else {
console.info('stop videorecorder failed and error is ' + err.message);
......@@ -2384,7 +2384,7 @@ release(callback: AsyncCallback\<void>): void;
```js
// asyncallback
videoRecorder.release((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('release videorecorder success');
} else {
console.info('release videorecorder failed and error is ' + err.message);
......@@ -2438,7 +2438,7 @@ reset(callback: AsyncCallback\<void>): void;
```js
// asyncallback
videoRecorder.reset((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('reset videorecorder success');
} else {
console.info('reset videorecorder failed and error is ' + err.message);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册