From f21ec87be53c77f6857c3d37608cdc4c88942ecd Mon Sep 17 00:00:00 2001 From: CY Date: Mon, 3 Jun 2024 17:42:47 +0800 Subject: [PATCH] feat(full): add torrent --- README.md | 2 +- packages/docs/public/oplayer.html | 1 - packages/full/package.json | 8 +++++--- packages/full/src/index.ts | 2 ++ packages/full/vite.config.ts | 1 - pnpm-lock.yaml | 6 ++++++ 6 files changed, 14 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 800a992d..274cca4f 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ โšก Oh! Another HTML5 video player. Do More, Keep it simple. -[๐Ÿ“• Documentation](https://oplayer.vercel.app) | [๐Ÿงก Donate](#support) | [๐Ÿ’œ Contributing](./CONTRIBUTING.md) | [๐ŸŽˆ Demo](https://oplayer.vercel.app/oplayer.html?playlist=%5B%7B%22title%22%3A%22Disney's%2BOceans%2B-%2BMP4%22%2C%22src%22%3A%22https%3A%2F%2Fvjs.zencdn.net%2Fv%2Foceans.mp4%22%2C%22poster%22%3A%22https%3A%2F%2Fvjs.zencdn.net%2Fv%2Foceans.png%22%2C%22duration%22%3A%2200%3A46%22%7D%2C%7B%22title%22%3A%22Big%2BBuck%2BBunny%2B-%2BHLS%22%2C%22src%22%3A%22https%3A%2F%2Ftest-streams.mux.dev%2Fx36xhzz%2Fx36xhzz.m3u8%22%2C%22poster%22%3A%22https%3A%2F%2Fd2zihajmogu5jn.cloudfront.net%2Fbig-buck-bunny%2Fbbb.png%22%2C%22duration%22%3A%2210%3A34%22%7D%2C%7B%22title%22%3A%22Big%2BBuck%2BBunny%2B-%2BDASH%22%2C%22src%22%3A%22https%3A%2F%2Fdash.akamaized.net%2Fakamai%2Fbbb_30fps%2Fbbb_30fps.mpd%22%2C%22poster%22%3A%22https%3A%2F%2Fd2zihajmogu5jn.cloudfront.net%2Fbig-buck-bunny%2Fbbb.png%22%2C%22duration%22%3A%2210%3A34%22%7D%2C%7B%22title%22%3A%22torrent%22%2C%22src%22%3A%22https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fsintel.torrent%22%2C%22poster%22%3A%22%22%2C%22duration%22%3A%2214%3A48%22%7D%5D&p=1) +[๐Ÿ“• Documentation](https://oplayer.vercel.app) | [๐Ÿงก Donate](#support) | [๐Ÿ’œ Contributing](./CONTRIBUTING.md) | [๐ŸŽˆ Demo](https://oplayer.vercel.app/oplayer.html?playlist=%5B%7B%22title%22%3A%22Disney's%20Oceans%20-%20MP4%22%2C%22src%22%3A%22https%3A%2F%2Fvjs.zencdn.net%2Fv%2Foceans.mp4%22%2C%22poster%22%3A%22https%3A%2F%2Fvjs.zencdn.net%2Fv%2Foceans.png%22%2C%22duration%22%3A%2200%3A46%22%7D%2C%7B%22title%22%3A%22Big%20Buck%20Bunny%20-%20HLS%22%2C%22src%22%3A%22https%3A%2F%2Ftest-streams.mux.dev%2Fx36xhzz%2Fx36xhzz.m3u8%22%2C%22poster%22%3A%22https%3A%2F%2Fd2zihajmogu5jn.cloudfront.net%2Fbig-buck-bunny%2Fbbb.png%22%2C%22duration%22%3A%2210%3A34%22%7D%2C%7B%22title%22%3A%22Big%20Buck%20Bunny%20-%20DASH%22%2C%22src%22%3A%22https%3A%2F%2Fdash.akamaized.net%2Fakamai%2Fbbb_30fps%2Fbbb_30fps.mpd%22%2C%22poster%22%3A%22https%3A%2F%2Fd2zihajmogu5jn.cloudfront.net%2Fbig-buck-bunny%2Fbbb.png%22%2C%22duration%22%3A%2210%3A34%22%7D%2C%7B%22title%22%3A%22Torrent%22%2C%22src%22%3A%22https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fsintel.torrent%22%2C%22poster%22%3A%22%22%2C%22duration%22%3A%2214%3A48%22%7D%5D&p=1) [![npm](https://img.shields.io/npm/v/@oplayer/core?style=flat-square)](https://www.npmjs.com/package/@oplayer/core) [![npm dt](https://img.shields.io/npm/dm/@oplayer/core?style=flat-square)](https://www.npmjs.com/package/@oplayer/core) diff --git a/packages/docs/public/oplayer.html b/packages/docs/public/oplayer.html index 922459a2..5b066ea3 100644 --- a/packages/docs/public/oplayer.html +++ b/packages/docs/public/oplayer.html @@ -13,7 +13,6 @@
- diff --git a/packages/full/package.json b/packages/full/package.json index 09d1f4fc..4be9dac9 100644 --- a/packages/full/package.json +++ b/packages/full/package.json @@ -1,6 +1,6 @@ { "name": "@oplayer/full", - "version": "0.0.0", + "version": "0.0.1", "description": "all loader in one", "type": "module", "main": "./dist/index.min.js", @@ -24,12 +24,14 @@ "@oplayer/dash": "workspace:*", "@oplayer/hls": "workspace:*", "@oplayer/mpegts": "workspace:*", - "@oplayer/ui": "workspace:*" + "@oplayer/ui": "workspace:*", + "@oplayer/torrent": "workspace:*" }, "peerDependencies": { "hls.js": "*", "dashjs": "*", - "mpegts.js": "*" + "mpegts.js": "*", + "webtorrent": "0.98.18" }, "files": [ "dist" diff --git a/packages/full/src/index.ts b/packages/full/src/index.ts index f98f60a4..062bca43 100644 --- a/packages/full/src/index.ts +++ b/packages/full/src/index.ts @@ -2,6 +2,7 @@ import ui from '@oplayer/ui' import hls from '@oplayer/hls' import dash from '@oplayer/dash' import mepgts from '@oplayer/mpegts' +import torrent from '@oplayer/torrent' import Player from '@oplayer/core' @@ -13,4 +14,5 @@ if (globalThis.window) { ;(globalThis.window as any).OHls = hls ;(globalThis.window as any).ODash = dash ;(globalThis.window as any).OMpegts = mepgts + ;(globalThis.window as any).OTorrent = torrent } diff --git a/packages/full/vite.config.ts b/packages/full/vite.config.ts index 57d1f23e..502df1e9 100644 --- a/packages/full/vite.config.ts +++ b/packages/full/vite.config.ts @@ -4,7 +4,6 @@ import { plugin } from 'vite-plugin-merge-exports' export default viteConfig('full', { build: { - emptyOutDir: false, lib: { name: 'OPlayer', formats: ['umd'] diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c461c2ff..b2ae76fa 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -191,6 +191,9 @@ importers: '@oplayer/mpegts': specifier: workspace:* version: link:../mpegts + '@oplayer/torrent': + specifier: workspace:* + version: link:../torrent '@oplayer/ui': specifier: workspace:* version: link:../ui @@ -203,6 +206,9 @@ importers: mpegts.js: specifier: '*' version: 1.7.3 + webtorrent: + specifier: 0.98.18 + version: 0.98.18 packages/hls: devDependencies: