Skip to content

Commit

Permalink
see changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
shiyiya committed Mar 13, 2024
1 parent 1e4384a commit a2f1874
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 5 deletions.
5 changes: 5 additions & 0 deletions packages/plugins/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## UnRelease

## 1.0.10-beta.1

- playlist
- add keyboard `l`.

## 1.0.10-beta.0

- playlist
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oplayer/plugins",
"version": "1.0.10-beta.0",
"version": "1.0.10-beta.1",
"description": "oplayer's plugin",
"type": "module",
"main": "dist/index.es.js",
Expand Down
1 change: 1 addition & 0 deletions packages/plugins/src/playlist.css
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
height: 5em;
cursor: pointer;
box-sizing: border-box;
overflow: hidden;
}

.playlist-list-item > * {
Expand Down
5 changes: 5 additions & 0 deletions packages/plugins/src/playlist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ export default class PlaylistPlugin implements PlayerPlugin {
this.next()
})
}
this.player.context.ui.keyboard.register({
l: () => {
this.$root.classList.toggle('active')
}
})
}

const { initialIndex, m3uList, sources } = this.options
Expand Down
3 changes: 3 additions & 0 deletions packages/ui/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

## UnRelease

## [1.2.36-beta.0]

- any px -> rem.
- ErrorBuilder custom params.
- add keyboard.
- k: play | pause
- m: mute | unmute
- fix global keyboard not working.

## [1.2.35]

Expand Down
2 changes: 1 addition & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oplayer/ui",
"version": "1.2.35",
"version": "1.2.36-beta.0",
"description": "ui plugin for oplayer",
"type": "module",
"main": "./dist/index.es.js",
Expand Down
8 changes: 6 additions & 2 deletions packages/ui/src/functions/keyboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,17 @@ const KEY_FN: Record<string, (player: Player) => void> = {
export default function (it: UIInterface) {
const { player, config } = it

if (typeof config.keyboard == 'undefined') {
config.keyboard = { focused: true }
}

function keydown(e: KeyboardEvent) {
if (
document.activeElement?.tagName == 'INPUT' ||
document.activeElement?.tagName == 'TEXTAREA' ||
document.activeElement?.getAttribute('contenteditable') ||
(!config.keyboard?.global && !config.keyboard?.focused) ||
(config.keyboard.focused && !isFocused(player)) ||
(!config.keyboard!.global && !config.keyboard!.focused) ||
(config.keyboard!.focused && !isFocused(player)) ||
e.altKey ||
e.ctrlKey ||
e.metaKey ||
Expand Down
1 change: 0 additions & 1 deletion packages/ui/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ const defaultConfig: UiConfig = {
forceLandscapeOnFullscreen: true,

showControls: 'always',
keyboard: { focused: true },
settings: ['loop'],
theme: { primaryColor: '#6668ab' },
speeds: ['2.0', '1.5', '1.25', '1.0', '0.75', '0.5'],
Expand Down

0 comments on commit a2f1874

Please sign in to comment.