diff --git a/README.md b/README.md index bd628167..ec15b5ec 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,9 @@ - https://oplayer.vercel.app - https://ohplayer.netlify.app +- Quick Start + - https://ohplayer.netlify.app/ohls.html?src=https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8 + - https://oplayer.vercel.app/ohls.html?src=https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8 ## Who use OPlayer? diff --git a/examples/standalone/main.ts b/examples/standalone/main.ts index 65357c44..aa89b747 100644 --- a/examples/standalone/main.ts +++ b/examples/standalone/main.ts @@ -111,20 +111,17 @@ const player = Player.make('#player', { m3uList: { sourceFormat(info) { const chunk = info.title.substring(3).split(' ') - const titleWith = chunk.find(it => it.includes('title')).split('=')[1] - const posterWith = chunk.find(it => it.includes('logo'))?.split('=')[1] + const titleWith = chunk.find((it) => it.includes('title')).split('=')[1] + const posterWith = chunk.find((it) => it.includes('logo'))?.split('=')[1] return { src: info.uri, format: 'm3u8', title: titleWith.substring(1, titleWith.length), - poster: posterWith?.substring(1, posterWith.length), + poster: posterWith?.substring(1, posterWith.length) } - }, + } }, sources: [ - { - src: 'https://raw.githubusercontent.com/fanmingming/live/main/tv/m3u/global.m3u' - }, { title: '君の名は - MP4', poster: POSTER, @@ -245,18 +242,18 @@ const actions = () => html`

diff --git a/packages/docs/public/ohls.html b/packages/docs/public/ohls.html index 60387871..f03256dd 100644 --- a/packages/docs/public/ohls.html +++ b/packages/docs/public/ohls.html @@ -81,7 +81,7 @@ } else { var search = new URLSearchParams(document.location.search) src = safeDecodeURIComponent(search.get('src')) - playlist = JSON.parse(safeDecodeURIComponent(search.get('playlist')) || []) + playlist = JSON.parse(safeDecodeURIComponent(search.get('playlist')) || '[]') poster = safeDecodeURIComponent(search.get('poster')) title = safeDecodeURIComponent(search.get('title')) danmaku = safeDecodeURIComponent(search.get('danmaku')) diff --git a/packages/hls/package.json b/packages/hls/package.json index 368e7d0e..41ab91de 100644 --- a/packages/hls/package.json +++ b/packages/hls/package.json @@ -1,6 +1,6 @@ { "name": "@oplayer/hls", - "version": "1.2.24.beta.0", + "version": "1.2.24.beta.1", "description": "Hls plugin for oplayer", "type": "module", "main": "./dist/index.es.js", diff --git a/packages/hls/src/index.ts b/packages/hls/src/index.ts index 0483545b..1af04e20 100644 --- a/packages/hls/src/index.ts +++ b/packages/hls/src/index.ts @@ -95,7 +95,7 @@ class HlsPlugin implements PlayerPlugin { instance?: Hls - options: RequiredPartial = { + options: RequiredPartial = { config: {}, forceHLS: false, textControl: true, @@ -103,7 +103,8 @@ class HlsPlugin implements PlayerPlugin { qualityControl: true, withBitrate: false, qualitySwitch: 'immediate', - matcher: defaultMatcher + matcher: defaultMatcher, + errorHandler: defaultErrorHandler } constructor(options?: HlsPluginOptions) { @@ -136,11 +137,7 @@ class HlsPlugin implements PlayerPlugin { instance.loadSource(source.src) instance.attachMedia($video) instance.on(HlsPlugin.library.Events.ERROR, function (_, data) { - if (errorHandler) { - errorHandler(player, data, defaultErrorHandler) - } else { - defaultErrorHandler(player, data) - } + errorHandler(player, data, defaultErrorHandler) }) if (player.context.ui?.setting) { @@ -158,7 +155,7 @@ class HlsPlugin implements PlayerPlugin { if (this.instance) { // prettier-ignore const { player, instance, options: { inactive } } = this - if (inactive) inactive(instance!, HlsPlugin.library) + if (inactive) inactive(instance, HlsPlugin.library) if (player.context.ui?.setting) removeSetting(player) instance.destroy() } diff --git a/packages/ui/package.json b/packages/ui/package.json index 249a3f9b..027e15d1 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -1,6 +1,6 @@ { "name": "@oplayer/ui", - "version": "1.2.34", + "version": "1.2.35.beta-0", "description": "ui plugin for oplayer", "type": "module", "main": "./dist/index.es.js",