📅  最后修改于: 2023-12-03 15:14:18.725000             🧑  作者: Mango
CSS Pause property allows multimedia contents such as videos or animations to be paused at specific times (cues) during playback. This property is useful when you want to synchronize your multimedia content with some other actions on a web page.
pause: none | x;
none
: Plays the media content without pausing.x
: Pauses the media content at the specified cue point.This is the default value of the pause property. The media content will continue playing during the whole duration without any pauses.
This value specifies that the media content should be paused at specific cue points during playback. The cue points are dependent on the type of media content being used. For example, in a video, cue points can be specific times (in seconds), while in an audio file, cue points can be specific points in the waveform.
To use the pause property, you need to define the cue points at which you want the media content to pause. You can do this by specifying the cue points using the ::cue
selector in a track
element.
<video controls>
<source src="my-video.mp4" type="video/mp4">
<track kind="metadata" src="my-video-cues.vtt">
</video>
/* my-video-cues.vtt */
::cue(1) {
pause: x;
}
::cue(10) {
pause: x;
}
In the example above, the video will pause at 1 second and 10 seconds from the beginning of playback.
The pause property is currently supported in most major web browsers, including Chrome, Firefox, Safari, and Edge.
CSS Pause property is a powerful tool for synchronizing multimedia content with other actions on a web page. By defining cue points using the ::cue
selector in a track
element, you can control when your media content pauses during playback.