Skip to content

Commit b4281d5

Browse files
committed
Refactor code for improved performance
0 parents  commit b4281d5

File tree

81 files changed

+41056
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+41056
-0
lines changed

.babelrc.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"sourceType": "unambiguous",
3+
"presets": [
4+
[
5+
"@babel/preset-env",
6+
{
7+
"targets": {
8+
"chrome": 100,
9+
"safari": 15,
10+
"firefox": 91
11+
}
12+
}
13+
],
14+
"@babel/preset-typescript",
15+
"@babel/preset-react"
16+
],
17+
"plugins": []
18+
}

.github/workflows/main.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: CI
2+
on: [push]
3+
jobs:
4+
build:
5+
name: Build, lint, and test on Node ${{ matrix.node }} and ${{ matrix.os }}
6+
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
matrix:
10+
node: ['10.x', '12.x', '14.x']
11+
os: [ubuntu-latest, windows-latest, macOS-latest]
12+
13+
steps:
14+
- name: Checkout repo
15+
uses: actions/checkout@v2
16+
17+
- name: Use Node ${{ matrix.node }}
18+
uses: actions/setup-node@v1
19+
with:
20+
node-version: ${{ matrix.node }}
21+
22+
- name: Install deps and build (with cache)
23+
uses: bahmutov/npm-install@v1
24+
25+
- name: Lint
26+
run: yarn lint
27+
28+
- name: Test
29+
run: yarn test --ci --coverage --maxWorkers=2
30+
31+
- name: Build
32+
run: yarn build

.github/workflows/size.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: size
2+
on: [pull_request]
3+
jobs:
4+
size:
5+
runs-on: ubuntu-latest
6+
env:
7+
CI_JOB_NUMBER: 1
8+
steps:
9+
- uses: actions/checkout@v1
10+
- uses: andresz1/size-limit-action@v1
11+
with:
12+
github_token: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*.log
2+
.DS_Store
3+
node_modules
4+
.cache
5+
dist

.storybook/main.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module.exports = {
2+
stories: ['../stories/**/*.stories.@(ts|tsx|js|jsx)'],
3+
addons: ['@storybook/addon-links', '@storybook/addon-essentials'],
4+
5+
// https://storybook.js.org/docs/react/configure/typescript#mainjs-configuration
6+
typescript: {
7+
check: true, // type-check stories during Storybook build
8+
},
9+
10+
framework: {
11+
name: '@storybook/react-webpack5',
12+
options: {},
13+
},
14+
15+
docs: { autodocs: true },
16+
};

.storybook/preview.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// https://storybook.js.org/docs/react/writing-stories/parameters#global-parameters
2+
export const parameters = {
3+
// https://storybook.js.org/docs/react/essentials/actions#automatically-matching-args
4+
actions: { argTypesRegex: '^on.*' },
5+
};

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 KingRayhan
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.

README.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
## @graphland/react-video-player
2+
3+
A customizable React component serving as a wrapper for the popular Video.js library. This component provides a sleek and responsive video player with theme options.
4+
5+
### Installation
6+
7+
```bash
8+
npm install @your-username/react-video-player
9+
```
10+
11+
### Usage
12+
13+
```bash
14+
import React from 'react';
15+
import VideoPlayer, { Props } from '@graphland/react-video-player';
16+
17+
const App: React.FC = () => {
18+
const videoSources = [
19+
{ src: 'https://media.w3.org/2010/05/sintel/trailer_hd.mp4', type: 'video/mp4' },
20+
// Add more video sources as needed
21+
];
22+
23+
const videoProps: Props = {
24+
theme: 'city', // 'city', 'fantasy', 'forest', 'sea'
25+
height: 720,
26+
width: 1280,
27+
autoPlay: false,
28+
loop: false,
29+
sources: videoSources,
30+
controlBar: {
31+
skipButtons: {
32+
forward: 5,
33+
backward: 5,
34+
},
35+
},
36+
playbackRates: [0.5, 1, 1.5, 2],
37+
disablePictureInPicture: false,
38+
onReady: () => {
39+
console.log('Video player is ready!');
40+
},
41+
};
42+
43+
return (
44+
<VideoPlayer {...videoProps} />
45+
);
46+
};
47+
48+
export default App;
49+
```
50+
51+
#### Props
52+
53+
- `theme` (optional): Choose from 'city', 'fantasy', 'forest', 'sea' for different player themes.
54+
- `height` (optional): Height of the video player in pixels.
55+
- `width` (optional): Width of the video player in pixels.
56+
- `autoPlay` (optional): Automatically start playing the video when the component mounts.
57+
- `loop` (optional): Enable looping of the video.
58+
- `sources` (required): An array of video sources with `{ src: string, type: string }` format.
59+
- `poster` (optional): URL for the video poster image.
60+
- `controlBar` (optional): Additional configuration for the video control bar, including skip buttons.
61+
- `playbackRates` (optional): Array of playback rates available to the user.
62+
- `disablePictureInPicture` (optional): Disable the Picture-in-Picture mode.
63+
- `onReady` (optional): Callback function called when the video player is ready.

example/.npmignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
.cache
3+
dist

example/index.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
7+
<title>Playground</title>
8+
</head>
9+
10+
<body>
11+
<div id="root"></div>
12+
<script src="./index.tsx"></script>
13+
</body>
14+
</html>

0 commit comments

Comments
 (0)