@behindthemusictree/app-kit 33.0.0 → 33.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-A6GKSUJA.js → chunk-4TE4OSOM.js} +54 -16
- package/dist/chunk-4TE4OSOM.js.map +1 -0
- package/dist/{chunk-JRUPUUYV.js → chunk-727PIKKR.js} +333 -124
- package/dist/chunk-727PIKKR.js.map +1 -0
- package/dist/{chunk-5NTNMBJP.js → chunk-HLAKW2YJ.js} +1 -1
- package/dist/{chunk-XCOAWKF6.js → chunk-MAKY4YBN.js} +118 -24
- package/dist/chunk-MAKY4YBN.js.map +1 -0
- package/dist/chunk-W4QTTNNA.js +94 -0
- package/dist/chunk-W4QTTNNA.js.map +1 -0
- package/dist/genre-tree/index.cjs +606 -327
- package/dist/genre-tree/index.cjs.map +1 -1
- package/dist/genre-tree/index.d.ts +173 -4
- package/dist/genre-tree/index.js +38 -3
- package/dist/index.cjs +880 -439
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +46 -4
- package/dist/player/index.cjs +167 -60
- package/dist/player/index.cjs.map +1 -1
- package/dist/player/index.d.ts +8 -0
- package/dist/player/index.js +2 -1
- package/dist/transport/index.cjs +176 -47
- package/dist/transport/index.cjs.map +1 -1
- package/dist/transport/index.d.ts +23 -3
- package/dist/transport/index.js +10 -2
- package/package.json +1 -1
- package/dist/chunk-A6GKSUJA.js.map +0 -1
- package/dist/chunk-JRUPUUYV.js.map +0 -1
- package/dist/chunk-XCOAWKF6.js.map +0 -1
- /package/dist/{chunk-5NTNMBJP.js.map → chunk-HLAKW2YJ.js.map} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export { A as AppError, a as AppErrorType, b as AuthRequired, B as BackendError, c as BackendSpotifyUserNotAllowlistedError, d as BadRequestError, C as ClientError, e as ConnectivityError, I as InvalidInputError, N as NetworkError, S as ServiceError } from './app-error-B8IoFBhD.js';
|
|
2
2
|
export { E as ErrorCode } from './app-error-codes-D5eYg7xR.js';
|
|
3
|
-
export { BuildBackendBaseUrlParams, BuildSubdomainBaseUrlParams, ConnectivityErrorProvider, ConnectivityErrorType, ErrorMessages, PaginatedResponse, PaginatedResponseSchema, buildBackendBaseUrl, buildSubdomainBaseUrl, createAppErrorFromErrorCode, createAppErrorFromResult, createNetworkOrBackendError, fetchWrapper, getSpotifyAllowlistMailtoHref, getSpotifyAllowlistMessage, parseWithLog, queryClient, useConnectivityError, useFetchWrapper, useQueryWithParse, useValidatedMutation } from './transport/index.js';
|
|
3
|
+
export { BuildBackendBaseUrlParams, BuildSubdomainBaseUrlParams, ConnectivityErrorProvider, ConnectivityErrorType, ErrorMessages, PaginatedResponse, PaginatedResponseSchema, PlaybackContextProvider, PlaybackContextSchema, buildBackendBaseUrl, buildSubdomainBaseUrl, createAppErrorFromErrorCode, createAppErrorFromResult, createNetworkOrBackendError, fetchWrapper, getSpotifyAllowlistMailtoHref, getSpotifyAllowlistMessage, parseWithLog, queryClient, useConnectivityError, useFetchWrapper, usePlaybackContext, useQueryWithParse, useValidatedMutation } from './transport/index.js';
|
|
4
4
|
export { S as Scope } from './scope-BoMVOHmz.js';
|
|
5
5
|
export { AuthCallbackState, AuthCallbackStatus, BackendAuthResponse, ExchangeCodeConfig, GOOGLE_EXCHANGE_CONFIG, SPOTIFY_EXCHANGE_CONFIG, Session, SessionProvider, UseAuthCallbackOptions, clearSpotifyRequiredCached, clearStoredRedirectUrl, createLogout, exchangeCodeWithBackend, getSpotifyRequiredCached, resolveRedirectUri, setSpotifyRequiredCached, storeRedirectUrl, useAuthCallback, useLogout, useSession } from './auth/index.js';
|
|
6
6
|
export { AUTH_POPUP_TYPE, ConnectivityErrorPopupRenderers, PopupProvider, TrackUploadItem, UploadStatus, UseConnectivityErrorPopupOptions, UseTrackUploadOptions, UseTrackUploadResult, useConnectivityErrorPopup, usePopup, useTrackUpload } from './popup/index.js';
|
|
7
7
|
export { TrackNoun, TrackNounProvider, capitalize, useTrackNoun } from './track-noun/index.js';
|
|
8
8
|
export { AudioMediaController, AudioPlayerTrack, MediaController, PlayStates, PlayerProvider, PlayerTrack, PlayerTrackArtist, PlayerTrackEndEvent, PlayerTrackEndHandler, PlayerVideoSurface, YoutubeMediaController, YoutubePlayerTrack, useCurrentTime, usePlayer } from './player/index.js';
|
|
9
|
-
export { ARTIST_LINK_KINDS, AlbumMinimum, AlbumMinimumSchema, ArtistAlbum, ArtistDetailed, ArtistDetailedSchema, ArtistGenreCount, ArtistGenreCountSchema, ArtistImage, ArtistImageSchema, ArtistLink, ArtistMembership, ArtistMinimum, ArtistMinimumSchema, ArtistNames, ArtistSearchResult, ArtistSearchResultSchema, ArtistSearchResultsSchema, ArtistSongsOrdering, ArtistTrackListOriginInput, CriteriaCreationSchema, CriteriaCreationValues, CriteriaDetailed, CriteriaDetailedSchema, CriteriaLineageRelWithoutAscendant, CriteriaLineageRelWithoutAscendantSchema, CriteriaLineageRelWithoutDescendant, CriteriaLineageRelWithoutDescendantSchema, CriteriaMinimum, CriteriaMinimumSchema, CriteriaOverview, CriteriaOverviewSchema, CriteriaPlaylistDetailed, CriteriaPlaylistDetailedSchema, CriteriaPlaylistMinimum, CriteriaPlaylistMinimumSchema, CriteriaPlaylistSimple, CriteriaPlaylistSimpleSchema, CriteriaSimple, CriteriaSimpleSchema, CriteriaUpdateSchema, CriteriaUpdateValues, FORM_RATING_NULL_VALUE, GenrePlaylistTracksPage, GenreViewMode, MbArtistDetailedSchema, MbRecordingDetailedSchema, MusicbrainzArtistDetailed, MusicbrainzRecordingDetailed, NO_VIDEO_LABEL, PlayArtistOptions, PlayGenrePlaylistOptions, RenderArtistLink, RenderSongLink, ReparentCandidate, SongDetailed, SongDetailedSchema, SongHistoryEntry, SongHistoryEntrySchema, SongHistorySchema, SongSearchGenreFilter, SongSearchParams, SongSearchResult, SongSearchResultSchema, SongSearchResultsSchema, TrackBase, TrackBaseSchema, TrackList, TrackListFromArtist, TrackListFromCriteriaPlaylist, TrackListFromTrack, TrackListOrigin, TrackListOriginFromArtist, TrackListOriginFromCriteriaPlaylist, TrackListOriginFromTrack, TrackListOriginType, TrackListProvider, TrackListSidebarVisibilityProvider, TrackMinimum, TrackMinimumSchema, TrackPlaylistRel, UseArtistResult, UseArtistSearchResult, UseGenreSearchOptions, UseGenreSearchResult, UseGenreTreeViewStateOptions, UseGenreTreeViewStateResult, UseSongHistoryResult, UseSongResult, UseSongSearchResult, UseVisibleGenrePlaylistsOptions, UuidResource, UuidResourceSchema, YOUTUBE_UNPLAYABLE_REASON_LABELS, YoutubeUnplayableReason, artistEndpoints, artistQueryKeys, capitalizeFirstLetter, editGenreSongPages, formatTime, genreEndpoints, genrePlaylistEndpoints, genrePlaylistQueryKeys, genreQueryKeys, genreUpdateMutationKey, getGenrePlaylistsGroupedByRoot, getReparentCandidates, hasMainstreamPopRoot, isSong, isSongSearchResultPlayable, libraryEndpoints, libraryQueryKeys, makeTrackPlaylistRelPageSchema, makeTrackPlaylistRelSchema, musicBrainzRecordingUrl, pruneGenrePlaylistsForArtist, searchGenrePlaylistsByName, songUnplayableReason, useArtist, useArtistGenreCounts, useArtistSearch, useCreateGenre, useDeleteGenre, useFetchGenre, useFetchGenreDetail, useFetchGenreOverview, useFetchGenrePlaylist, useGenreByWikidataId, useGenreSearch, useGenreTreeViewState, useInvalidateAllGenrePlaylistQueries, useListFullGenrePlaylists, useListGenrePlaylists, useListGenres, useListTracks, usePrefetchGenreOverview, useSong, useSongHistory, useSongSearch, useTrackList, useTrackListSidebarVisibility, useUpdateGenre, useVisibleGenrePlaylists } from './genre-tree/index.js';
|
|
9
|
+
export { ARTIST_LINK_KINDS, AlbumMinimum, AlbumMinimumSchema, ArtistAlbum, ArtistDetailed, ArtistDetailedSchema, ArtistGenreCount, ArtistGenreCountSchema, ArtistImage, ArtistImageSchema, ArtistLink, ArtistMembership, ArtistMinimum, ArtistMinimumSchema, ArtistNames, ArtistSearchResult, ArtistSearchResultSchema, ArtistSearchResultsSchema, ArtistSongsOrdering, ArtistTrackListOriginInput, CriteriaCreationSchema, CriteriaCreationValues, CriteriaDetailed, CriteriaDetailedSchema, CriteriaLineageRelWithoutAscendant, CriteriaLineageRelWithoutAscendantSchema, CriteriaLineageRelWithoutDescendant, CriteriaLineageRelWithoutDescendantSchema, CriteriaMinimum, CriteriaMinimumSchema, CriteriaOverview, CriteriaOverviewSchema, CriteriaPlaylistDetailed, CriteriaPlaylistDetailedSchema, CriteriaPlaylistMinimum, CriteriaPlaylistMinimumSchema, CriteriaPlaylistSimple, CriteriaPlaylistSimpleSchema, CriteriaSimple, CriteriaSimpleSchema, CriteriaUpdateSchema, CriteriaUpdateValues, FORM_RATING_NULL_VALUE, FUZZY_MIN_SIMILARITY, GenrePlaylistTracksPage, GenreSearchParams, GenreSearchResult, GenreSearchResultSchema, GenreSearchResultsSchema, GenreSearchTreeName, GenreSearchTreeNameSchema, GenreViewMode, MbArtistDetailedSchema, MbRecordingDetailedSchema, MusicbrainzArtistDetailed, MusicbrainzRecordingDetailed, NO_VIDEO_LABEL, PlayArtistOptions, PlayGenrePlaylistOptions, RegionGenreLexiconEntry, RegionGenreLexiconEntrySchema, RegionGenreLexiconSchema, RenderArtistLink, RenderSongLink, ReparentCandidate, SEARCH_DEBOUNCE_MS, SEARCH_QUERY_MIN_LENGTH, SongDetailed, SongDetailedSchema, SongHistoryEntry, SongHistoryEntrySchema, SongHistorySchema, SongSearchGenreFilter, SongSearchParams, SongSearchResult, SongSearchResultSchema, SongSearchResultsSchema, TrackBase, TrackBaseSchema, TrackList, TrackListFromArtist, TrackListFromCriteriaPlaylist, TrackListFromTrack, TrackListOrigin, TrackListOriginFromArtist, TrackListOriginFromCriteriaPlaylist, TrackListOriginFromTrack, TrackListOriginType, TrackListProvider, TrackListSidebarVisibilityProvider, TrackMinimum, TrackMinimumSchema, TrackPlaylistRel, UseArtistResult, UseArtistSearchResult, UseGenreRemoteSearchOptions, UseGenreRemoteSearchResult, UseGenreSearchOptions, UseGenreSearchResult, UseGenreTreeViewStateOptions, UseGenreTreeViewStateResult, UseRemoteSearchOptions, UseRemoteSearchResult, UseSearchQueryStateOptions, UseSearchQueryStateResult, UseSongHistoryResult, UseSongResult, UseSongSearchResult, UseVisibleGenrePlaylistsOptions, UuidResource, UuidResourceSchema, YOUTUBE_UNPLAYABLE_REASON_LABELS, YoutubeAvailabilitySchema, YoutubeUnplayableReason, artistEndpoints, artistQueryKeys, capitalizeFirstLetter, editGenreSongPages, foldSearchText, formatTime, genreEndpoints, genrePlaylistEndpoints, genrePlaylistQueryKeys, genreQueryKeys, genreSearchQueryKeys, genreUpdateMutationKey, getGenrePlaylistsGroupedByRoot, getReparentCandidates, hasMainstreamPopRoot, isSong, isSongSearchResultPlayable, libraryEndpoints, libraryQueryKeys, makeTrackPlaylistRelPageSchema, makeTrackPlaylistRelSchema, musicBrainzRecordingUrl, pruneGenrePlaylistsForArtist, rankByName, searchGenrePlaylistsByName, songUnplayableReason, trigramSimilarity, useArtist, useArtistGenreCounts, useArtistSearch, useCreateGenre, useDeleteGenre, useFetchGenre, useFetchGenreDetail, useFetchGenreOverview, useFetchGenrePlaylist, useGenreByWikidataId, useGenreRemoteSearch, useGenreSearch, useGenreTreeViewState, useInvalidateAllGenrePlaylistQueries, useListFullGenrePlaylists, useListGenrePlaylists, useListGenres, useListTracks, usePrefetchGenreOverview, useRegionGenreLexicon, useRemoteSearch, useSearchQueryState, useSong, useSongHistory, useSongSearch, useTrackList, useTrackListSidebarVisibility, useUpdateGenre, useVisibleGenrePlaylists } from './genre-tree/index.js';
|
|
10
10
|
export { G as GenrePlaylistUuid, a as GenrePlaylistUuidSchema, b as GenreUuid, c as GenreUuidSchema } from './ids-D8XCErUS.js';
|
|
11
11
|
import '@tanstack/react-query';
|
|
12
12
|
import 'react';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildBackendBaseUrl,
|
|
3
3
|
buildSubdomainBaseUrl
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-HLAKW2YJ.js";
|
|
5
5
|
import {
|
|
6
6
|
GOOGLE_EXCHANGE_CONFIG,
|
|
7
7
|
SPOTIFY_EXCHANGE_CONFIG,
|
|
@@ -48,9 +48,17 @@ import {
|
|
|
48
48
|
CriteriaSimpleSchema,
|
|
49
49
|
CriteriaUpdateSchema,
|
|
50
50
|
FORM_RATING_NULL_VALUE,
|
|
51
|
+
FUZZY_MIN_SIMILARITY,
|
|
52
|
+
GenreSearchResultSchema,
|
|
53
|
+
GenreSearchResultsSchema,
|
|
54
|
+
GenreSearchTreeNameSchema,
|
|
51
55
|
MbArtistDetailedSchema,
|
|
52
56
|
MbRecordingDetailedSchema,
|
|
53
57
|
NO_VIDEO_LABEL,
|
|
58
|
+
RegionGenreLexiconEntrySchema,
|
|
59
|
+
RegionGenreLexiconSchema,
|
|
60
|
+
SEARCH_DEBOUNCE_MS,
|
|
61
|
+
SEARCH_QUERY_MIN_LENGTH,
|
|
54
62
|
SongDetailedSchema,
|
|
55
63
|
SongHistoryEntrySchema,
|
|
56
64
|
SongHistorySchema,
|
|
@@ -71,15 +79,18 @@ import {
|
|
|
71
79
|
TrackMinimumSchema,
|
|
72
80
|
UuidResourceSchema,
|
|
73
81
|
YOUTUBE_UNPLAYABLE_REASON_LABELS,
|
|
82
|
+
YoutubeAvailabilitySchema,
|
|
74
83
|
artistEndpoints,
|
|
75
84
|
artistQueryKeys,
|
|
76
85
|
capitalizeFirstLetter,
|
|
77
86
|
editGenreSongPages,
|
|
87
|
+
foldSearchText,
|
|
78
88
|
formatTime,
|
|
79
89
|
genreEndpoints,
|
|
80
90
|
genrePlaylistEndpoints,
|
|
81
91
|
genrePlaylistQueryKeys,
|
|
82
92
|
genreQueryKeys,
|
|
93
|
+
genreSearchQueryKeys,
|
|
83
94
|
genreUpdateMutationKey,
|
|
84
95
|
getGenrePlaylistsGroupedByRoot,
|
|
85
96
|
getReparentCandidates,
|
|
@@ -92,8 +103,10 @@ import {
|
|
|
92
103
|
makeTrackPlaylistRelSchema,
|
|
93
104
|
musicBrainzRecordingUrl,
|
|
94
105
|
pruneGenrePlaylistsForArtist,
|
|
106
|
+
rankByName,
|
|
95
107
|
searchGenrePlaylistsByName,
|
|
96
108
|
songUnplayableReason,
|
|
109
|
+
trigramSimilarity,
|
|
97
110
|
useArtist,
|
|
98
111
|
useArtistGenreCounts,
|
|
99
112
|
useArtistSearch,
|
|
@@ -104,6 +117,7 @@ import {
|
|
|
104
117
|
useFetchGenreOverview,
|
|
105
118
|
useFetchGenrePlaylist,
|
|
106
119
|
useGenreByWikidataId,
|
|
120
|
+
useGenreRemoteSearch,
|
|
107
121
|
useGenreSearch,
|
|
108
122
|
useGenreTreeViewState,
|
|
109
123
|
useInvalidateAllGenrePlaylistQueries,
|
|
@@ -112,6 +126,9 @@ import {
|
|
|
112
126
|
useListGenres,
|
|
113
127
|
useListTracks,
|
|
114
128
|
usePrefetchGenreOverview,
|
|
129
|
+
useRegionGenreLexicon,
|
|
130
|
+
useRemoteSearch,
|
|
131
|
+
useSearchQueryState,
|
|
115
132
|
useSong,
|
|
116
133
|
useSongHistory,
|
|
117
134
|
useSongSearch,
|
|
@@ -119,7 +136,7 @@ import {
|
|
|
119
136
|
useTrackListSidebarVisibility,
|
|
120
137
|
useUpdateGenre,
|
|
121
138
|
useVisibleGenrePlaylists
|
|
122
|
-
} from "./chunk-
|
|
139
|
+
} from "./chunk-727PIKKR.js";
|
|
123
140
|
import {
|
|
124
141
|
ConnectivityErrorType,
|
|
125
142
|
PaginatedResponseSchema,
|
|
@@ -128,7 +145,7 @@ import {
|
|
|
128
145
|
useFetchWrapper,
|
|
129
146
|
useQueryWithParse,
|
|
130
147
|
useValidatedMutation
|
|
131
|
-
} from "./chunk-
|
|
148
|
+
} from "./chunk-4TE4OSOM.js";
|
|
132
149
|
import {
|
|
133
150
|
SessionProvider,
|
|
134
151
|
clearSpotifyRequiredCached,
|
|
@@ -166,7 +183,12 @@ import {
|
|
|
166
183
|
YoutubeMediaController,
|
|
167
184
|
useCurrentTime,
|
|
168
185
|
usePlayer
|
|
169
|
-
} from "./chunk-
|
|
186
|
+
} from "./chunk-MAKY4YBN.js";
|
|
187
|
+
import {
|
|
188
|
+
PlaybackContextProvider,
|
|
189
|
+
PlaybackContextSchema,
|
|
190
|
+
usePlaybackContext
|
|
191
|
+
} from "./chunk-W4QTTNNA.js";
|
|
170
192
|
import {
|
|
171
193
|
GenrePlaylistUuidSchema,
|
|
172
194
|
GenreUuidSchema
|
|
@@ -206,8 +228,12 @@ export {
|
|
|
206
228
|
ErrorCode,
|
|
207
229
|
ErrorMessages,
|
|
208
230
|
FORM_RATING_NULL_VALUE,
|
|
231
|
+
FUZZY_MIN_SIMILARITY,
|
|
209
232
|
GOOGLE_EXCHANGE_CONFIG,
|
|
210
233
|
GenrePlaylistUuidSchema,
|
|
234
|
+
GenreSearchResultSchema,
|
|
235
|
+
GenreSearchResultsSchema,
|
|
236
|
+
GenreSearchTreeNameSchema,
|
|
211
237
|
GenreUuidSchema,
|
|
212
238
|
InvalidInputError,
|
|
213
239
|
MbArtistDetailedSchema,
|
|
@@ -216,9 +242,15 @@ export {
|
|
|
216
242
|
NetworkError,
|
|
217
243
|
PaginatedResponseSchema,
|
|
218
244
|
PlayStates,
|
|
245
|
+
PlaybackContextProvider,
|
|
246
|
+
PlaybackContextSchema,
|
|
219
247
|
PlayerProvider,
|
|
220
248
|
PlayerVideoSurface,
|
|
221
249
|
PopupProvider,
|
|
250
|
+
RegionGenreLexiconEntrySchema,
|
|
251
|
+
RegionGenreLexiconSchema,
|
|
252
|
+
SEARCH_DEBOUNCE_MS,
|
|
253
|
+
SEARCH_QUERY_MIN_LENGTH,
|
|
222
254
|
SPOTIFY_EXCHANGE_CONFIG,
|
|
223
255
|
ServiceError,
|
|
224
256
|
SessionProvider,
|
|
@@ -243,6 +275,7 @@ export {
|
|
|
243
275
|
TrackNounProvider,
|
|
244
276
|
UuidResourceSchema,
|
|
245
277
|
YOUTUBE_UNPLAYABLE_REASON_LABELS,
|
|
278
|
+
YoutubeAvailabilitySchema,
|
|
246
279
|
YoutubeMediaController,
|
|
247
280
|
artistEndpoints,
|
|
248
281
|
artistQueryKeys,
|
|
@@ -259,11 +292,13 @@ export {
|
|
|
259
292
|
editGenreSongPages,
|
|
260
293
|
exchangeCodeWithBackend,
|
|
261
294
|
fetchWrapper,
|
|
295
|
+
foldSearchText,
|
|
262
296
|
formatTime,
|
|
263
297
|
genreEndpoints,
|
|
264
298
|
genrePlaylistEndpoints,
|
|
265
299
|
genrePlaylistQueryKeys,
|
|
266
300
|
genreQueryKeys,
|
|
301
|
+
genreSearchQueryKeys,
|
|
267
302
|
genreUpdateMutationKey,
|
|
268
303
|
getGenrePlaylistsGroupedByRoot,
|
|
269
304
|
getReparentCandidates,
|
|
@@ -281,11 +316,13 @@ export {
|
|
|
281
316
|
parseWithLog,
|
|
282
317
|
pruneGenrePlaylistsForArtist,
|
|
283
318
|
queryClient,
|
|
319
|
+
rankByName,
|
|
284
320
|
resolveRedirectUri,
|
|
285
321
|
searchGenrePlaylistsByName,
|
|
286
322
|
setSpotifyRequiredCached,
|
|
287
323
|
songUnplayableReason,
|
|
288
324
|
storeRedirectUrl,
|
|
325
|
+
trigramSimilarity,
|
|
289
326
|
useArtist,
|
|
290
327
|
useArtistGenreCounts,
|
|
291
328
|
useArtistSearch,
|
|
@@ -301,6 +338,7 @@ export {
|
|
|
301
338
|
useFetchGenrePlaylist,
|
|
302
339
|
useFetchWrapper,
|
|
303
340
|
useGenreByWikidataId,
|
|
341
|
+
useGenreRemoteSearch,
|
|
304
342
|
useGenreSearch,
|
|
305
343
|
useGenreTreeViewState,
|
|
306
344
|
useInvalidateAllGenrePlaylistQueries,
|
|
@@ -309,10 +347,14 @@ export {
|
|
|
309
347
|
useListGenres,
|
|
310
348
|
useListTracks,
|
|
311
349
|
useLogout,
|
|
350
|
+
usePlaybackContext,
|
|
312
351
|
usePlayer,
|
|
313
352
|
usePopup,
|
|
314
353
|
usePrefetchGenreOverview,
|
|
315
354
|
useQueryWithParse,
|
|
355
|
+
useRegionGenreLexicon,
|
|
356
|
+
useRemoteSearch,
|
|
357
|
+
useSearchQueryState,
|
|
316
358
|
useSession,
|
|
317
359
|
useSong,
|
|
318
360
|
useSongHistory,
|
package/dist/player/index.cjs
CHANGED
|
@@ -40,7 +40,53 @@ var PlayStates = /* @__PURE__ */ ((PlayStates2) => {
|
|
|
40
40
|
})(PlayStates || {});
|
|
41
41
|
|
|
42
42
|
// src/player/PlayerContext.tsx
|
|
43
|
+
var import_react2 = require("react");
|
|
44
|
+
|
|
45
|
+
// src/player/PlaybackFailures.ts
|
|
46
|
+
var TTL_MS = 10 * 6e4;
|
|
47
|
+
var MAX_ENTRIES = 200;
|
|
48
|
+
var PlaybackFailures = class {
|
|
49
|
+
entries = /* @__PURE__ */ new Map();
|
|
50
|
+
key(videoId, context) {
|
|
51
|
+
return JSON.stringify([context, videoId]);
|
|
52
|
+
}
|
|
53
|
+
has(videoId, context, now = Date.now()) {
|
|
54
|
+
const key = this.key(videoId, context);
|
|
55
|
+
const expires = this.entries.get(key);
|
|
56
|
+
if (expires === void 0) return false;
|
|
57
|
+
if (expires <= now) {
|
|
58
|
+
this.entries.delete(key);
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
add(videoId, context, now = Date.now()) {
|
|
64
|
+
const key = this.key(videoId, context);
|
|
65
|
+
this.entries.delete(key);
|
|
66
|
+
this.entries.set(key, now + TTL_MS);
|
|
67
|
+
while (this.entries.size > MAX_ENTRIES) this.entries.delete(this.entries.keys().next().value);
|
|
68
|
+
}
|
|
69
|
+
clear() {
|
|
70
|
+
this.entries.clear();
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
// src/transport/PlaybackContext.tsx
|
|
43
75
|
var import_react = require("react");
|
|
76
|
+
var import_zod = require("zod");
|
|
77
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
78
|
+
var PlaybackContextSchema = import_zod.z.object({ country: import_zod.z.string().regex(/^[A-Z]{2}$/).nullable() });
|
|
79
|
+
var unmanaged = {
|
|
80
|
+
country: null,
|
|
81
|
+
key: null,
|
|
82
|
+
ready: true,
|
|
83
|
+
error: null,
|
|
84
|
+
isCurrent: (_key) => true,
|
|
85
|
+
snapshot: () => ({ key: null, country: null }),
|
|
86
|
+
refresh: async (_force = false) => null
|
|
87
|
+
};
|
|
88
|
+
var PlaybackContext = (0, import_react.createContext)(unmanaged);
|
|
89
|
+
var usePlaybackContext = () => (0, import_react.useContext)(PlaybackContext);
|
|
44
90
|
|
|
45
91
|
// src/player/MediaController.ts
|
|
46
92
|
var AudioMediaController = class {
|
|
@@ -120,43 +166,50 @@ function loadYoutubeIframeApi() {
|
|
|
120
166
|
}
|
|
121
167
|
|
|
122
168
|
// src/player/PlayerContext.tsx
|
|
123
|
-
var
|
|
124
|
-
var isPlayable = (track) => track.kind !== "youtube" || !track.unplayableReason;
|
|
169
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
170
|
+
var isPlayable = (track) => track.kind !== "youtube" || !track.unplayableReason && track.availability?.status !== "blocked";
|
|
125
171
|
function youtubeErrorMessage(code) {
|
|
172
|
+
if (code === 153) return "YouTube player configuration error. Retry playback.";
|
|
126
173
|
if (code === 100) return "Video not found";
|
|
127
174
|
if (code === 101 || code === 150) return "Embedding disabled by the video owner";
|
|
128
175
|
return `YouTube playback error (code ${code})`;
|
|
129
176
|
}
|
|
130
|
-
var PlayerContext = (0,
|
|
177
|
+
var PlayerContext = (0, import_react2.createContext)(void 0);
|
|
131
178
|
function PlayerProvider({ children, loadTrack }) {
|
|
132
|
-
const
|
|
133
|
-
const
|
|
134
|
-
const
|
|
135
|
-
const
|
|
136
|
-
const
|
|
137
|
-
const
|
|
138
|
-
const [
|
|
139
|
-
const [
|
|
140
|
-
const
|
|
179
|
+
const playback = usePlaybackContext();
|
|
180
|
+
const failures = (0, import_react2.useRef)(new PlaybackFailures());
|
|
181
|
+
const generation = (0, import_react2.useRef)(0);
|
|
182
|
+
const loadedPlaybackKey = (0, import_react2.useRef)(playback.key);
|
|
183
|
+
const terminal = (0, import_react2.useRef)(false);
|
|
184
|
+
const hasPlaybackFailure = (0, import_react2.useCallback)((videoId) => failures.current.has(videoId, playback.key), [playback.key]);
|
|
185
|
+
const [playerTrackObject, setPlayerTrackObject] = (0, import_react2.useState)(null);
|
|
186
|
+
const [playbackConfirmedTrackId, setPlaybackConfirmedTrackId] = (0, import_react2.useState)(null);
|
|
187
|
+
const [isPlaying, setIsPlaying] = (0, import_react2.useState)(false);
|
|
188
|
+
const [duration, setDuration] = (0, import_react2.useState)(0);
|
|
189
|
+
const [volume, setVolumeState] = (0, import_react2.useState)(50);
|
|
190
|
+
const [playState, setPlayState] = (0, import_react2.useState)("STOPPED" /* STOPPED */);
|
|
191
|
+
const [isLoading, setIsLoading] = (0, import_react2.useState)(false);
|
|
192
|
+
const [onTrackEnd, setOnTrackEndState] = (0, import_react2.useState)(null);
|
|
193
|
+
const setOnTrackEnd = (0, import_react2.useCallback)((callback) => {
|
|
141
194
|
setOnTrackEndState(() => callback);
|
|
142
195
|
}, []);
|
|
143
|
-
const audioElementRef = (0,
|
|
144
|
-
const youtubePlayerRef = (0,
|
|
145
|
-
const videoContainerRef = (0,
|
|
146
|
-
const currentTimeRef = (0,
|
|
147
|
-
const currentTrackIdRef = (0,
|
|
148
|
-
const onTrackEndRef = (0,
|
|
149
|
-
(0,
|
|
196
|
+
const audioElementRef = (0, import_react2.useRef)(null);
|
|
197
|
+
const youtubePlayerRef = (0, import_react2.useRef)(null);
|
|
198
|
+
const videoContainerRef = (0, import_react2.useRef)(null);
|
|
199
|
+
const currentTimeRef = (0, import_react2.useRef)(0);
|
|
200
|
+
const currentTrackIdRef = (0, import_react2.useRef)(null);
|
|
201
|
+
const onTrackEndRef = (0, import_react2.useRef)(onTrackEnd);
|
|
202
|
+
(0, import_react2.useEffect)(() => {
|
|
150
203
|
onTrackEndRef.current = onTrackEnd;
|
|
151
204
|
}, [onTrackEnd]);
|
|
152
|
-
const setVolume = (0,
|
|
205
|
+
const setVolume = (0, import_react2.useCallback)((nextVolume) => {
|
|
153
206
|
if (!Number.isFinite(nextVolume)) return;
|
|
154
207
|
setVolumeState(Math.max(0, Math.min(100, nextVolume)));
|
|
155
208
|
}, []);
|
|
156
|
-
(0,
|
|
209
|
+
(0, import_react2.useEffect)(() => {
|
|
157
210
|
if (playerTrackObject?.isReady) playerTrackObject.mediaController?.setVolume(volume);
|
|
158
211
|
}, [playerTrackObject?.isReady, playerTrackObject?.mediaController, volume]);
|
|
159
|
-
const seekTo = (0,
|
|
212
|
+
const seekTo = (0, import_react2.useCallback)(
|
|
160
213
|
(time) => {
|
|
161
214
|
const mediaController = playerTrackObject?.isReady ? playerTrackObject.mediaController : void 0;
|
|
162
215
|
if (!mediaController || !Number.isFinite(time)) return;
|
|
@@ -166,11 +219,11 @@ function PlayerProvider({ children, loadTrack }) {
|
|
|
166
219
|
},
|
|
167
220
|
[duration, playerTrackObject?.isReady, playerTrackObject?.mediaController]
|
|
168
221
|
);
|
|
169
|
-
(0,
|
|
222
|
+
(0, import_react2.useEffect)(() => {
|
|
170
223
|
loadYoutubeIframeApi().catch(() => {
|
|
171
224
|
});
|
|
172
225
|
}, []);
|
|
173
|
-
(0,
|
|
226
|
+
(0, import_react2.useEffect)(() => {
|
|
174
227
|
const interval = setInterval(() => {
|
|
175
228
|
const player = youtubePlayerRef.current;
|
|
176
229
|
if (player) {
|
|
@@ -180,7 +233,7 @@ function PlayerProvider({ children, loadTrack }) {
|
|
|
180
233
|
}, 250);
|
|
181
234
|
return () => clearInterval(interval);
|
|
182
235
|
}, []);
|
|
183
|
-
const handleYoutubeStateChange = (0,
|
|
236
|
+
const handleYoutubeStateChange = (0, import_react2.useCallback)((event) => {
|
|
184
237
|
if (event.data === window.YT.PlayerState.PLAYING) {
|
|
185
238
|
const trackId = currentTrackIdRef.current;
|
|
186
239
|
if (trackId) setPlaybackConfirmedTrackId(trackId);
|
|
@@ -193,7 +246,7 @@ function PlayerProvider({ children, loadTrack }) {
|
|
|
193
246
|
if (trackId) onTrackEndRef.current?.({ trackId });
|
|
194
247
|
}
|
|
195
248
|
}, []);
|
|
196
|
-
const loadAudioTrack = (0,
|
|
249
|
+
const loadAudioTrack = (0, import_react2.useCallback)(
|
|
197
250
|
(track) => {
|
|
198
251
|
const audio = new Audio(track.streamUrl);
|
|
199
252
|
audio.volume = volume / 100;
|
|
@@ -208,6 +261,8 @@ function PlayerProvider({ children, loadTrack }) {
|
|
|
208
261
|
if (currentTrackIdRef.current === track.id) setPlaybackConfirmedTrackId(track.id);
|
|
209
262
|
});
|
|
210
263
|
audio.addEventListener("ended", () => {
|
|
264
|
+
if (audioElementRef.current !== audio || terminal.current) return;
|
|
265
|
+
terminal.current = true;
|
|
211
266
|
if (currentTrackIdRef.current === track.id) setPlaybackConfirmedTrackId(null);
|
|
212
267
|
setPlayState("STOPPED" /* STOPPED */);
|
|
213
268
|
setIsPlaying(false);
|
|
@@ -227,53 +282,68 @@ function PlayerProvider({ children, loadTrack }) {
|
|
|
227
282
|
},
|
|
228
283
|
[volume]
|
|
229
284
|
);
|
|
230
|
-
const loadYoutubeTrack = (0,
|
|
285
|
+
const loadYoutubeTrack = (0, import_react2.useCallback)(
|
|
231
286
|
async (track) => {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
setPlayerTrackObject({ track, mediaController: new YoutubeMediaController(player), isReady: true, loadError: void 0 });
|
|
236
|
-
setPlayState("PLAYING" /* PLAYING */);
|
|
237
|
-
setIsPlaying(true);
|
|
238
|
-
return;
|
|
239
|
-
}
|
|
287
|
+
const request = generation.current;
|
|
288
|
+
youtubePlayerRef.current?.destroy();
|
|
289
|
+
youtubePlayerRef.current = null;
|
|
240
290
|
const container = videoContainerRef.current;
|
|
241
291
|
if (!container) {
|
|
242
292
|
throw new Error("PlayerVideoSurface must be rendered before a YouTube track can be loaded");
|
|
243
293
|
}
|
|
244
294
|
const YT = await loadYoutubeIframeApi();
|
|
295
|
+
if (request !== generation.current) return;
|
|
296
|
+
const mount = document.createElement("div");
|
|
297
|
+
container.replaceChildren(mount);
|
|
245
298
|
await new Promise((resolve) => {
|
|
246
|
-
const player = new YT.Player(
|
|
299
|
+
const player = new YT.Player(mount, {
|
|
247
300
|
videoId: track.youtubeVideoId,
|
|
248
301
|
playerVars: { autoplay: 1, controls: 0 },
|
|
249
302
|
events: {
|
|
250
303
|
onReady: () => {
|
|
304
|
+
if (request !== generation.current || terminal.current) {
|
|
305
|
+
player.destroy();
|
|
306
|
+
resolve();
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
251
309
|
youtubePlayerRef.current = player;
|
|
252
310
|
setPlayerTrackObject({ track, mediaController: new YoutubeMediaController(player), isReady: true, loadError: void 0 });
|
|
253
311
|
setPlayState("PLAYING" /* PLAYING */);
|
|
254
312
|
setIsPlaying(true);
|
|
255
313
|
resolve();
|
|
256
314
|
},
|
|
257
|
-
onStateChange:
|
|
315
|
+
onStateChange: (event) => {
|
|
316
|
+
if (request !== generation.current || terminal.current) return;
|
|
317
|
+
if (event.data === window.YT.PlayerState.ENDED) terminal.current = true;
|
|
318
|
+
handleYoutubeStateChange(event);
|
|
319
|
+
},
|
|
258
320
|
onError: (event) => {
|
|
321
|
+
if (request !== generation.current || terminal.current) return;
|
|
322
|
+
terminal.current = true;
|
|
323
|
+
if ([100, 101, 150].includes(event.data)) failures.current.add(track.youtubeVideoId, playback.key);
|
|
259
324
|
const loadError = youtubeErrorMessage(event.data);
|
|
260
325
|
const trackId = currentTrackIdRef.current;
|
|
261
326
|
setPlaybackConfirmedTrackId(null);
|
|
262
327
|
setPlayerTrackObject(
|
|
263
|
-
(prev) => prev?.track.id === trackId ? { ...prev, loadError } :
|
|
328
|
+
(prev) => prev?.track.id === trackId ? { ...prev, loadError } : { track, isReady: false, loadError }
|
|
264
329
|
);
|
|
265
330
|
setPlayState("STOPPED" /* STOPPED */);
|
|
266
331
|
setIsPlaying(false);
|
|
267
|
-
if (trackId) onTrackEndRef.current?.({ trackId, error: { code: event.data, message: loadError } });
|
|
332
|
+
if (trackId) onTrackEndRef.current?.({ trackId, videoId: track.youtubeVideoId, error: { code: event.data, message: loadError } });
|
|
333
|
+
resolve();
|
|
268
334
|
}
|
|
269
335
|
}
|
|
270
336
|
});
|
|
271
337
|
});
|
|
272
338
|
},
|
|
273
|
-
[handleYoutubeStateChange]
|
|
339
|
+
[handleYoutubeStateChange, playback.key]
|
|
274
340
|
);
|
|
275
|
-
const loadTrackForPlayer = (0,
|
|
341
|
+
const loadTrackForPlayer = (0, import_react2.useCallback)(
|
|
276
342
|
(trackId) => {
|
|
343
|
+
const request = ++generation.current;
|
|
344
|
+
loadedPlaybackKey.current = playback.key;
|
|
345
|
+
let resolvedTrack = null;
|
|
346
|
+
terminal.current = false;
|
|
277
347
|
currentTrackIdRef.current = trackId;
|
|
278
348
|
setPlaybackConfirmedTrackId(null);
|
|
279
349
|
currentTimeRef.current = 0;
|
|
@@ -289,48 +359,80 @@ function PlayerProvider({ children, loadTrack }) {
|
|
|
289
359
|
setPlayerTrackObject(null);
|
|
290
360
|
setIsLoading(true);
|
|
291
361
|
setPlayState("LOADING" /* LOADING */);
|
|
292
|
-
loadTrack(trackId).then((track) =>
|
|
293
|
-
|
|
362
|
+
loadTrack(trackId).then((track) => {
|
|
363
|
+
if (request !== generation.current) return;
|
|
364
|
+
resolvedTrack = track;
|
|
365
|
+
if (!isPlayable(track)) throw new Error(track.kind === "youtube" && track.availability?.reason === "region_blocked" ? "Unavailable in your country" : "Video unavailable");
|
|
366
|
+
return track.kind === "youtube" ? loadYoutubeTrack(track) : loadAudioTrack(track);
|
|
367
|
+
}).catch((error) => {
|
|
368
|
+
if (request !== generation.current) return;
|
|
294
369
|
setPlaybackConfirmedTrackId(null);
|
|
295
370
|
setPlayState("STOPPED" /* STOPPED */);
|
|
296
371
|
setPlayerTrackObject({
|
|
297
|
-
track: { id: trackId, kind: "audio", streamUrl: "", title: "" },
|
|
372
|
+
track: resolvedTrack ?? { id: trackId, kind: "audio", streamUrl: "", title: "" },
|
|
298
373
|
isReady: false,
|
|
299
374
|
loadError: error?.message ?? "Failed to load track"
|
|
300
375
|
});
|
|
301
376
|
}).finally(() => {
|
|
302
|
-
setIsLoading(false);
|
|
377
|
+
if (request === generation.current) setIsLoading(false);
|
|
303
378
|
});
|
|
304
379
|
},
|
|
305
|
-
[loadTrack, loadAudioTrack, loadYoutubeTrack]
|
|
380
|
+
[loadTrack, loadAudioTrack, loadYoutubeTrack, playback.key]
|
|
306
381
|
);
|
|
307
|
-
const
|
|
382
|
+
const previousPlaybackKey = (0, import_react2.useRef)(playback.key);
|
|
383
|
+
(0, import_react2.useEffect)(() => {
|
|
384
|
+
if (previousPlaybackKey.current === playback.key) return;
|
|
385
|
+
previousPlaybackKey.current = playback.key;
|
|
386
|
+
failures.current.clear();
|
|
387
|
+
if (currentTrackIdRef.current && loadedPlaybackKey.current !== playback.key && playerTrackObject?.track.kind !== "audio") {
|
|
388
|
+
loadTrackForPlayer(currentTrackIdRef.current);
|
|
389
|
+
}
|
|
390
|
+
}, [playback.key, loadTrackForPlayer, playerTrackObject]);
|
|
391
|
+
const [retryTrackId, setRetryTrackId] = (0, import_react2.useState)(null);
|
|
392
|
+
(0, import_react2.useEffect)(() => {
|
|
393
|
+
if (!retryTrackId) return;
|
|
394
|
+
setRetryTrackId(null);
|
|
395
|
+
loadTrackForPlayer(retryTrackId);
|
|
396
|
+
}, [retryTrackId, loadTrackForPlayer]);
|
|
397
|
+
const retryPlayback = (0, import_react2.useCallback)(async () => {
|
|
398
|
+
try {
|
|
399
|
+
await playback.refresh(true);
|
|
400
|
+
failures.current.clear();
|
|
401
|
+
setRetryTrackId(currentTrackIdRef.current);
|
|
402
|
+
} catch (error) {
|
|
403
|
+
setPlayerTrackObject((previous) => previous && {
|
|
404
|
+
...previous,
|
|
405
|
+
loadError: error instanceof Error ? error.message : "Unable to refresh playback context"
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
}, [playback]);
|
|
409
|
+
const handleNextTrack = (0, import_react2.useCallback)(
|
|
308
410
|
(trackList, currentTrack, onTrackChange) => {
|
|
309
411
|
if (!trackList || !currentTrack) return;
|
|
310
412
|
const currentIndex = trackList.findIndex((track) => track.id === currentTrack.id);
|
|
311
413
|
if (currentIndex === -1) return;
|
|
312
|
-
const nextTrack = trackList.slice(currentIndex + 1).find(isPlayable);
|
|
414
|
+
const nextTrack = trackList.slice(currentIndex + 1).find((track) => isPlayable(track) && (track.kind !== "youtube" || !hasPlaybackFailure(track.youtubeVideoId)));
|
|
313
415
|
if (nextTrack) {
|
|
314
416
|
onTrackChange(nextTrack);
|
|
315
417
|
loadTrackForPlayer(nextTrack.id);
|
|
316
418
|
}
|
|
317
419
|
},
|
|
318
|
-
[loadTrackForPlayer]
|
|
420
|
+
[loadTrackForPlayer, hasPlaybackFailure]
|
|
319
421
|
);
|
|
320
|
-
const handlePreviousTrack = (0,
|
|
422
|
+
const handlePreviousTrack = (0, import_react2.useCallback)(
|
|
321
423
|
(trackList, currentTrack, onTrackChange) => {
|
|
322
424
|
if (!trackList || !currentTrack) return;
|
|
323
425
|
const currentIndex = trackList.findIndex((track) => track.id === currentTrack.id);
|
|
324
426
|
if (currentIndex === -1) return;
|
|
325
|
-
const previousTrack = trackList.slice(0, currentIndex).reverse().find(isPlayable);
|
|
427
|
+
const previousTrack = trackList.slice(0, currentIndex).reverse().find((track) => isPlayable(track) && (track.kind !== "youtube" || !hasPlaybackFailure(track.youtubeVideoId)));
|
|
326
428
|
if (previousTrack) {
|
|
327
429
|
onTrackChange(previousTrack);
|
|
328
430
|
loadTrackForPlayer(previousTrack.id);
|
|
329
431
|
}
|
|
330
432
|
},
|
|
331
|
-
[loadTrackForPlayer]
|
|
433
|
+
[loadTrackForPlayer, hasPlaybackFailure]
|
|
332
434
|
);
|
|
333
|
-
(0,
|
|
435
|
+
(0, import_react2.useEffect)(() => {
|
|
334
436
|
return () => {
|
|
335
437
|
if (audioElementRef.current) {
|
|
336
438
|
audioElementRef.current.pause();
|
|
@@ -342,7 +444,7 @@ function PlayerProvider({ children, loadTrack }) {
|
|
|
342
444
|
}
|
|
343
445
|
};
|
|
344
446
|
}, []);
|
|
345
|
-
const handlePlayPauseAction = (0,
|
|
447
|
+
const handlePlayPauseAction = (0, import_react2.useCallback)(() => {
|
|
346
448
|
if (playState === "LOADING" /* LOADING */) return;
|
|
347
449
|
if (!playerTrackObject?.isReady) return;
|
|
348
450
|
const mediaController = playerTrackObject.mediaController;
|
|
@@ -352,14 +454,17 @@ function PlayerProvider({ children, loadTrack }) {
|
|
|
352
454
|
setPlayState("PAUSED" /* PAUSED */);
|
|
353
455
|
setIsPlaying(false);
|
|
354
456
|
} else {
|
|
457
|
+
terminal.current = false;
|
|
355
458
|
mediaController.play();
|
|
356
459
|
setPlayState("PLAYING" /* PLAYING */);
|
|
357
460
|
setIsPlaying(true);
|
|
358
461
|
}
|
|
359
462
|
}, [playerTrackObject?.isReady, playerTrackObject?.mediaController, playState]);
|
|
360
|
-
const contextValue = (0,
|
|
463
|
+
const contextValue = (0, import_react2.useMemo)(
|
|
361
464
|
() => ({
|
|
362
465
|
playerTrackObject,
|
|
466
|
+
hasPlaybackFailure,
|
|
467
|
+
retryPlayback,
|
|
363
468
|
playbackConfirmedTrackId,
|
|
364
469
|
isPlaying,
|
|
365
470
|
setIsPlaying,
|
|
@@ -382,6 +487,8 @@ function PlayerProvider({ children, loadTrack }) {
|
|
|
382
487
|
}),
|
|
383
488
|
[
|
|
384
489
|
playerTrackObject,
|
|
490
|
+
hasPlaybackFailure,
|
|
491
|
+
retryPlayback,
|
|
385
492
|
playbackConfirmedTrackId,
|
|
386
493
|
isPlaying,
|
|
387
494
|
duration,
|
|
@@ -398,10 +505,10 @@ function PlayerProvider({ children, loadTrack }) {
|
|
|
398
505
|
setVolume
|
|
399
506
|
]
|
|
400
507
|
);
|
|
401
|
-
return /* @__PURE__ */ (0,
|
|
508
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PlayerContext.Provider, { value: contextValue, children });
|
|
402
509
|
}
|
|
403
510
|
function usePlayer() {
|
|
404
|
-
const context = (0,
|
|
511
|
+
const context = (0, import_react2.useContext)(PlayerContext);
|
|
405
512
|
if (context === void 0) {
|
|
406
513
|
throw new Error("usePlayer must be used within a PlayerProvider");
|
|
407
514
|
}
|
|
@@ -409,12 +516,12 @@ function usePlayer() {
|
|
|
409
516
|
}
|
|
410
517
|
function PlayerVideoSurface({ className }) {
|
|
411
518
|
const { videoContainerRef } = usePlayer();
|
|
412
|
-
return /* @__PURE__ */ (0,
|
|
519
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { ref: videoContainerRef, className });
|
|
413
520
|
}
|
|
414
521
|
function useCurrentTime() {
|
|
415
522
|
const { currentTimeRef } = usePlayer();
|
|
416
|
-
const [currentTime, setCurrentTime] = (0,
|
|
417
|
-
(0,
|
|
523
|
+
const [currentTime, setCurrentTime] = (0, import_react2.useState)(0);
|
|
524
|
+
(0, import_react2.useEffect)(() => {
|
|
418
525
|
const interval = setInterval(() => {
|
|
419
526
|
setCurrentTime(currentTimeRef.current);
|
|
420
527
|
}, 100);
|