Skip to content

Commit

Permalink
chroe: update
Browse files Browse the repository at this point in the history
  • Loading branch information
shiyiya authored Sep 30, 2024
1 parent deea4d2 commit 194bdbe
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 16 deletions.
2 changes: 1 addition & 1 deletion packages/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
## Basic

```js
const player = Player.make('#player', {
const player = OPlayer.make('#player', {
source: {
title: '君の名は',
src: 'https://cdn.jsdelivr.net/gh/shiyiya/QI-ABSL@master/o/君の名は.mp4',
Expand Down
1 change: 1 addition & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"type": "module",
"main": "./dist/index.es.js",
"types": "./dist/src/index.d.ts",
"browser": "./dist/index.min.js",
"sideEffects": false,
"author": "shiyiya",
"homepage": "https://github.com/shiyiya/oplayer",
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/src/pages/docs/player-configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Callout } from 'nextra-theme-docs'
</Callout>

```js
Player.make(/* container */ '#app', {
OPlayer.make(/* container */ '#app', {
/** Configuration **/
/** Here's where to fill in the configuration **/
muted: true
Expand Down
4 changes: 2 additions & 2 deletions packages/docs/src/pages/docs/plugins/airplay.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ npm i @oplayer/plugins
```js
import { AirPlay } from '@oplayer/plugins'

Player.make('#oplayer').use([new AirPlay()]).create()
OPlayer.make('#oplayer').use([new AirPlay()]).create()
```

```html
<script src="https://cdn.jsdelivr.net/npm/@oplayer/plugins@latest/dist/airplay.min.js"></script>

<script>
Player.make('#oplayer').use([new OAirPlay()]).create()
OPlayer.make('#oplayer').use([new OAirPlay()]).create()
</script>
```
4 changes: 2 additions & 2 deletions packages/docs/src/pages/docs/plugins/chromecast.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ npm i @oplayer/plugins
```js
import { Chromecast } from '@oplayer/plugins'

Player.make('#oplayer').use([new Chromecast()]).create()
OPlayer.make('#oplayer').use([new Chromecast()]).create()
```

```html
<script src="https://cdn.jsdelivr.net/npm/@oplayer/plugins@latest/dist/chromecast.min.js"></script>

<script>
Player.make('#oplayer').use([new OChromecast()]).create()
OPlayer.make('#oplayer').use([new OChromecast()]).create()
</script>
```
4 changes: 2 additions & 2 deletions packages/docs/src/pages/docs/plugins/playlist.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ npm i @oplayer/ui @oplayer/plugins
<script src="https://cdn.jsdelivr.net/npm/@oplayer/plugins@latest/dist/playlist.min.js"></script>

<script>
Player.make('#player') .use([new OPlaylist(...)]).create()
OPlayer.make('#player') .use([new OPlaylist(...)]).create()
</script>
```

Expand All @@ -19,7 +19,7 @@ import Player from '@oplayer/core'
import ui from '@oplayer/ui'
import { Playlist } from '@oplayer/plugins'

Player.make('#player')
OPlayer.make('#player')
.use([
ui(),
new Playlist({
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/src/pages/docs/plugins/vtt-thumbnails.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ import Player from '@oplayer/react'
import ui from '@oplayer/ui'
import { vttThumbnails } from '@oplayer/plugins'

Player.make('#player').use([ui(), vttThumbnails({ src:'your-path' })]).create()
OPlayer.make('#player').use([ui(), vttThumbnails({ src:'your-path' })]).create()
```
4 changes: 2 additions & 2 deletions packages/docs/src/pages/docs/start.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ npm i @oplayer/core @oplayer/ui @oplayer/hls hls.js
```

```js filename="app.js"
import Player from '@oplayer/core'
import OPlayer from '@oplayer/core'
import OUI from '@oplayer/ui'
import OHls from '@oplayer/hls'

Player.make('#oplayer', {
OPlayer.make('#oplayer', {
source: {
title: '君の名は',
src: 'https://cdn.jsdelivr.net/gh/shiyiya/QI-ABSL@master/o/君の名は.mp4',
Expand Down
4 changes: 2 additions & 2 deletions packages/docs/src/pages/docs/ui.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ npm i @oplayer/ui
## Basic

```js
const player = Player.make('#player', {
const player = OPlayer.make('#player', {
source: {
title: '君の名は',
src: 'https://oplayer.vercel.app/君の名は.mp4',
Expand Down Expand Up @@ -82,7 +82,7 @@ OUI({
## How to display title ?

```js
const player = Player.make('#player', {
const player = OPlayer.make('#player', {
source: {
title: '君の名は' // required
// ...
Expand Down
1 change: 1 addition & 0 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"type": "module",
"main": "./dist/index.es.js",
"types": "./dist/src/index.d.ts",
"browser": "./dist/index.min.js",
"sideEffects": false,
"author": "shiyiya",
"homepage": "https://github.com/shiyiya/oplayer",
Expand Down
17 changes: 14 additions & 3 deletions packages/ui/src/components/Setting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,19 @@ function createPanel(
}

for (let i = 0; i < setting.length; i++) {
const { name, type, key, children, icon, default: selected, onChange, max, min, step } = setting[i]!
const {
name,
type,
key,
children,
icon,
default: selected,
onChange,
max,
min,
step,
value
} = setting[i]!

const { $row, $label } = createRow(
Object.assign(
Expand All @@ -237,7 +249,6 @@ function createPanel(
$.render($row, panel.$ref)
$.render(panel.$ref, target)

//处理 selector,因为依赖label,所以需先创建子 panel
if (children) {
const nextIsSelectorOptionsPanel =
type == 'selector' && children.every((it) => !Boolean(it.type) || it.type == 'option')
Expand Down Expand Up @@ -308,7 +319,7 @@ function createPanel(
// TODO: update methond
} else {
if (type == 'option' || (type == undefined && !isSelectorOptionsPanel)) {
$row.addEventListener('click', (e) => (onChange || options.parenOnChange)?.(e))
$row.addEventListener('click', (event) => (onChange || options.parenOnChange)?.({ value, event }))
}
}
}
Expand Down

0 comments on commit 194bdbe

Please sign in to comment.