From d7ddf37808fc577f8ea48bed82a6e0ad9c813fd4 Mon Sep 17 00:00:00 2001 From: CY Date: Fri, 16 Aug 2024 16:07:36 +0800 Subject: [PATCH 1/7] fix failed to chrome casting --- packages/plugins/package.json | 2 +- packages/plugins/src/chromecast.ts | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/plugins/package.json b/packages/plugins/package.json index e81f5b35..91168e3b 100644 --- a/packages/plugins/package.json +++ b/packages/plugins/package.json @@ -1,6 +1,6 @@ { "name": "@oplayer/plugins", - "version": "1.0.13", + "version": "1.0.14-beta.0", "author": "shiyiya", "description": "oplayer's plugin", "homepage": "https://github.com/shiyiya/oplayer", diff --git a/packages/plugins/src/chromecast.ts b/packages/plugins/src/chromecast.ts index ebb5c779..bd4664fa 100644 --- a/packages/plugins/src/chromecast.ts +++ b/packages/plugins/src/chromecast.ts @@ -74,7 +74,7 @@ class ChromeCast implements PlayerPlugin { autoJoinPolicy: chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED, resumeSavedSession: true, androidReceiverCompatible: true, - ...this.options + ...this.options, }) const errorCode = await this.cast.requestSession() @@ -87,7 +87,11 @@ class ChromeCast implements PlayerPlugin { __buildRequest() { const { source, isLive } = this.player.options - const mediaInfo = new chrome.cast.media.MediaInfo(source.src, source.type || 'video/mp4') + + const mediaInfo = new chrome.cast.media.MediaInfo( + source.src, + !!this.player.context.hls ? 'application/x-mpegurl' : 'video/mp4' + ) mediaInfo.streamType = isLive ? chrome.cast.media.StreamType.LIVE : chrome.cast.media.StreamType.BUFFERED const metadata = new chrome.cast.media.GenericMediaMetadata() @@ -146,7 +150,7 @@ class ChromeCast implements PlayerPlugin { name: 'ChromeCast', position: 'top', icon: icons.chromecast || ICON, - onClick: () => this.start() + onClick: () => this.start(), }) } } From 1b7762d9b42e329703854a4642026a4297f87493 Mon Sep 17 00:00:00 2001 From: CY Date: Fri, 16 Aug 2024 16:17:04 +0800 Subject: [PATCH 2/7] --- packages/docs/src/pages/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/docs/src/pages/index.mdx b/packages/docs/src/pages/index.mdx index 27799fad..5c4e7704 100644 --- a/packages/docs/src/pages/index.mdx +++ b/packages/docs/src/pages/index.mdx @@ -55,7 +55,7 @@ import { Playlist, Chromecast, AirPlay } from '@oplayer/plugins' hls({ forceHLS: true }), dash(), mpegts(), - !isMobile && danmaku({ enable: true, fontSize: 0.75, displaySender: false }), + danmaku({ enable: !isMobile, fontSize: 0.75, displaySender: false }), new Playlist({ initialIndex: 0, autoNext: true, From 8ed15a9717db3f8fcd31ac106e3f5d4569736865 Mon Sep 17 00:00:00 2001 From: CY Date: Sat, 17 Aug 2024 08:41:51 +0000 Subject: [PATCH 3/7] --- packages/plugins/src/chromecast.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/plugins/src/chromecast.ts b/packages/plugins/src/chromecast.ts index bd4664fa..aec4588c 100644 --- a/packages/plugins/src/chromecast.ts +++ b/packages/plugins/src/chromecast.ts @@ -74,7 +74,7 @@ class ChromeCast implements PlayerPlugin { autoJoinPolicy: chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED, resumeSavedSession: true, androidReceiverCompatible: true, - ...this.options, + ...this.options }) const errorCode = await this.cast.requestSession() @@ -90,7 +90,7 @@ class ChromeCast implements PlayerPlugin { const mediaInfo = new chrome.cast.media.MediaInfo( source.src, - !!this.player.context.hls ? 'application/x-mpegurl' : 'video/mp4' + this.player.loader.key == 'hls' ? 'application/x-mpegurl' : 'video/mp4' ) mediaInfo.streamType = isLive ? chrome.cast.media.StreamType.LIVE : chrome.cast.media.StreamType.BUFFERED @@ -150,7 +150,7 @@ class ChromeCast implements PlayerPlugin { name: 'ChromeCast', position: 'top', icon: icons.chromecast || ICON, - onClick: () => this.start(), + onClick: () => this.start() }) } } From 5b1798e9e290abd13a2ebd8cd0149f7f4c765aca Mon Sep 17 00:00:00 2001 From: CY Date: Sat, 17 Aug 2024 19:42:51 +0800 Subject: [PATCH 4/7] --- packages/plugins/src/chromecast.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/plugins/src/chromecast.ts b/packages/plugins/src/chromecast.ts index aec4588c..044a1bfe 100644 --- a/packages/plugins/src/chromecast.ts +++ b/packages/plugins/src/chromecast.ts @@ -74,7 +74,7 @@ class ChromeCast implements PlayerPlugin { autoJoinPolicy: chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED, resumeSavedSession: true, androidReceiverCompatible: true, - ...this.options + ...this.options, }) const errorCode = await this.cast.requestSession() @@ -92,6 +92,7 @@ class ChromeCast implements PlayerPlugin { source.src, this.player.loader.key == 'hls' ? 'application/x-mpegurl' : 'video/mp4' ) + ;(mediaInfo as any).contentUrl = source.src mediaInfo.streamType = isLive ? chrome.cast.media.StreamType.LIVE : chrome.cast.media.StreamType.BUFFERED const metadata = new chrome.cast.media.GenericMediaMetadata() @@ -150,7 +151,7 @@ class ChromeCast implements PlayerPlugin { name: 'ChromeCast', position: 'top', icon: icons.chromecast || ICON, - onClick: () => this.start() + onClick: () => this.start(), }) } } From e88dc1aa8bcc265c6443c0928e87a9f411c8f89f Mon Sep 17 00:00:00 2001 From: CY Date: Sat, 17 Aug 2024 11:45:04 +0000 Subject: [PATCH 5/7] --- packages/plugins/src/chromecast.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/plugins/src/chromecast.ts b/packages/plugins/src/chromecast.ts index 044a1bfe..0944326e 100644 --- a/packages/plugins/src/chromecast.ts +++ b/packages/plugins/src/chromecast.ts @@ -90,7 +90,7 @@ class ChromeCast implements PlayerPlugin { const mediaInfo = new chrome.cast.media.MediaInfo( source.src, - this.player.loader.key == 'hls' ? 'application/x-mpegurl' : 'video/mp4' + this.player.loader?.key == 'hls' ? 'application/x-mpegurl' : 'video/mp4' ) ;(mediaInfo as any).contentUrl = source.src mediaInfo.streamType = isLive ? chrome.cast.media.StreamType.LIVE : chrome.cast.media.StreamType.BUFFERED From 31e70004ff160ffc07b9b77ce7cbdff8d8951d48 Mon Sep 17 00:00:00 2001 From: CY Date: Sat, 17 Aug 2024 11:51:46 +0000 Subject: [PATCH 6/7] --- .github/workflows/ci.yml | 8 ++++---- .github/workflows/compressed-size.yml | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c2b688a8..74efe245 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,17 +16,17 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout code repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: setup node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 20.x - name: load cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | ~/.pnpm-store @@ -34,7 +34,7 @@ jobs: restore-keys: | ${{ runner.os }} - - uses: pnpm/action-setup@v2 + - uses: pnpm/action-setup@v4 with: version: latest run_install: true diff --git a/.github/workflows/compressed-size.yml b/.github/workflows/compressed-size.yml index 2df6e831..66aab5ab 100644 --- a/.github/workflows/compressed-size.yml +++ b/.github/workflows/compressed-size.yml @@ -20,15 +20,15 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: setup node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 20.x - name: Install pnpm - uses: pnpm/action-setup@v2.2.4 + uses: pnpm/action-setup@v4 with: version: latest run_install: false @@ -38,7 +38,7 @@ jobs: run: | echo "::set-output name=pnpm_cache_dir::$(pnpm store path)" - - uses: actions/cache@v3 + - uses: actions/cache@v4 name: Setup pnpm cache with: path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }} From 82e2d82836f92c5aa8d15605c401ecaef9791ed0 Mon Sep 17 00:00:00 2001 From: CY Date: Sat, 17 Aug 2024 11:53:37 +0000 Subject: [PATCH 7/7] --- packages/plugins/src/chromecast.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/plugins/src/chromecast.ts b/packages/plugins/src/chromecast.ts index 0944326e..c6afdc76 100644 --- a/packages/plugins/src/chromecast.ts +++ b/packages/plugins/src/chromecast.ts @@ -16,7 +16,7 @@ export interface ChromeCastOptions { androidReceiverCompatible?: boolean | undefined } -class ChromeCast implements PlayerPlugin { +class Chromecast implements PlayerPlugin { readonly name = 'oplayer-plugin-chromecast' readonly version = __VERSION__ @@ -74,7 +74,7 @@ class ChromeCast implements PlayerPlugin { autoJoinPolicy: chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED, resumeSavedSession: true, androidReceiverCompatible: true, - ...this.options, + ...this.options }) const errorCode = await this.cast.requestSession() @@ -148,12 +148,12 @@ class ChromeCast implements PlayerPlugin { const { menu, icons } = this.player.context.ui menu?.register({ - name: 'ChromeCast', + name: 'Chromecast', position: 'top', icon: icons.chromecast || ICON, - onClick: () => this.start(), + onClick: () => this.start() }) } } -export default ChromeCast +export default Chromecast