swarm-video-viewer
v2.0.1
Published
Swarm video viewer for any player
Maintainers
Readme
swarm-video-viewer
swarm-video-viewer bridges the core engine with hls.js. It supplies a custom loader class so the player can fetch HLS segments from peers.
Installation
Install the package from npm:
npm install swarm-video-viewerThe package ships with a prebuilt dist/index.iife.js bundle. Most users can skip the build step; run it only when you need a custom version:
pnpm build:iifeCDN usage
Include the prebuilt script directly from jsDelivr:
<script src="https://cdn.jsdelivr.net/npm/swarm-video-viewer/dist/index.iife.js"></script><script>
const { Engine, initHlsJsPlayer } = swarmViewer
const engine = new Engine()
const hls = new Hls({ loader: engine.createLoaderClass() })
initHlsJsPlayer(hls)
</script>Example
import Hls from 'hls.js'
import { Engine } from 'swarm.video-core'
import { initHlsJsPlayer } from 'swarm-video-viewer'
const engine = new Engine()
const hls = new Hls({ loader: engine.createLoaderClass() })
initHlsJsPlayer(hls)More configuration options are available in the main project README. Try the live demo at swarm.video.
