From e835c901609d7102487a7cd6be68d194862475fc Mon Sep 17 00:00:00 2001 From: wusongqing Date: Tue, 24 May 2022 17:53:44 +0800 Subject: [PATCH] updated docs Signed-off-by: wusongqing --- en/application-dev/media/video-playback.md | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/en/application-dev/media/video-playback.md b/en/application-dev/media/video-playback.md index feff6a4b8a..e6ed5ad6a6 100644 --- a/en/application-dev/media/video-playback.md +++ b/en/application-dev/media/video-playback.md @@ -401,10 +401,6 @@ export class VideoPlayerDemo { } } - sleep(time) { - for(let t = Date.now(); Date.now() - t <= time;); - } - async videoPlayerDemo() { let videoPlayer = undefined; let surfaceID = 'test' // The surfaceID parameter is used for screen display. Its value is obtained through the XComponent API. For details about the document link, see the method of creating the XComponent. @@ -442,27 +438,15 @@ export class VideoPlayerDemo { }, this.failureCallback).catch(this.catchCallback); // Set the loop playback attribute. videoPlayer.loop = true; - // Call the play API to start playback. + // Call the play API to start loop playback. await videoPlayer.play().then(() => { - console.info('play success'); - }, this.failureCallback).catch(this.catchCallback); - // After the progress bar reaches the end, the playback continues for 3 seconds and then starts from the beginning, since loop playback is configured. - await videoPlayer.seek(videoPlayer.duration, media.SeekMode.SEEK_NEXT_SYNC).then((seekDoneTime) => { - console.info('seek duration success'); - }, this.failureCallback).catch(this.catchCallback); - this.sleep(3000); - // Release playback resources. - await videoPlayer.release().then(() => { - console.info('release success'); + console.info('play success, loop value is ' + videoPlayer.loop); }, this.failureCallback).catch(this.catchCallback); - - // Set the related instances to undefined. - videoPlayer = undefined; - surfaceID = undefined; } } ``` ## Samples The following samples are provided to help you better understand how to develop video playback: + - [`VideoPlayer`: Video Playback (eTS, API version 9)](https://gitee.com/openharmony/app_samples/tree/master/media/VideoPlayer) -- GitLab