oplayer-plugin-mpegts
(opens in a new tab) (opens in a new tab) (opens in a new tab)
FLV (opens in a new tab) plugin for oplayer
Install
npm i @oplayer/core @oplayer/mpegts mpegts.js
<script src="https://cdn.jsdelivr.net/npm/@oplayer/core@latest/dist/index.min.js"></script>
<!-- mpegts FIRST -->
<script src="https://cdn.jsdelivr.net/npm/mpegts.js@latest/dist/mpegts.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@oplayer/mpegts@latest/dist/index.min.js"></script>
<div id="oplayer" />
<script>
OPlayer.make('#oplayer', {
source: {
src: 'http://example.com/live/livestream.ts',
poster: 'https://oplayer.vercel.app/poster.png'
}
})
.use([OMpegts()])
.create()
</script>
Usage
export type Matcher = (video: HTMLVideoElement, source: Source) => boolean
// active inactive
export type Active = (
instance: Mpegts.Player,
library: typeof Mpegts
) => void | ((instance: Mpegts.Player, library: typeof Mpegts) => void)
export type MpegtsPluginOptions = {
config?: Partial<Mpegts.Config>
matcher?: Matcher
active?: Active
}