refactor: Simplify cast availability logic to immediately show the cast button upon SDK load and update package version.

This commit is contained in:
kuekhaoyang
2026-02-17 09:29:28 +08:00
parent d1c601e362
commit b11463a347
3 changed files with 6 additions and 15 deletions
@@ -38,18 +38,9 @@ export function useCastControls({
autoJoinPolicy: window.chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED
});
// Monitor cast state
castContext.addEventListener(
window.cast.framework.CastContextEventType.CAST_STATE_CHANGED,
(event: any) => {
const state = event.castState;
setIsCastAvailable(state !== window.cast.framework.CastState.NO_DEVICES_AVAILABLE);
}
);
// Initial state check
const initialState = castContext.getCastState();
setIsCastAvailable(initialState !== window.cast.framework.CastState.NO_DEVICES_AVAILABLE);
// SDK loaded — show cast button immediately.
// requestSession() will re-scan and show Chrome's native device picker.
setIsCastAvailable(true);
// Monitor session state
castContext.addEventListener(
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "kvideo",
"version": "4.2.1",
"version": "4.2.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "kvideo",
"version": "4.2.1",
"version": "4.2.2",
"dependencies": {
"@dnd-kit/core": "^6.3.1",
"@dnd-kit/sortable": "^10.0.0",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "kvideo",
"version": "4.2.1",
"version": "4.2.2",
"private": true,
"scripts": {
"dev": "next dev",