未验证 提交 244a7a48 编写于 作者: O openharmony_ci 提交者: Gitee

!8490 翻译完成:8465 【轻量级 PR】:update zh-cn/application-dev/reference/apis/js-apis-media.md.

Merge pull request !8490 from wusongqing/TR8465
......@@ -60,7 +60,7 @@ Creates a **VideoPlayer** instance in asynchronous mode. This API uses a callbac
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 @@ Creates a **VideoPlayer** instance in asynchronous mode. This API uses a promise
let videoPlayer
media.createVideoPlayer().then((video) => {
if (typeof(video) != 'undefined') {
if (video != null) {
videoPlayer = video;
console.info('video createVideoPlayer success');
} else {
......@@ -307,7 +307,7 @@ Seeks to the specified playback position.
```js
audioPlayer.on('timeUpdate', (seekDoneTime) => { // Set the 'timeUpdate' event callback.
if (typeof (seekDoneTime) == 'undefined') {
if (seekDoneTime == null) {
console.info('audio seek fail');
return;
}
......@@ -380,7 +380,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]);
}
......@@ -416,7 +416,7 @@ function printfDescription(obj) {
}
audioPlayer.getTrackDescription().then((arrlist) => {
if (typeof (arrlist) != 'undefined') {
if (arrlist != null) {
arrayDescription = arrlist;
} else {
console.log('audio getTrackDescription fail');
......@@ -491,7 +491,7 @@ audioPlayer.on('reset', () => { // Set the 'reset' event callback.
audioPlayer = undefined;
});
audioPlayer.on('timeUpdate', (seekDoneTime) => { // Set the 'timeUpdate' event callback.
if (typeof(seekDoneTime) == "undefined") {
if (seekDoneTime == null) {
console.info('audio seek fail');
return;
}
......@@ -546,7 +546,7 @@ Subscribes to the 'timeUpdate' event.
```js
audioPlayer.on('timeUpdate', (seekDoneTime) => { // Set the 'timeUpdate' event callback.
if (typeof (seekDoneTime) == 'undefined') {
if (seekDoneTime == null) {
console.info('audio seek fail');
return;
}
......@@ -595,7 +595,6 @@ Enumerates the audio playback states. You can obtain the state through the **sta
| stopped | string | Audio playback is stopped. |
| error<sup>8+</sup> | string | Audio playback is in the error state. |
## VideoPlayer<sup>8+</sup>
Provides APIs to manage and play video. Before calling an API of **VideoPlayer**, you must call [createVideoPlayer()](#mediacreatevideoplayer8) to create a [VideoPlayer](#videoplayer8) instance.
......@@ -635,7 +634,7 @@ Sets **SurfaceId**. This API uses a callback to return the result.
```js
videoPlayer.setDisplaySurface(surfaceId, (err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('setDisplaySurface success!');
} else {
console.info('setDisplaySurface fail!');
......@@ -691,7 +690,7 @@ Prepares for video playback. This API uses a callback to return the result.
```js
videoPlayer.prepare((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('prepare success!');
} else {
console.info('prepare fail!');
......@@ -741,7 +740,7 @@ Starts to play video resources. This API uses a callback to return the result.
```js
videoPlayer.play((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('play success!');
} else {
console.info('play fail!');
......@@ -791,7 +790,7 @@ Pauses video playback. This API uses a callback to return the result.
```js
videoPlayer.pause((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('pause success!');
} else {
console.info('pause fail!');
......@@ -841,7 +840,7 @@ Stops video playback. This API uses a callback to return the result.
```js
videoPlayer.stop((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('stop success!');
} else {
console.info('stop fail!');
......@@ -891,7 +890,7 @@ Switches the video resource to be played. This API uses a callback to return the
```js
videoPlayer.reset((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('reset success!');
} else {
console.info('reset fail!');
......@@ -942,7 +941,7 @@ Seeks to the specified playback position. The next key frame at the specified po
```js
videoPlayer.seek((seekTime, err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('seek success!');
} else {
console.info('seek fail!');
......@@ -970,7 +969,7 @@ Seeks to the specified playback position. This API uses a callback to return the
```js
videoPlayer.seek((seekTime, seekMode, err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('seek success!');
} else {
console.info('seek fail!');
......@@ -1034,7 +1033,7 @@ Sets the volume. This API uses a callback to return the result.
```js
videoPlayer.setVolume((vol, err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('setVolume success!');
} else {
console.info('setVolume fail!');
......@@ -1090,7 +1089,7 @@ Releases the video playback resource. This API uses a callback to return the res
```js
videoPlayer.release((err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('release success!');
} else {
console.info('release fail!');
......@@ -1148,7 +1147,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]);
}
......@@ -1185,7 +1184,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');
......@@ -1217,7 +1216,7 @@ Sets the video playback speed. This API uses a callback to return the result.
```js
videoPlayer.setSpeed((speed:number, err) => {
if (typeof (err) == 'undefined') {
if (err == null) {
console.info('setSpeed success!');
} else {
console.info('setSpeed fail!');
......@@ -1438,7 +1437,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); // Print the MD_KEY_TRACK_TYPE value of each track.
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册