Skip to content

Commit

Permalink
Merge branch 'videojs:main' into global-hotkey-support
Browse files Browse the repository at this point in the history
  • Loading branch information
sinaru authored Dec 27, 2024
2 parents 461bab0 + 19ca3f2 commit 1ad5360
Show file tree
Hide file tree
Showing 17 changed files with 324 additions and 54 deletions.
40 changes: 40 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,43 @@
<a name="8.21.1"></a>
## [8.21.1](https://github.com/videojs/video.js/compare/v8.21.0...v8.21.1) (2024-12-05)

### Chores

* **lang:** update zh-TW translations ([#8929](https://github.com/videojs/video.js/issues/8929)) ([b6cec4f](https://github.com/videojs/video.js/commit/b6cec4f)), closes [1000#0](https://github.com/1000/issues/0)
* update Occitan locale file ([#8927](https://github.com/videojs/video.js/issues/8927)) ([a0ca168](https://github.com/videojs/video.js/commit/a0ca168))

<a name="8.21.0"></a>
# [8.21.0](https://github.com/videojs/video.js/compare/v8.20.0...v8.21.0) (2024-12-05)

### Features

* Add option to disable seeking while scrubbing on mobile ([#8903](https://github.com/videojs/video.js/issues/8903)) ([57d6ab6](https://github.com/videojs/video.js/commit/57d6ab6))

### Bug Fixes

* update vhs version ([#8930](https://github.com/videojs/video.js/issues/8930)) ([f87a699](https://github.com/videojs/video.js/commit/f87a699))

### Chores

* update VHS version ([#8933](https://github.com/videojs/video.js/issues/8933)) ([a7ba9f2](https://github.com/videojs/video.js/commit/a7ba9f2))

<a name="8.20.0"></a>
# [8.20.0](https://github.com/videojs/video.js/compare/v8.19.2...v8.20.0) (2024-11-19)

### Chores

* Correct changelog for 8.19.2 ([#8918](https://github.com/videojs/video.js/issues/8918)) ([964c40e](https://github.com/videojs/video.js/commit/964c40e))
* **package:** Update [@videojs](https://github.com/videojs)/http-streaming to 3.16.0 ([#8921](https://github.com/videojs/video.js/issues/8921)) ([7420467](https://github.com/videojs/video.js/commit/7420467)), closes [1000#0](https://github.com/1000/issues/0)

<a name="8.19.2"></a>
## [8.19.2](https://github.com/videojs/video.js/compare/v8.19.1...v8.19.2) (2024-11-14)

### Bug Fixes

* change http to https in examples ([#8905](https://github.com/videojs/video.js/issues/8905)) ([079cbe1](https://github.com/videojs/video.js/commit/079cbe1))
* Fix Escape handling in menus ([#8916](https://github.com/videojs/video.js/issues/8916)) ([d0cf139](https://github.com/videojs/video.js/commit/d0cf139))
* **text-track-settings:** localization not correctly applied ([#8904](https://github.com/videojs/video.js/issues/8904)) ([ecef37c](https://github.com/videojs/video.js/commit/ecef37c))

<a name="8.19.1"></a>
## [8.19.1](https://github.com/videojs/video.js/compare/v8.19.0...v8.19.1) (2024-10-10)

Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ Video.js was started in the middle of 2010 and is now used on over ~~50,000~~ ~~
Thanks to the awesome folks over at [Fastly][fastly], there's a free, CDN hosted version of Video.js that anyone can use. Add these tags to your document's `<head>`:

```html
<link href="//vjs.zencdn.net/8.19.1/video-js.min.css" rel="stylesheet">
<script src="//vjs.zencdn.net/8.19.1/video.min.js"></script>
<link href="//vjs.zencdn.net/8.21.1/video-js.min.css" rel="stylesheet">
<script src="//vjs.zencdn.net/8.21.1/video.min.js"></script>
```

Alternatively, you can include Video.js by getting it from [npm](https://videojs.com/getting-started/#install-via-npm), downloading it from [GitHub releases](https://github.com/videojs/video.js/releases) or by including it via [unpkg](https://unpkg.com) or another JavaScript CDN, like CDNjs.
Expand All @@ -34,12 +34,12 @@ Alternatively, you can include Video.js by getting it from [npm](https://videojs
<script src="https://unpkg.com/video.js/dist/video.min.js"></script>

<!-- unpkg : use a specific version of Video.js (change the version numbers as necessary) -->
<link href="https://unpkg.com/video.js@8.19.1/dist/video-js.min.css" rel="stylesheet">
<script src="https://unpkg.com/video.js@8.19.1/dist/video.min.js"></script>
<link href="https://unpkg.com/video.js@8.21.1/dist/video-js.min.css" rel="stylesheet">
<script src="https://unpkg.com/video.js@8.21.1/dist/video.min.js"></script>

<!-- cdnjs : use a specific version of Video.js (change the version numbers as necessary) -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/video.js/8.19.1/video-js.min.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/video.js/8.19.1/video.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/video.js/8.21.1/video-js.min.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/video.js/8.21.1/video.min.js"></script>
```

Next, using Video.js is as simple as creating a `<video>` element, but with an additional `data-setup` attribute. At a minimum, this attribute must have a value of `'{}'`, but it can include any Video.js [options][options] - just make sure it contains valid JSON!
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/elephantsdream/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<meta charset="utf-8" />
<title>Video.js Text Descriptions, Chapters &amp; Captions Example</title>

<link href="http://vjs.zencdn.net/7.0/video-js.min.css" rel="stylesheet">
<script src="http://vjs.zencdn.net/7.0/video.min.js"></script>
<link href="https://vjs.zencdn.net/7.0/video-js.min.css" rel="stylesheet">
<script src="https://vjs.zencdn.net/7.0/video.min.js"></script>

</head>
<body>
Expand Down
6 changes: 3 additions & 3 deletions docs/examples/simple-embed/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
<body>

<video id="example_video_1" class="video-js" controls preload="none" width="640" height="264" poster="http://vjs.zencdn.net/v/oceans.png" data-setup="{}">
<source src="http://vjs.zencdn.net/v/oceans.mp4" type="video/mp4">
<source src="http://vjs.zencdn.net/v/oceans.webm" type="video/webm">
<source src="http://vjs.zencdn.net/v/oceans.ogv" type="video/ogg">
<source src="https://vjs.zencdn.net/v/oceans.mp4" type="video/mp4">
<source src="https://vjs.zencdn.net/v/oceans.webm" type="video/webm">
<source src="https://vjs.zencdn.net/v/oceans.ogv" type="video/ogg">
<track kind="captions" src="../shared/example-captions.vtt" srclang="en" label="English">
<track kind="subtitles" src="../shared/example-captions.vtt" srclang="en" label="English">
<p class="vjs-no-js">To view this video please enable JavaScript, and consider upgrading to a web browser that <a href="https://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a></p>
Expand Down
14 changes: 3 additions & 11 deletions docs/translations-needed.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ This default value is hardcoded as a default to the localize method in the SeekB

| Language file | Missing translations |
| ----------------------- | ----------------------------------------------------------------------------------- |
| ar.json (Complete) | |
| ar.json (Complete) | |
| az.json (Complete) | |
| ba.json (missing 71) | Audio Player |
| | Video Player |
Expand Down Expand Up @@ -506,6 +506,7 @@ This default value is hardcoded as a default to the localize method in the SeekB
| | Text Background |
| | Caption Area Background |
| | Playing in Picture-in-Picture |
| mr.json (Complete) | |
| nb.json (Complete) | |
| nl.json (missing 1) | Playing in Picture-in-Picture |
| nn.json (missing 10) | Exit Picture-in-Picture |
Expand All @@ -527,15 +528,6 @@ This default value is hardcoded as a default to the localize method in the SeekB
| | Playing in Picture-in-Picture |
| | Skip backward {1} seconds |
| | Skip forward {1} seconds |
| np.json (missing 9) | Drop shadow |
| | No content |
| | Color |
| | Opacity |
| | Text Background |
| | Caption Area Background |
| | Playing in Picture-in-Picture |
| | Skip backward {1} seconds |
| | Skip forward {1} seconds |
| oc.json (missing 7) | Color |
| | Opacity |
| | Text Background |
Expand Down Expand Up @@ -790,6 +782,6 @@ This default value is hardcoded as a default to the localize method in the SeekB
| | Skip forward {1} seconds |
| zh-CN.json (missing 2) | Drop shadow |
| | Playing in Picture-in-Picture |
| zh-TW.json (missing 1) | Playing in Picture-in-Picture |
| zh-TW.json (Complete) | |

<!-- END langtable -->
9 changes: 8 additions & 1 deletion lang/oc.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,12 @@
"{1} is loading.": "{1} es a cargar.",
"Exit Picture-in-Picture": "Sortir de la vidèo incrustada",
"Picture-in-Picture": "Vidèo incrustada",
"No content": "Cap de contengut"
"No content": "Cap de contengut",
"Color": "Color",
"Opacity": "Opacitat",
"Text Background": "Rèireplan del tèxte",
"Caption Area Background": "Rèireplan de la zòna de la legenda",
"Playing in Picture-in-Picture": "Lectura en vidèo incrustada",
"Skip backward {1} seconds": "Avançar de {1} segondas",
"Skip forward {1} seconds": "Recular de {1} segondas"
}
3 changes: 1 addition & 2 deletions lang/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
"Progress": "進度",
"Fullscreen": "全螢幕",
"Exit Fullscreen": "退出全螢幕",
"Picture-in-Picture": "子母畫面",
"Exit Picture-in-Picture": "退出子母畫面",
"Mute": "靜音",
"Unmute": "開啟音效",
"Playback Rate": " 播放速率",
Expand Down Expand Up @@ -87,6 +85,7 @@
"progress bar timing: currentTime={1} duration={2}": "{1}/{2}",
"{1} is loading.": "{1} 正在載入。",
"Exit Picture-in-Picture": "離開子母畫面",
"Playing in Picture-in-Picture": "在子母畫面中播放",
"Picture-in-Picture": "子母畫面",
"No content": "沒有內容",
"Color": "顏色",
Expand Down
31 changes: 21 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "video.js",
"description": "An HTML5 video player that supports HLS and DASH with a common API and skin.",
"version": "8.19.1",
"version": "8.21.1",
"main": "./dist/video.cjs.js",
"module": "./dist/video.es.js",
"style": "./dist/video-js.css",
Expand Down Expand Up @@ -86,7 +86,7 @@
},
"dependencies": {
"@babel/runtime": "^7.12.5",
"@videojs/http-streaming": "^3.15.0",
"@videojs/http-streaming": "^3.16.2",
"@videojs/vhs-utils": "^4.1.1",
"@videojs/xhr": "2.7.0",
"aes-decrypter": "^4.0.2",
Expand Down
10 changes: 8 additions & 2 deletions src/css/components/_progress.scss
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@

// This increases the size of the progress holder so there is an increased
// hit area for clicks/touches.
.video-js .vjs-progress-control:hover .vjs-progress-holder {
.video-js .vjs-progress-control:hover .vjs-progress-holder,
.video-js.vjs-scrubbing.vjs-touch-enabled .vjs-progress-control .vjs-progress-holder {
font-size: 1.666666666666666666em;
}

Expand Down Expand Up @@ -143,7 +144,8 @@
}

.video-js .vjs-progress-control:hover .vjs-time-tooltip,
.video-js .vjs-progress-control:hover .vjs-progress-holder:focus .vjs-time-tooltip {
.video-js .vjs-progress-control:hover .vjs-progress-holder:focus .vjs-time-tooltip,
.video-js.vjs-scrubbing.vjs-touch-enabled .vjs-progress-control .vjs-time-tooltip {
display: block;

// Ensure that we maintain a font-size of ~10px.
Expand Down Expand Up @@ -172,6 +174,10 @@
display: block;
}

.video-js.vjs-scrubbing.vjs-touch-enabled .vjs-progress-control .vjs-mouse-display {
display: block;
}

.video-js.vjs-user-inactive .vjs-progress-control .vjs-mouse-display {
visibility: hidden;
opacity: 0;
Expand Down
4 changes: 2 additions & 2 deletions src/js/control-bar/progress-control/progress-control.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class ProgressControl extends Component {
}

this.off(['mousedown', 'touchstart'], this.handleMouseDownHandler_);
this.off(this.el_, 'mousemove', this.handleMouseMove);
this.off(this.el_, ['mousemove', 'touchmove'], this.handleMouseMove);

this.removeListenersAddedOnMousedownAndTouchstart();

Expand Down Expand Up @@ -172,7 +172,7 @@ class ProgressControl extends Component {
}

this.on(['mousedown', 'touchstart'], this.handleMouseDownHandler_);
this.on(this.el_, 'mousemove', this.handleMouseMove);
this.on(this.el_, ['mousemove', 'touchmove'], this.handleMouseMove);
this.removeClass('disabled');

this.enabled_ = true;
Expand Down
50 changes: 42 additions & 8 deletions src/js/control-bar/progress-control/seek-bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import * as Dom from '../../utils/dom.js';
import * as Fn from '../../utils/fn.js';
import {formatTime} from '../../utils/time.js';
import {silencePromise} from '../../utils/promise';
import {merge} from '../../utils/obj';
import document from 'global/document';

/** @import Player from '../../player' */
Expand Down Expand Up @@ -40,7 +41,23 @@ class SeekBar extends Slider {
* The key/value store of player options.
*/
constructor(player, options) {
options = merge(SeekBar.prototype.options_, options);

// Avoid mutating the prototype's `children` array by creating a copy
options.children = [...options.children];

const shouldDisableSeekWhileScrubbingOnMobile = player.options_.disableSeekWhileScrubbingOnMobile && (IS_IOS || IS_ANDROID);

// Add the TimeTooltip as a child if we are on desktop, or on mobile with `disableSeekWhileScrubbingOnMobile: true`
if ((!IS_IOS && !IS_ANDROID) || shouldDisableSeekWhileScrubbingOnMobile) {
options.children.splice(1, 0, 'mouseTimeDisplay');
}

super(player, options);

this.shouldDisableSeekWhileScrubbingOnMobile_ = shouldDisableSeekWhileScrubbingOnMobile;
this.pendingSeekTime_ = null;

this.setEventHandlers_();
}

Expand Down Expand Up @@ -225,6 +242,12 @@ class SeekBar extends Slider {
* The percentage of media played so far (0 to 1).
*/
getPercent() {
// If we have a pending seek time, we are scrubbing on mobile and should set the slider percent
// to reflect the current scrub location.
if (this.pendingSeekTime_) {
return this.pendingSeekTime_ / this.player_.duration();
}

const currentTime = this.getCurrentTime_();
let percent;
const liveTracker = this.player_.liveTracker;
Expand Down Expand Up @@ -260,7 +283,12 @@ class SeekBar extends Slider {
event.stopPropagation();

this.videoWasPlaying = !this.player_.paused();
this.player_.pause();

// Don't pause if we are on mobile and `disableSeekWhileScrubbingOnMobile: true`.
// In that case, playback should continue while the player scrubs to a new location.
if (!this.shouldDisableSeekWhileScrubbingOnMobile_) {
this.player_.pause();
}

super.handleMouseDown(event);
}
Expand Down Expand Up @@ -324,8 +352,12 @@ class SeekBar extends Slider {
}
}

// Set new time (tell player to seek to new time)
this.userSeek_(newTime);
// if on mobile and `disableSeekWhileScrubbingOnMobile: true`, keep track of the desired seek point but we won't initiate the seek until 'touchend'
if (this.shouldDisableSeekWhileScrubbingOnMobile_) {
this.pendingSeekTime_ = newTime;
} else {
this.userSeek_(newTime);
}

if (this.player_.options_.enableSmoothSeeking) {
this.update();
Expand Down Expand Up @@ -371,6 +403,13 @@ class SeekBar extends Slider {
}
this.player_.scrubbing(false);

// If we have a pending seek time, then we have finished scrubbing on mobile and should initiate a seek.
if (this.pendingSeekTime_) {
this.userSeek_(this.pendingSeekTime_);

this.pendingSeekTime_ = null;
}

/**
* Trigger timeupdate because we're done seeking and the time has changed.
* This is particularly useful for if the player is paused to time the time displays.
Expand Down Expand Up @@ -513,10 +552,5 @@ SeekBar.prototype.options_ = {
barName: 'playProgressBar'
};

// MouseTimeDisplay tooltips should not be added to a player on mobile devices
if (!IS_IOS && !IS_ANDROID) {
SeekBar.prototype.options_.children.splice(1, 0, 'mouseTimeDisplay');
}

Component.registerComponent('SeekBar', SeekBar);
export default SeekBar;
Loading

0 comments on commit 1ad5360

Please sign in to comment.