Skip to content

Commit d0ea89f

Browse files
authored
@oplayer/shaka (#158)
Closed #157
1 parent c47e59e commit d0ea89f

17 files changed

+1131
-539
lines changed

examples/standalone/main.ts

+15-6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import dash from '@oplayer/dash'
66
import hls from '@oplayer/hls'
77
import mpegts from '@oplayer/mpegts'
88
import ui from '@oplayer/ui'
9+
import shaka from '@oplayer/shaka'
910
import torrent from '@oplayer/torrent'
1011
import { Playlist, Chromecast } from '@oplayer/plugins'
1112

@@ -165,6 +166,9 @@ const init = () => {
165166
hls({ forceHLS: true }),
166167
dash(),
167168
mpegts(),
169+
shaka({
170+
library: 'https://cdn.jsdelivr.net/npm/[email protected]/dist/shaka-player.compiled.debug.js'
171+
}),
168172
new Danmaku({
169173
enable: true
170174
// displaySender: true,
@@ -174,12 +178,9 @@ const init = () => {
174178
initialIndex: 0,
175179
sources: [
176180
{
177-
title: 'DASH DRM',
178-
id: 'dash-drm'
179-
},
180-
{
181-
title: 'Hls DRM',
182-
id: 'hls-drm'
181+
title: 'shaka mdp',
182+
format: 'shaka',
183+
src: 'https://storage.googleapis.com/shaka-demo-assets/angel-one/dash.mpd'
183184
},
184185
{
185186
title: 'hls - muti quality & subtitle & audio',
@@ -261,6 +262,14 @@ const init = () => {
261262
src: 'https://webtorrent.io/torrents/sintel.torrent',
262263
// 'magnet:?xt=urn:btih:08ada5a7a6183aae1e09d831df6748d566095a10&dn=Sintel&tr=udp%3A%2F%2Fexplodie.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.empire-js.us%3A1337&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2F&xs=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fsintel.torrent',
263264
poster: 'https://api.imlazy.ink/img?webtorrent'
265+
},
266+
{
267+
title: 'DASH DRM',
268+
id: 'dash-drm'
269+
},
270+
{
271+
title: 'Hls DRM',
272+
id: 'hls-drm'
264273
}
265274
],
266275
customFetcher(player, source) {

examples/standalone/package-lock.json

+38-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/standalone/package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@
2020
"@oplayer/plugins": "file:../../packages/plugins",
2121
"@oplayer/torrent": "file:../../packages/torrent",
2222
"@oplayer/ui": "file:../../packages/ui",
23+
"@oplayer/shaka": "file:../../packages/shaka",
2324
"dashjs": "^4.6.0",
2425
"hls.js": "^1.5.15",
25-
"lit": "^2.8.0"
26+
"lit": "^2.8.0",
27+
"shaka-player": "^4.14.1"
2628
}
2729
}

package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"lint": "prettier -w ./packages/*/**/*.ts"
3333
},
3434
"devDependencies": {
35-
"@babel/core": "^7.26.9",
35+
"@babel/core": "^7.26.10",
3636
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
3737
"@babel/plugin-transform-destructuring": "^7.25.9",
3838
"@babel/plugin-transform-logical-assignment-operators": "^7.25.9",
@@ -41,21 +41,21 @@
4141
"@babel/plugin-transform-parameters": "^7.25.9",
4242
"@babel/plugin-transform-spread": "^7.25.9",
4343
"@babel/plugin-transform-template-literals": "^7.26.8",
44-
"@changesets/cli": "^2.28.0",
44+
"@changesets/cli": "^2.28.1",
4545
"@rollup/plugin-babel": "^6.0.4",
46-
"@types/node": "^20.17.19",
46+
"@types/node": "^20.17.24",
4747
"@vitejs/plugin-react": "^4.3.4",
4848
"babel-plugin-syntax-trailing-function-commas": "^6.22.0",
4949
"concurrently": "^8.2.2",
5050
"cross-env": "^7.0.3",
5151
"jsdom": "^24.1.3",
52-
"lint-staged": "^15.4.3",
52+
"lint-staged": "^15.5.0",
5353
"nx": "^19.8.14",
54-
"prettier": "^3.5.1",
54+
"prettier": "^3.5.3",
5555
"rimraf": "^5.0.10",
5656
"terser": "^5.39.0",
5757
"tslib": "^2.8.1",
58-
"typescript": "^5.7.3",
58+
"typescript": "^5.8.2",
5959
"vite": "^5.4.14",
6060
"vite-plugin-banner": "^0.7.1",
6161
"vite-plugin-merge-exports": "^0.0.0",

packages/docs/package.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,20 @@
1616
"@oplayer/mpegts": "workspace:*",
1717
"@oplayer/plugins": "workspace:*",
1818
"@oplayer/react": "workspace:*",
19+
"@oplayer/shaka": "workspace:*",
1920
"@oplayer/torrent": "workspace:*",
2021
"@oplayer/ui": "workspace:*",
2122
"mdx-embed": "^1.1.2",
2223
"next": "^14.2.24",
2324
"nextra": "2.13.4",
2425
"nextra-theme-docs": "2.13.4",
2526
"react": "^18.3.1",
26-
"react-dom": "^18.3.1"
27+
"react-dom": "^18.3.1",
28+
"shaka-player": "^4.14.1"
2729
},
2830
"devDependencies": {
2931
"@types/react": "^18.3.18",
3032
"@types/react-dom": "^18.3.5",
31-
"sass": "^1.85.0"
33+
"sass": "^1.85.1"
3234
}
3335
}

packages/docs/src/pages/components/player.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import Player, { PlayerPlugin } from '@oplayer/core'
33
import ui from '@oplayer/ui'
44
import hls from '@oplayer/hls'
55
import dash from '@oplayer/dash'
6+
import shaka from '@oplayer/shaka'
67
import mpegts from '@oplayer/mpegts'
78
import style from './player.module.scss'
89
import { Chromecast } from '@oplayer/plugins'
@@ -46,6 +47,7 @@ export default () => {
4647
}
4748
]
4849
}),
50+
shaka(),
4951
hls({ forceHLS: true }),
5052
dash(),
5153
mpegts(),

