In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "how to use Mini Program's video control". In daily operation, I believe many people have doubts about how to use Mini Program's video control. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts about "how to use Mini Program's video control". Next, please follow the editor to study!
I. attributes
| | attribute name | Type | default value | description | minimum version |
| |-|
| | src | String | | address of the resource to play the video |
| | initial-time | String | | specify the initial video playback position | 1.6.0 |
| | duration | Number | | specify video duration | 1.1.0 |
| | controls | Boolean | true | whether to display default playback controls (play / pause button, playback progress, time) |
| | danmu-list | Object Array | | on-screen comment list |
| | danmu-btn | Boolean | false | whether to display the on-screen comment button, which is valid only during initialization and cannot be changed dynamically |
| | enable-danmu | Boolean | false | whether to display on-screen comment, which is valid only during initialization and cannot be changed dynamically |
| | autoplay | Boolean | false | whether to automatically play |
| | loop | Boolean | false | whether to play in a loop | 1.4.0 |
| | muted | Boolean | false | whether to mute playback | 1.4.0 |
| | page-gesture | Boolean | false | whether to enable brightness and volume adjustment gestures in non-full screen mode | 1.6.0 |
| direction | Number | | set the direction of the video in full screen. If it is not specified, it will be judged automatically according to the aspect ratio. Valid values are 0 (normal vertical), 90 (90 degrees counterclockwise),-90 (90 degrees clockwise) | 1.7.0 |
| | bindplay | EventHandle | | play event is triggered when playback starts / resumes |
| | bindpause | EventHandle | | pause event is triggered when playback is paused |
| | bindended | EventHandle | | trigger the ended event when the playback reaches the end |
| bindtimeupdate | EventHandle | | triggered when the playback progress changes, event.detail = {currentTime, duration}. Trigger frequency 250ms once | |
| | bindfullscreenchange | EventHandle | | triggered when the video enters and exits full screen, event.detail = {fullScreen, direction}, direction is taken as vertical or horizontal |
| objectFit | String | contain | Video representation when the video size is inconsistent with the size of the video container. Contain: include, fill: fill, cover: overwrite | 1.4.0 |
| | poster | String | | Network resource address of the image on the video cover. Setting poster is invalid if the controls attribute is false |
| |
Video component default width 300px, height 225px, you can set width and height through wxss.
Third, related implementation of api
1 、 wx.createVideoContext
Create and return a video context videoContext object. Under the custom component, the second parameter is passed to the component instance this to manipulate the video component within the component
2. VideoContext object
VideoContext is bound to a video component through videoId, through which you can manipulate a video component.
List of methods for the videoContext object:
| | method | Parameter | description | minimum version |
| |-|
| | play | none | play |
| | pause | none | pause |
| | seek | position | Jump to the specified location (in s) |
| sendDanmu | danmu | send on-screen comment. Danmu contains two attributes: text and color. | | |
| sendDanmu | danmu | send on-screen comment. Danmu contains two attributes: text and color. | | |
| sendDanmu | danmu | send on-screen comment. Danmu contains two attributes: text and color. | | |
| | playbackRate | rate | set double speed playback. The supported magnification is 0.5 / 0.8 / 1.0 / 1.25 / 1.5 | 1.4.0 | |
| | requestFullScreen | none | enter full screen. You can pass {direction} parameter (supported from 1.7.0 onwards) |
| | exitFullScreen | none | exit full screen | 1.4.0 |
This is the end of the study on "how to use Mini Program's video control". I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.