@grizzshutsdown/simpleplayer 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +174 -0
- package/bin/install-skill.js +43 -0
- package/dist/simple-player.d.ts +31 -0
- package/dist/simple-player.js +1749 -0
- package/dist/simple-player.js.map +1 -0
- package/package.json +51 -0
- package/skill/simpleplayer/SKILL.md +58 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 grizz
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# SimplePlayer
|
|
2
|
+
|
|
3
|
+
A simple default video player created from [Grizz's portfolio](https://grizz.fyi) for others to use.
|
|
4
|
+
|
|
5
|
+
SimplePlayer is a framework-free Web Component. It gives you a clean default video player with custom overlay controls, a scrubber, volume, Picture-in-Picture, fullscreen, and lazy loading.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @grizzshutsdown/simpleplayer
|
|
11
|
+
pnpm add @grizzshutsdown/simpleplayer
|
|
12
|
+
yarn add @grizzshutsdown/simpleplayer
|
|
13
|
+
bun add @grizzshutsdown/simpleplayer
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```js
|
|
19
|
+
import '@grizzshutsdown/simpleplayer';
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
```html
|
|
23
|
+
<simple-player src="/video.mp4"></simple-player>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Add the extra control tray when you want volume, Picture-in-Picture, and fullscreen:
|
|
27
|
+
|
|
28
|
+
```html
|
|
29
|
+
<simple-player src="/video.mp4" controls></simple-player>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Frameworks
|
|
33
|
+
|
|
34
|
+
React:
|
|
35
|
+
|
|
36
|
+
```jsx
|
|
37
|
+
import '@grizzshutsdown/simpleplayer';
|
|
38
|
+
|
|
39
|
+
export function App() {
|
|
40
|
+
return <simple-player src="/video.mp4" aspect-ratio="16 / 9" />;
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Vue:
|
|
45
|
+
|
|
46
|
+
```vue
|
|
47
|
+
<script setup>
|
|
48
|
+
import '@grizzshutsdown/simpleplayer';
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
<template>
|
|
52
|
+
<simple-player src="/video.mp4" aspect-ratio="16 / 9" />
|
|
53
|
+
</template>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Svelte:
|
|
57
|
+
|
|
58
|
+
```svelte
|
|
59
|
+
<script>
|
|
60
|
+
import '@grizzshutsdown/simpleplayer';
|
|
61
|
+
</script>
|
|
62
|
+
|
|
63
|
+
<simple-player src="/video.mp4" aspect-ratio="16 / 9" />
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
TypeScript with React:
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
import type { DetailedHTMLProps, HTMLAttributes } from 'react';
|
|
70
|
+
|
|
71
|
+
declare module 'react' {
|
|
72
|
+
namespace JSX {
|
|
73
|
+
interface IntrinsicElements {
|
|
74
|
+
'simple-player': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement> & {
|
|
75
|
+
src?: string;
|
|
76
|
+
'aspect-ratio'?: string;
|
|
77
|
+
'preload-margin'?: string;
|
|
78
|
+
controls?: boolean;
|
|
79
|
+
'disable-autoplay'?: boolean;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Options
|
|
87
|
+
|
|
88
|
+
```html
|
|
89
|
+
<simple-player
|
|
90
|
+
src="/video.mp4"
|
|
91
|
+
aspect-ratio="16 / 9"
|
|
92
|
+
preload-margin="360px 0px">
|
|
93
|
+
</simple-player>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
- `src`: video URL.
|
|
97
|
+
- `aspect-ratio`: player aspect ratio. Default: `16 / 9`.
|
|
98
|
+
- `preload-margin`: lazy-load margin before the video enters view. Default: `360px 0px`.
|
|
99
|
+
- `controls`: add volume, Picture-in-Picture, and fullscreen controls.
|
|
100
|
+
- `disable-autoplay`: turn off default autoplay. Autoplay starts muted so browsers allow it.
|
|
101
|
+
|
|
102
|
+
The default player matches the simple preview: play/pause, scrubber, muted autoplay, and no extra side controls.
|
|
103
|
+
|
|
104
|
+
Keep the HTML clean and manage controls with JavaScript:
|
|
105
|
+
|
|
106
|
+
```js
|
|
107
|
+
const player = document.querySelector('simple-player');
|
|
108
|
+
|
|
109
|
+
player.src = '/next-video.mp4';
|
|
110
|
+
player.aspectRatio = '1 / 1';
|
|
111
|
+
player.preloadMargin = '240px 0px';
|
|
112
|
+
player.autoplayEnabled = false;
|
|
113
|
+
player.controlsEnabled = true;
|
|
114
|
+
player.volumeEnabled = true;
|
|
115
|
+
player.volumeSliderEnabled = false;
|
|
116
|
+
player.pictureInPictureEnabled = true;
|
|
117
|
+
player.fullscreenEnabled = true;
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Contributing
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
npm install
|
|
124
|
+
npm run dev
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
The dev playground lives in `dev/` and imports `src/simple-player.ts` directly. Use it when changing the player itself. The production site demo is separate and runs with:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
npm run demo
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Before opening a pull request, run:
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
npm run build
|
|
137
|
+
npm pack --dry-run
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Styling
|
|
141
|
+
|
|
142
|
+
```css
|
|
143
|
+
simple-player {
|
|
144
|
+
--overlay-soft: rgb(0 0 0 / 0.42);
|
|
145
|
+
--overlay-blur: 0px;
|
|
146
|
+
|
|
147
|
+
--sp-glass-surface: rgb(255 255 255 / 0.04);
|
|
148
|
+
--sp-glass-opacity: 0.28;
|
|
149
|
+
|
|
150
|
+
--sp-control-glass-surface: rgb(255 255 255 / 0.12);
|
|
151
|
+
--sp-control-glass-opacity: 0.62;
|
|
152
|
+
--sp-control-hover-surface: rgb(255 255 255 / 0.14);
|
|
153
|
+
--sp-control-tray-padding: 2px;
|
|
154
|
+
--sp-control-slot-size: 24px;
|
|
155
|
+
--sp-control-icon-render-size: 20px;
|
|
156
|
+
--sp-control-icon-stroke-width: 1.6;
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## AI Skill
|
|
161
|
+
|
|
162
|
+
The package includes a plain Markdown skill that any AI tool can read.
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
npx @grizzshutsdown/simpleplayer
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Found this useful?
|
|
169
|
+
|
|
170
|
+
Follow [Grizz](https://x.com/GrizzShutsDown).
|
|
171
|
+
|
|
172
|
+
## License
|
|
173
|
+
|
|
174
|
+
MIT
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { cpSync, existsSync, mkdirSync, rmSync } from 'node:fs';
|
|
4
|
+
import { dirname, join, resolve } from 'node:path';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
6
|
+
|
|
7
|
+
const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
|
8
|
+
const source = join(packageRoot, 'skill', 'simpleplayer');
|
|
9
|
+
const args = process.argv.slice(2);
|
|
10
|
+
|
|
11
|
+
const help = `
|
|
12
|
+
SimplePlayer skill installer
|
|
13
|
+
|
|
14
|
+
Usage:
|
|
15
|
+
npx @grizzshutsdown/simpleplayer
|
|
16
|
+
|
|
17
|
+
Options:
|
|
18
|
+
--help Show this help
|
|
19
|
+
`;
|
|
20
|
+
|
|
21
|
+
if (args.includes('--help') || args.includes('-h')) {
|
|
22
|
+
console.log(help.trim());
|
|
23
|
+
process.exit(0);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const skillsDir = resolve(
|
|
27
|
+
process.env.SIMPLEPLAYER_SKILLS_DIR ||
|
|
28
|
+
process.env.AI_SKILLS_DIR ||
|
|
29
|
+
join(process.env.HOME || process.cwd(), '.ai', 'skills'),
|
|
30
|
+
);
|
|
31
|
+
const target = join(skillsDir, 'simpleplayer');
|
|
32
|
+
|
|
33
|
+
if (!existsSync(source)) {
|
|
34
|
+
console.error('Could not find the bundled simpleplayer skill.');
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
mkdirSync(skillsDir, { recursive: true });
|
|
39
|
+
rmSync(target, { recursive: true, force: true });
|
|
40
|
+
cpSync(source, target, { recursive: true });
|
|
41
|
+
|
|
42
|
+
console.log(`Installed SimplePlayer skill to ${target}`);
|
|
43
|
+
console.log(`Use this skills directory in your AI tool: ${skillsDir}`);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare class SimplePlayer extends HTMLElement {
|
|
2
|
+
#private;
|
|
3
|
+
static observedAttributes: string[];
|
|
4
|
+
constructor();
|
|
5
|
+
get src(): string;
|
|
6
|
+
set src(value: string);
|
|
7
|
+
get aspectRatio(): string;
|
|
8
|
+
set aspectRatio(value: string);
|
|
9
|
+
get preloadMargin(): string;
|
|
10
|
+
set preloadMargin(value: string);
|
|
11
|
+
get autoplayEnabled(): boolean;
|
|
12
|
+
set autoplayEnabled(value: boolean);
|
|
13
|
+
get controlsEnabled(): boolean;
|
|
14
|
+
set controlsEnabled(value: boolean);
|
|
15
|
+
get volumeEnabled(): boolean;
|
|
16
|
+
set volumeEnabled(value: boolean);
|
|
17
|
+
get volumeSliderEnabled(): boolean;
|
|
18
|
+
set volumeSliderEnabled(value: boolean);
|
|
19
|
+
get pictureInPictureEnabled(): boolean;
|
|
20
|
+
set pictureInPictureEnabled(value: boolean);
|
|
21
|
+
get fullscreenEnabled(): boolean;
|
|
22
|
+
set fullscreenEnabled(value: boolean);
|
|
23
|
+
connectedCallback(): void;
|
|
24
|
+
disconnectedCallback(): void;
|
|
25
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
26
|
+
}
|
|
27
|
+
declare global {
|
|
28
|
+
interface HTMLElementTagNameMap {
|
|
29
|
+
'simple-player': SimplePlayer;
|
|
30
|
+
}
|
|
31
|
+
}
|