-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Naive implementation to player state sync
- Loading branch information
1 parent
520fafe
commit 3080917
Showing
6 changed files
with
163 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,22 @@ | ||
import type { PlayerState } from "@echo/core-types"; | ||
import { Context, SubscriptionRef } from "effect"; | ||
import type { MediaPlayer, PlayerState } from "@echo/core-types"; | ||
import { Context, Option, SubscriptionRef } from "effect"; | ||
|
||
export type IPlayerStateRef = SubscriptionRef.SubscriptionRef<PlayerState>; | ||
|
||
/** | ||
* Tag that can provide a ref to the current state of the player. | ||
*/ | ||
export class PlayerStateRef extends Context.Tag( | ||
"@echo/services-player/PlayerStateRef", | ||
)<PlayerStateRef, SubscriptionRef.SubscriptionRef<PlayerState>>() {} | ||
)<PlayerStateRef, IPlayerStateRef>() {} | ||
|
||
export type ICurrentlyActivePlayerRef = SubscriptionRef.SubscriptionRef< | ||
Option.Option<MediaPlayer> | ||
>; | ||
|
||
/** | ||
* Tag that can provide a ref to the currently active media player, if any. | ||
*/ | ||
export class CurrentlyActivePlayerRef extends Context.Tag( | ||
"@echo/services-player/CurrentlyActivePlayerRef", | ||
)<CurrentlyActivePlayerRef, ICurrentlyActivePlayerRef>() {} |