-
Notifications
You must be signed in to change notification settings - Fork 25
fix: add big pause button for mobile browsers #915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f98cf3c
fix: add big pause button
mizadi 8acf9cf
fix: move file location
mizadi d3f6aa1
fix: reduce code
mizadi a3b01cc
fix: e2e tests
mizadi 4b2972d
fix: hardcoded values
mizadi 4d3c1db
fix: pause button css
mizadi 3c96c60
fix: big pause button css
mizadi 4ab4f9f
fix: css class
mizadi c84585a
Merge branch 'master' into fix/big_pause_button
tsi 267ca56
Merge branch 'master' into fix/big_pause_button
tsi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| import videojs from 'video.js'; | ||
| import './big-pause-button.scss'; | ||
|
|
||
| const BigPlayButton = videojs.getComponent('BigPlayButton'); | ||
|
|
||
| class BigPauseButton extends BigPlayButton { | ||
| constructor(player, options) { | ||
| super(player, options); | ||
| this.boundUpdate = this.handleUpdate.bind(this); | ||
| const playerInstance = this.player(); | ||
| playerInstance.on('play', this.boundUpdate); | ||
| playerInstance.on('pause', this.boundUpdate); | ||
| this.handleUpdate(); | ||
| } | ||
|
|
||
| buildCSSClass() { | ||
| return `${super.buildCSSClass()} vjs-big-pause-button`; | ||
| } | ||
|
|
||
| handleClick() { | ||
| const player = this.player(); | ||
| !player.paused() && player.pause(); | ||
| } | ||
|
|
||
| handleUpdate() { | ||
| const player = this.player(); | ||
| if (!player) { | ||
| return; | ||
| } | ||
| const paused = player.paused(); | ||
| (!paused && player.hasStarted()) ? this.show() : this.hide(); | ||
| this[paused ? 'removeClass' : 'addClass']('vjs-playing'); | ||
adimiz1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| this.controlText('Pause'); | ||
| } | ||
|
|
||
| dispose() { | ||
| if (this.boundUpdate) { | ||
| const player = this.player(); | ||
| player.off('play', this.boundUpdate); | ||
| player.off('pause', this.boundUpdate); | ||
| } | ||
| super.dispose(); | ||
| } | ||
| } | ||
|
|
||
| videojs.registerComponent('BigPauseButton', BigPauseButton); | ||
|
|
||
| export default BigPauseButton; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| @use 'sass:map'; | ||
| @use '../../assets/styles/icons'; | ||
|
|
||
| .cld-video-player { | ||
| &.cld-fluid .vjs-big-pause-button { | ||
| max-width: 15%; | ||
| } | ||
|
|
||
| .vjs-big-pause-button .vjs-icon-placeholder { | ||
| @extend .vjs-icon-pause; | ||
| display: flex; | ||
| align-items: center; | ||
| justify-content: center; | ||
| top: 0; | ||
| left: 0; | ||
| width: 100%; | ||
| height: 100%; | ||
| overflow: hidden; | ||
| container-type: inline-size; | ||
|
|
||
| &:before { | ||
| position: static; | ||
| border: none; | ||
| margin: 0; | ||
| width: auto; | ||
| height: auto; | ||
| font-size: clamp(0.35em, 50cqw, 0.8em); | ||
adimiz1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
|
|
||
|
|
||
| &.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-big-pause-button { | ||
| transition: visibility 1s, opacity 1s; | ||
| visibility: hidden; | ||
| opacity: 0; | ||
| } | ||
|
|
||
| &.vjs-has-started.vjs-user-active.vjs-playing .vjs-big-pause-button, | ||
| &.vjs-has-started.vjs-playing .vjs-big-pause-button { | ||
| transition: visibility 0.1s, opacity 0.1s; | ||
| visibility: visible; | ||
| opacity: 1; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.