mirror of
https://github.com/KuekHaoYang/KVideo.git
synced 2026-08-12 23:33:43 +08:00
refactor: Simplify cast availability logic to immediately show the cast button upon SDK load and update package version.
This commit is contained in:
@@ -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(
|
||||
|
||||
Generated
+2
-2
@@ -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
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "kvideo",
|
||||
"version": "4.2.1",
|
||||
"version": "4.2.2",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
|
||||
Reference in New Issue
Block a user