packages/shaka/README.md

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# oplayer-plugin-shaka
2+
3+
[![npm](https://img.shields.io/npm/v/@oplayer/shaka?style=flat-square&label=@oplayer/shaka)](https://www.npmjs.com/package/@oplayer/shaka)
4+
![npm bundle size](https://img.shields.io/bundlephobia/minzip/@oplayer/shaka?style=flat-square)
5+
[![npm dm](https://img.shields.io/npm/dm/@oplayer/shaka?style=flat-square)](https://www.npmjs.com/package/@oplayer/shaka)
6+
[![jsdelivr](https://data.jsdelivr.com/v1/package/npm/@oplayer/shaka/badge)](https://www.jsdelivr.com/package/npm/@oplayer/shaka)
7+
8+
[shaka-player](https://github.com/shaka-project/shaka-player) plugin for oplayer
9+
10+
## Install
11+
12+
```bash
13+
npm i @oplayer/hls shaka-player
14+
```
15+
16+
```html
17+
<script src="https://cdn.jsdelivr.net/npm/@oplayer/core@latest/dist/index.min.js"></script>
18+
<script src="https://cdn.jsdelivr.net/npm/@oplayer/shaka@latest/dist/index.min.js"></script>
19+
20+
<div id="oplayer" />
21+
22+
<script>
23+
OPlayer.make('#oplayer', {
24+
source: {
25+
src: 'https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8',
26+
poster: 'https://cdn.jsdelivr.net/gh/shiyiya/QI-ABSL@master/o/poster.png'
27+
}
28+
})
29+
.use([
30+
OShaka({
31+
library: 'https://cdn.jsdelivr.net/npm/[email protected]/dist/shaka-player.compiled.min.js'
32+
})
33+
])
34+
.create()
35+
</script>
36+
```

packages/shaka/package.json

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"name": "@oplayer/shaka",
3+
"version": "1.2.26-beta.0",
4+
"description": "shaka-player plugin for oplayer",
5+
"type": "module",
6+
"main": "./dist/index.es.js",
7+
"types": "./dist/src/index.d.ts",
8+
"sideEffects": false,
9+
"author": "shiyiya",
10+
"homepage": "https://github.com/shiyiya/oplayer",
11+
"keywords": [
12+
"oplayer-plugin",
13+
"shaka-player"
14+
],
15+
"license": "MIT",
16+
"scripts": {
17+
"start": "concurrently -n es,dts \"vite build --watch\" \"tsc --emitDeclarationOnly --watch\"",
18+
"tsc": "tsc --noEmit && echo",
19+
"build": "vite build && tsc --emitDeclarationOnly"
20+
},
21+
"files": [
22+
"dist",
23+
"src"
24+
],
25+
"browserslist": [
26+
"> 1%",
27+
"last 2 versions",
28+
"not dead",
29+
"not op_mini all",
30+
"IE 11"
31+
],
32+
"peerDependencies": {
33+
"@oplayer/core": ">=1.0.0",
34+
"shaka-player": "^3"
35+
},
36+
"devDependencies": {
37+
"@oplayer/core": "workspace:*",
38+
"shaka-player": "^4.14.1"
39+
}
40+
}

0 commit comments

Comments
 (0)