Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the API interface of video tag in JS

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the relevant knowledge of "how to use the API interface of video tag in JS". Xiaobian shows you the operation process through actual cases. The operation method is simple, fast and practical. I hope this article "how to use the API interface of video tag in JS" can help you solve the problem.

Although some attributes are boolean type, it is still recommended to write them in XHTML (attribute name ="attribute value") format to avoid errors (the attributes in bold below are common attributes).

Property Value Function Description controlscontrols Whether to display playback controls autoplayautoplay Set whether to play automatically when you open a browser widthPilex Set player width heightPilex Set player height loopSet video whether to loop (i.e. continue to play again after playing) preloadpreload set whether to wait for the load to finish before playing srcurl set url address to play video posterimgurl set player initial default display picture autobufferautobuffer set to browser buffer mode, not set autoply only effective

Demo:

Second,.video tag API method: Video tag also provides a more user-friendly API interface method for direct call when writing JS, convenient and simple

API event description addTextTrack() Adds a new text track to audio/video. playvideo.play (); Play video pausevideo.pause(); pause video loadvideo.load(); restore all attributes to default values, resume video restart status canPlayTypevar support = videoid.canPlayType ('video/mp4'); determine whether the browser supports the current type of video format Return value: null String: Not supported Maybe: Probably supported: Fully supported

The API for video tags is used in JS as follows:

video::cue{ background-color:transparent; color:white; font-size:20px; line-height: 100px; } replay

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report