From 96ab02b18b4cd68aa25b2c589e78a42dfa8c8ff1 Mon Sep 17 00:00:00 2001 From: Chase Adams Date: Thu, 1 Aug 2024 18:38:24 -0700 Subject: [PATCH] fix: fallback logic (#571) --- .changeset/olive-ways-train.md | 8 ++++ packages/core-react/package.json | 19 ++------- packages/core-web/package.json | 39 +++++-------------- .../core-web/src/media/controls/controller.ts | 6 +-- packages/core/package.json | 39 +++++-------------- packages/react/package.json | 36 ++++------------- 6 files changed, 41 insertions(+), 106 deletions(-) create mode 100644 .changeset/olive-ways-train.md diff --git a/.changeset/olive-ways-train.md b/.changeset/olive-ways-train.md new file mode 100644 index 00000000..10836547 --- /dev/null +++ b/.changeset/olive-ways-train.md @@ -0,0 +1,8 @@ +--- +"@livepeer/core-react": patch +"@livepeer/core-web": patch +"@livepeer/react": patch +"@livepeer/core": patch +--- + +**Fix:** fixed logic for falling back to HLS. diff --git a/packages/core-react/package.json b/packages/core-react/package.json index ad530c30..2fef7e8b 100644 --- a/packages/core-react/package.json +++ b/packages/core-react/package.json @@ -13,9 +13,7 @@ "main": "./dist/index.cjs", "module": "./dist/index.js", "types": "./dist/index.d.ts", - "files": [ - "dist" - ], + "files": ["dist"], "exports": { "./package.json": "./package.json", ".": { @@ -31,12 +29,8 @@ }, "typesVersions": { "*": { - "crypto": [ - "./dist/crypto/index.d.ts" - ], - "*": [ - "./dist/index.d.ts" - ] + "crypto": ["./dist/crypto/index.d.ts"], + "*": ["./dist/index.d.ts"] } }, "scripts": { @@ -61,10 +55,5 @@ "react": "^18.3.1", "react-dom": "^18.3.1" }, - "keywords": [ - "livepeer", - "video", - "streaming", - "livestream" - ] + "keywords": ["livepeer", "video", "streaming", "livestream"] } diff --git a/packages/core-web/package.json b/packages/core-web/package.json index ea1f7a02..4c610562 100644 --- a/packages/core-web/package.json +++ b/packages/core-web/package.json @@ -13,9 +13,7 @@ "main": "./dist/index.cjs", "module": "./dist/index.js", "types": "./dist/index.d.ts", - "files": [ - "dist" - ], + "files": ["dist"], "exports": { "./package.json": "./package.json", ".": { @@ -56,27 +54,13 @@ }, "typesVersions": { "*": { - "broadcast": [ - "./dist/broadcast/index.d.ts" - ], - "browser": [ - "./dist/browser/index.d.ts" - ], - "external": [ - "./dist/external/index.d.ts" - ], - "hls": [ - "./dist/hls/index.d.ts" - ], - "media": [ - "./dist/media/index.d.ts" - ], - "webrtc": [ - "./dist/webrtc/index.d.ts" - ], - "*": [ - "./dist/index.d.ts" - ] + "broadcast": ["./dist/broadcast/index.d.ts"], + "browser": ["./dist/browser/index.d.ts"], + "external": ["./dist/external/index.d.ts"], + "hls": ["./dist/hls/index.d.ts"], + "media": ["./dist/media/index.d.ts"], + "webrtc": ["./dist/webrtc/index.d.ts"], + "*": ["./dist/index.d.ts"] } }, "scripts": { @@ -90,10 +74,5 @@ "hls.js": "^1.5.8", "zustand": "^4.5.2" }, - "keywords": [ - "livepeer", - "video", - "streaming", - "livestream" - ] + "keywords": ["livepeer", "video", "streaming", "livestream"] } diff --git a/packages/core-web/src/media/controls/controller.ts b/packages/core-web/src/media/controls/controller.ts index 13b33d9a..81099185 100644 --- a/packages/core-web/src/media/controls/controller.ts +++ b/packages/core-web/src/media/controls/controller.ts @@ -442,11 +442,11 @@ const addEffectsToStore = ( } // Determine if fallback to HLS is necessary - const shouldFallBackToHLS = - !webrtcIsPossibleForOneTrack || metadata?.meta?.bframes !== 0; + const shouldNotFallBackToHLS = + webrtcIsPossibleForOneTrack || metadata?.meta?.bframes === 0; // If fallback to HLS is needed and component is not unmounted, handle the error - if (shouldFallBackToHLS && !unmounted) { + if (!shouldNotFallBackToHLS && !unmounted) { onErrorComposed(new Error(BFRAMES_ERROR_MESSAGE)); } }, diff --git a/packages/core/package.json b/packages/core/package.json index 0927eb09..56dc5112 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -13,9 +13,7 @@ "main": "./dist/index.cjs", "module": "./dist/index.js", "types": "./dist/index.d.ts", - "files": [ - "dist" - ], + "files": ["dist"], "exports": { "./package.json": "./package.json", ".": { @@ -56,27 +54,13 @@ }, "typesVersions": { "*": { - "crypto": [ - "./dist/crypto/index.d.ts" - ], - "errors": [ - "./dist/errors/index.d.ts" - ], - "media": [ - "./dist/media/index.d.ts" - ], - "storage": [ - "./dist/storage/index.d.ts" - ], - "utils": [ - "./dist/utils/index.d.ts" - ], - "version": [ - "./dist/version/index.d.ts" - ], - "*": [ - "./dist/index.d.ts" - ] + "crypto": ["./dist/crypto/index.d.ts"], + "errors": ["./dist/errors/index.d.ts"], + "media": ["./dist/media/index.d.ts"], + "storage": ["./dist/storage/index.d.ts"], + "utils": ["./dist/utils/index.d.ts"], + "version": ["./dist/version/index.d.ts"], + "*": ["./dist/index.d.ts"] } }, "scripts": { @@ -92,10 +76,5 @@ "devDependencies": { "jose": "^5.3.0" }, - "keywords": [ - "livepeer", - "video", - "streaming", - "livestream" - ] + "keywords": ["livepeer", "video", "streaming", "livestream"] } diff --git a/packages/react/package.json b/packages/react/package.json index 232c86bd..deb261af 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -13,9 +13,7 @@ "main": "./dist/index.cjs", "module": "./dist/index.js", "types": "./dist/index.d.ts", - "files": [ - "dist" - ], + "files": ["dist"], "exports": { "./package.json": "./package.json", ".": { @@ -51,24 +49,12 @@ }, "typesVersions": { "*": { - "assets": [ - "./dist/assets/index.d.ts" - ], - "broadcast": [ - "./dist/broadcast/index.d.ts" - ], - "crypto": [ - "./dist/crypto/index.d.ts" - ], - "external": [ - "./dist/external/index.d.ts" - ], - "player": [ - "./dist/player/index.d.ts" - ], - "*": [ - "./dist/index.d.ts" - ] + "assets": ["./dist/assets/index.d.ts"], + "broadcast": ["./dist/broadcast/index.d.ts"], + "crypto": ["./dist/crypto/index.d.ts"], + "external": ["./dist/external/index.d.ts"], + "player": ["./dist/player/index.d.ts"], + "*": ["./dist/index.d.ts"] } }, "scripts": { @@ -114,11 +100,5 @@ "react": "^18.3.1", "react-dom": "^18.3.1" }, - "keywords": [ - "livepeer", - "react", - "video", - "streaming", - "livestream" - ] + "keywords": ["livepeer", "react", "video", "streaming", "livestream"] }