Socket
Socket
Sign inDemoInstall

svelte-player

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svelte-player - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

dist/players/sound-cloud-types.d.ts

4

dist/PlayerMedia.svelte.d.ts

@@ -27,3 +27,3 @@ import { SvelteComponentTyped } from "svelte";

getSecondsLoaded?: (() => number | null) | undefined;
getInternalPlayer?: ((key: InternalPlayerKey) => import("./players/global-types").YTPlayer | import("./players/global-types").TwitchPlayer | HTMLAudioElement | null) | undefined;
getInternalPlayer?: ((key: InternalPlayerKey) => import("./players/types").GetPlayerReturn) | undefined;
seekTo?: ((amount: number, type?: SeekToType, keepPlaying?: boolean) => void) | undefined;

@@ -63,5 +63,5 @@ };

get getSecondsLoaded(): () => number | null;
get getInternalPlayer(): (key: InternalPlayerKey) => import("./players/global-types").YTPlayer | import("./players/global-types").TwitchPlayer | HTMLAudioElement | null;
get getInternalPlayer(): (key: InternalPlayerKey) => import("./players/types").GetPlayerReturn;
get seekTo(): (amount: number, type?: SeekToType | undefined, keepPlaying?: boolean) => void;
}
export {};
import { SvelteComponentTyped } from "svelte";
import type { FilePlayerUrl } from './types';
import type { FilePlayerUrl, GetPlayerReturn } from './types';
import type { FileConfig } from './file-types';

@@ -10,2 +10,3 @@ declare const __propDef: {

controls: boolean;
volume?: number | null | undefined;
muted: boolean;

@@ -31,3 +32,3 @@ width: string;

getSecondsLoaded?: (() => number) | undefined;
getPlayer?: (() => HTMLAudioElement | null) | undefined;
getPlayer?: (() => GetPlayerReturn | null) | undefined;
};

@@ -62,2 +63,3 @@ events: {

export default class FilePlayer extends SvelteComponentTyped<FilePlayerProps, FilePlayerEvents, FilePlayerSlots> {
get volume(): number;
get playsinline(): NonNullable<boolean | undefined>;

@@ -79,4 +81,4 @@ get load(): (url: FilePlayerUrl, _?: boolean | undefined) => void;

get getSecondsLoaded(): () => number;
get getPlayer(): () => HTMLAudioElement | null;
get getPlayer(): () => GetPlayerReturn;
}
export {};

@@ -220,13 +220,13 @@ import type Hls from 'hls.js';

};
export type TwitchPlayerCAPTIONS = 'captions';
export type TwitchPlayerENDED = 'ended';
export type TwitchPlayerPAUSE = 'pause';
export type TwitchPlayerPLAY = 'play';
export type TwitchPlayerPLAYBACK_BLOCKED = 'playbackBlocked';
export type TwitchPlayerPLAYING = 'playing';
export type TwitchPlayerOFFLINE = 'offline';
export type TwitchPlayerONLINE = 'online';
export type TwitchPlayerREADY = 'ready';
export type TwitchPlayerSEEK = 'seek';
export type TwitchPlayerEVENT = TwitchPlayerCAPTIONS | TwitchPlayerENDED | TwitchPlayerPAUSE | TwitchPlayerPLAY | TwitchPlayerPLAYBACK_BLOCKED | TwitchPlayerPLAYING | TwitchPlayerOFFLINE | TwitchPlayerONLINE | TwitchPlayerREADY | TwitchPlayerSEEK;
export type TwitchPlayerCAPTIONSEvent = 'captions';
export type TwitchPlayerENDEDEvent = 'ended';
export type TwitchPlayerPAUSEEvent = 'pause';
export type TwitchPlayerPLAYEvent = 'play';
export type TwitchPlayerPLAYBACK_BLOCKEDEvent = 'playbackBlocked';
export type TwitchPlayerPLAYINGEvent = 'playing';
export type TwitchPlayerOFFLINEEvent = 'offline';
export type TwitchPlayerONLINEEvent = 'online';
export type TwitchPlayerREADYEvent = 'ready';
export type TwitchPlayerSEEKEvent = 'seek';
export type TwitchPlayerEVENT = TwitchPlayerCAPTIONSEvent | TwitchPlayerENDEDEvent | TwitchPlayerPAUSEEvent | TwitchPlayerPLAYEvent | TwitchPlayerPLAYBACK_BLOCKEDEvent | TwitchPlayerPLAYINGEvent | TwitchPlayerOFFLINEEvent | TwitchPlayerONLINEEvent | TwitchPlayerREADYEvent | TwitchPlayerSEEKEvent;
export type TwitchPlayerEVENTCallback = (params: Record<string, never>) => void;

@@ -260,4 +260,4 @@ export type TwitchPlayerSEEKEVENTCallbackParams = {

isPaused(): boolean;
addEventListener(event: Exclude<TwitchPlayerEVENT, TwitchPlayerSEEK>, callback: TwitchPlayerEVENTCallback): void;
addEventListener(event: Extract<TwitchPlayerEVENT, TwitchPlayerSEEK>, callback: TwitchPlayerSEEKEVENTCallback): void;
addEventListener(event: Exclude<TwitchPlayerEVENT, TwitchPlayerSEEKEvent>, callback: TwitchPlayerEVENTCallback): void;
addEventListener(event: Extract<TwitchPlayerEVENT, TwitchPlayerSEEKEvent>, callback: TwitchPlayerSEEKEVENTCallback): void;
}

@@ -267,12 +267,12 @@ export interface TwitchPlayerConstructor {

readonly prototype: TwitchPlayer;
CAPTIONS: TwitchPlayerCAPTIONS;
ENDED: TwitchPlayerENDED;
PAUSE: TwitchPlayerPAUSE;
PLAY: TwitchPlayerPLAY;
PLAYBACK_BLOCKED: TwitchPlayerPLAYBACK_BLOCKED;
PLAYING: TwitchPlayerPLAYING;
OFFLINE: TwitchPlayerOFFLINE;
ONLINE: TwitchPlayerONLINE;
READY: TwitchPlayerREADY;
SEEK: TwitchPlayerSEEK;
CAPTIONS: TwitchPlayerCAPTIONSEvent;
ENDED: TwitchPlayerENDEDEvent;
PAUSE: TwitchPlayerPAUSEEvent;
PLAY: TwitchPlayerPLAYEvent;
PLAYBACK_BLOCKED: TwitchPlayerPLAYBACK_BLOCKEDEvent;
PLAYING: TwitchPlayerPLAYINGEvent;
OFFLINE: TwitchPlayerOFFLINEEvent;
ONLINE: TwitchPlayerONLINEEvent;
READY: TwitchPlayerREADYEvent;
SEEK: TwitchPlayerSEEKEvent;
}

@@ -282,2 +282,77 @@ export type Twitch = {

};
export type SoundCloudWidgetLOAD_PROGRESSEvent = 'loadProgress';
export type SoundCloudWidgetPLAY_PROGRESSEvent = 'playProgress';
export type SoundCloudWidgetPLAYEvent = 'play';
export type SoundCloudWidgetPAUSEEvent = 'pause';
export type SoundCloudWidgetFINISHEvent = 'finish';
export type SoundCloudWidgetSEEKEvent = 'seek';
export type SoundCloudUIREADYEvent = 'ready';
export type SoundCloudUICLICK_DOWNLOADEvent = 'downloadClicked';
export type SoundCloudUICLICK_BUYEvent = 'buyClicked';
export type SoundCloudUIOPEN_SHARE_PANELEvent = 'sharePanelOpened';
export type SoundCloudUIERROREvent = 'error';
export type SoundCloudPlayerEVENT = SoundCloudWidgetLOAD_PROGRESSEvent | SoundCloudWidgetPLAY_PROGRESSEvent | SoundCloudWidgetPLAYEvent | SoundCloudWidgetPAUSEEvent | SoundCloudWidgetFINISHEvent | SoundCloudWidgetSEEKEvent | SoundCloudUIREADYEvent | SoundCloudUICLICK_DOWNLOADEvent | SoundCloudUICLICK_BUYEvent | SoundCloudUIOPEN_SHARE_PANELEvent | SoundCloudUIERROREvent;
export type SoundCloudWidgetEvents = {
LOAD_PROGRESS: SoundCloudWidgetLOAD_PROGRESSEvent;
PLAY_PROGRESS: SoundCloudWidgetPLAY_PROGRESSEvent;
PLAY: SoundCloudWidgetPLAYEvent;
PAUSE: SoundCloudWidgetPAUSEEvent;
FINISH: SoundCloudWidgetFINISHEvent;
SEEK: SoundCloudWidgetSEEKEvent;
READY: SoundCloudUIREADYEvent;
CLICK_DOWNLOAD: SoundCloudUICLICK_DOWNLOADEvent;
CLICK_BUY: SoundCloudUICLICK_BUYEvent;
OPEN_SHARE_PANEL: SoundCloudUIOPEN_SHARE_PANELEvent;
ERROR: SoundCloudUIERROREvent;
};
export type SoundCloudPlayerLoadOptions = {
auto_play: boolean;
color: string;
buying: boolean;
sharing: boolean;
download: boolean;
show_artwork: boolean;
show_playcount: boolean;
show_user: boolean;
start_track: number;
single_active: boolean;
callback(): void;
visual: boolean;
};
export type SoundCloudPlayerBindCallbackParams = {
soundId: number;
loadedProgress: number;
currentPosition: number;
relativePosition: number;
};
export type SoundCloudPlayerBindCallbackFn = (params: SoundCloudPlayerBindCallbackParams) => void;
export type SoundCloudPlayer = {
bind(event: Exclude<SoundCloudPlayerEVENT, SoundCloudUIERROREvent>, listener: SoundCloudPlayerBindCallbackFn): void;
bind(event: Extract<SoundCloudPlayerEVENT, SoundCloudUIERROREvent>, listener: (e: unknown) => void): void;
unbind(event: SoundCloudPlayerEVENT): void;
load(url: string, options?: Partial<SoundCloudPlayerLoadOptions>): void;
play(): void;
pause(): void;
toggle(): void;
seekTo(milliseconds: number): void;
setVolume(volume: number): void;
next(): void;
prev(): void;
skip(soundIndex: number): void;
getVolume(callback: AnyFunction): number;
getDuration(callback: AnyFunction): number;
getPosition(callback: AnyFunction): number;
getSounds(callback: AnyFunction): Record<string, never>[];
getCurrentSound(callback: AnyFunction): Record<string, never>;
getCurrentSoundIndex(callback: AnyFunction): number;
isPaused(callback: AnyFunction): boolean;
};
export interface SoundCloudWidget {
(container: string | HTMLIFrameElement): SoundCloudPlayer;
Events: SoundCloudWidgetEvents;
}
export type SoundCloud = {
Widget: SoundCloudWidget;
};
export type NotImplementedPlayer = Record<string, never>;
type TypeOfDashJS = typeof dashjs;

@@ -300,22 +375,25 @@ type DashJSLogLevel = TypeOfDashJS['LogLevel'];

YT: YT;
SC: SoundCloud;
Twitch: Twitch;
Hls: HlsJS;
dashjs: DashJS;
flvjs: FlvJS;
Twitch: Twitch;
};
export type GlobalSDKType = keyof GlobalSDK;
export type GlobalSDKYTKey = Extract<GlobalSDKType, 'YT'>;
export type GlobalSDKSoundCloudKey = Extract<GlobalSDKType, 'SC'>;
export type GlobalSDKTwitchKey = Extract<GlobalSDKType, 'Twitch'>;
export type GlobalSDKHLSKey = Extract<GlobalSDKType, 'Hls'>;
export type GlobalSDKDASHKey = Extract<GlobalSDKType, 'dashjs'>;
export type GlobalSDKFLVKey = Extract<GlobalSDKType, 'flvjs'>;
export type GlobalSDKTwitchKey = Extract<GlobalSDKType, 'Twitch'>;
export type GlobalSDKValue = GlobalSDK[GlobalSDKType];
export type GlobalSDKYT = Extract<GlobalSDKValue, YT>;
export type GlobalSDKSoundCloud = Extract<GlobalSDKValue, SoundCloud>;
export type GlobalSDKTwitch = Extract<GlobalSDKValue, Twitch>;
export type GlobalSDKHLSClass = Hls;
export type GlobalSDKHLS = Extract<GlobalSDKValue, HlsJS>;
export type GlobalSDKHLSClass = Hls;
export type GlobalSDKDASH = Extract<GlobalSDKValue, DashJS>;
export type GlobalSDKFLV = Extract<GlobalSDKValue, FlvJS>;
export type GlobalSDKTwitch = Extract<GlobalSDKValue, Twitch>;
export type GlobalSDKReady = 'onYouTubeIframeAPIReady';
export type GlobalSDKYTReady = Extract<GlobalSDKReady, 'onYouTubeIframeAPIReady'>;
export {};
import type { FilePlayerUrl } from './types';
import { canPlayYoutube, canPlayFile, canPlayTwitch } from './patterns';
import { canPlayYoutube, canPlayFile, canPlayTwitch, canPlaySoundCloud } from './patterns';
declare const players: readonly [{

@@ -9,2 +9,7 @@ readonly key: "youtube";

}, {
readonly key: "soundcloud";
readonly canPlay: typeof canPlaySoundCloud;
readonly canEnablePIP: undefined;
readonly loadComponent: () => Promise<typeof import("./SoundCloud.svelte")>;
}, {
readonly key: "twitch";

@@ -11,0 +16,0 @@ readonly canPlay: typeof canPlayTwitch;

@@ -1,2 +0,2 @@

import { canPlayYoutube, canPlayFile, AUDIO_EXTENSIONS, canPlayTwitch } from './patterns';
import { canPlayYoutube, canPlayFile, AUDIO_EXTENSIONS, canPlayTwitch, canPlaySoundCloud } from './patterns';
import { supportsWebKitPresentationMode } from './utils';

@@ -13,2 +13,10 @@ const players = [

{
key: 'soundcloud',
canPlay: canPlaySoundCloud,
canEnablePIP: undefined,
loadComponent: () => {
return import('./SoundCloud.svelte');
}
},
{
key: 'twitch',

@@ -15,0 +23,0 @@ canPlay: canPlayTwitch,

import { SvelteComponentTyped } from "svelte";
import type { FilePlayerUrl } from './types';
import type { FilePlayerUrl, GetPlayerReturn } from './types';
import type { NotImplementedConfig } from './not-implemented-types';
declare const __propDef: {

@@ -9,2 +10,3 @@ props: {

controls?: boolean | undefined;
volume?: number | null | undefined;
muted?: boolean | undefined;

@@ -14,3 +16,3 @@ width?: string | undefined;

playsinline?: boolean | undefined;
config?: object | undefined;
config?: NotImplementedConfig | undefined;
load?: ((url: FilePlayerUrl, isReady?: boolean) => void) | undefined;

@@ -31,3 +33,3 @@ play?: (() => void) | undefined;

disablePIP?: (() => void) | undefined;
getPlayer?: (() => null) | undefined;
getPlayer?: (() => GetPlayerReturn) | undefined;
};

@@ -66,2 +68,3 @@ events: {

get controls(): NonNullable<boolean | undefined>;
get volume(): number;
get muted(): NonNullable<boolean | undefined>;

@@ -71,3 +74,3 @@ get width(): string;

get playsinline(): NonNullable<boolean | undefined>;
get config(): object;
get config(): Partial<Record<string, never>>;
get load(): (url: FilePlayerUrl, isReady?: boolean | undefined) => void;

@@ -88,4 +91,4 @@ get play(): () => void;

get disablePIP(): () => void;
get getPlayer(): () => null;
get getPlayer(): () => GetPlayerReturn;
}
export {};
import type { FilePlayerUrl } from './types';
export declare const MATCH_URL_YOUTUBE: RegExp;
export declare const MATCH_URL_SOUNDCLOUD: RegExp;
export declare const MATCH_URL_TWITCH_VIDEO: RegExp;

@@ -12,3 +13,4 @@ export declare const MATCH_URL_TWITCH_CHANNEL: RegExp;

export declare function canPlayYoutube(url: FilePlayerUrl): boolean;
export declare function canPlaySoundCloud(url: FilePlayerUrl): boolean;
export declare function canPlayTwitch(url: FilePlayerUrl): boolean;
export declare function canPlayFile(url: FilePlayerUrl): boolean;

@@ -5,2 +5,3 @@ import { isMediaStream, isBlobUrl } from './utils';

export const MATCH_URL_YOUTUBE = /(?:youtu\.be\/|youtube(?:-nocookie|education)?\.com\/(?:embed\/|v\/|watch\/|watch\?v=|watch\?.+&v=|shorts\/|live\/))((\w|-){11})|youtube\.com\/playlist\?list=|youtube\.com\/user\//;
export const MATCH_URL_SOUNDCLOUD = /(?:soundcloud\.com|snd\.sc)\/[^.]+$/;
export const MATCH_URL_TWITCH_VIDEO = /(?:www\.|go\.)?twitch\.tv\/videos\/(\d+)($|\?)/;

@@ -30,2 +31,8 @@ export const MATCH_URL_TWITCH_CHANNEL = /(?:www\.|go\.)?twitch\.tv\/([a-zA-Z0-9_]+)($|\?)/;

}
export function canPlaySoundCloud(url) {
if (url instanceof Array) {
return false;
}
return MATCH_URL_SOUNDCLOUD.test(url) && !AUDIO_EXTENSIONS.test(url);
}
export function canPlayTwitch(url) {

@@ -32,0 +39,0 @@ if (url instanceof Array) {

@@ -11,2 +11,3 @@ import { SvelteComponentTyped } from "svelte";

controls: boolean;
volume?: number | null | undefined;
muted: boolean;

@@ -62,2 +63,3 @@ width?: string | undefined;

get loop(): NonNullable<boolean | undefined>;
get volume(): number;
get width(): string;

@@ -64,0 +66,0 @@ get height(): string;

import type { SvelteComponent } from 'svelte';
import type loadScript from 'load-script';
import type { YTPlayerOnPlaybackQualityChangeEvent, GlobalSDK, GlobalSDKReady, GlobalSDKType, YTPlayer, TwitchPlayer } from './global-types';
export type PlayerInstance = YTPlayer | TwitchPlayer | HTMLAudioElement | HTMLVideoElement;
import type { YTPlayerOnPlaybackQualityChangeEvent, GlobalSDK, GlobalSDKReady, GlobalSDKType, YTPlayer, TwitchPlayer, NotImplementedPlayer, SoundCloudPlayer } from './global-types';
export type PlayerInstance = YTPlayer | TwitchPlayer | HTMLAudioElement | HTMLVideoElement | NotImplementedPlayer | SoundCloudPlayer;
export type SDKBase<T extends keyof GlobalSDK> = {

@@ -30,2 +30,3 @@ url: string;

};
export type GetPlayerReturn = PlayerInstance | null;
export type PlayerMedia = {

@@ -47,3 +48,3 @@ load(url: FilePlayerUrl, isReady?: boolean): void;

disablePIP?(): void;
getPlayer?(): PlayerInstance | null;
getPlayer?(): GetPlayerReturn;
};

@@ -50,0 +51,0 @@ export type OnProgressProps = {

@@ -1,2 +0,2 @@

import type { GlobalSDKYT, GlobalSDK, GlobalSDKType, GlobalSDKFLV, GlobalSDKDASH, GlobalSDKHLS, GlobalSDKTwitch } from './global-types';
import type { GlobalSDKYT, GlobalSDK, GlobalSDKType, GlobalSDKFLV, GlobalSDKDASH, GlobalSDKHLS, GlobalSDKTwitch, GlobalSDKSoundCloud } from './global-types';
import type { GetSDKParams, FilePlayerUrl } from './types';

@@ -7,6 +7,7 @@ declare global {

onYouTubeIframeAPIReady: () => void;
SC: GlobalSDKSoundCloud;
Twitch: GlobalSDKTwitch;
Hls: GlobalSDKHLS;
dashjs: GlobalSDKDASH;
flvjs: GlobalSDKFLV;
Twitch: GlobalSDKTwitch;
}

@@ -13,0 +14,0 @@ }

import { SvelteComponentTyped } from "svelte";
import type { YTPlayer } from './global-types';
import type { FilePlayerUrl, PlayerUrl } from './types';
import type { FilePlayerUrl, PlayerUrl, GetPlayerReturn } from './types';
import type { YouTubeConfig } from './youtube-types';

@@ -11,2 +10,3 @@ declare const __propDef: {

controls: boolean;
volume?: number | null | undefined;
muted?: boolean | undefined;

@@ -30,3 +30,3 @@ width?: string | undefined;

getSecondsLoaded?: (() => number) | undefined;
getPlayer?: (() => YTPlayer | null) | undefined;
getPlayer?: (() => GetPlayerReturn | null) | undefined;
};

@@ -62,2 +62,3 @@ events: {

get url(): NonNullable<FilePlayerUrl | undefined>;
get volume(): number;
get muted(): NonNullable<boolean | undefined>;

@@ -79,4 +80,4 @@ get width(): string;

get getSecondsLoaded(): () => number;
get getPlayer(): () => YTPlayer | null;
get getPlayer(): () => GetPlayerReturn;
}
export {};

@@ -14,2 +14,11 @@ // eslint-disable-next-line @typescript-eslint/no-empty-function

},
soundcloud: {
options: {
visual: true,
buying: false,
download: false,
sharing: false,
show_playcount: false
}
},
twitch: {

@@ -16,0 +25,0 @@ options: {},

@@ -29,3 +29,3 @@ import { SvelteComponentTyped } from "svelte";

getSecondsLoaded?: (() => number | null) | undefined;
getInternalPlayer?: ((key?: InternalPlayerKey) => import("./players/global-types").YTPlayer | import("./players/global-types").TwitchPlayer | HTMLAudioElement | null) | undefined;
getInternalPlayer?: ((key?: InternalPlayerKey) => import("./players/global-types").YTPlayer | import("./players/global-types").TwitchPlayer | import("./players/global-types").SoundCloudPlayer | import("./players/global-types").NotImplementedPlayer | HTMLAudioElement | null) | undefined;
seekTo?: ((fraction: number, type?: SeekToType, keepPlaying?: boolean) => null | undefined) | undefined;

@@ -71,5 +71,5 @@ };

get getSecondsLoaded(): () => number | null;
get getInternalPlayer(): (key?: InternalPlayerKey) => import("./players/global-types").YTPlayer | import("./players/global-types").TwitchPlayer | HTMLAudioElement | null;
get getInternalPlayer(): (key?: InternalPlayerKey) => import("./players/global-types").YTPlayer | import("./players/global-types").TwitchPlayer | import("./players/global-types").SoundCloudPlayer | import("./players/global-types").NotImplementedPlayer | HTMLAudioElement | null;
get seekTo(): (fraction: number, type?: SeekToType | undefined, keepPlaying?: boolean | undefined) => null | undefined;
}
export {};
import type { InternalPlayerKey, Dispatcher, PlayerUrl, PlayerInstance } from './players/types';
import type { YouTubeConfig } from './players/youtube-types';
import type { SoundCloudConfig } from './players/sound-cloud-types';
import type { TwitchConfig } from './players/twitch-types';

@@ -30,2 +31,3 @@ import type { FileConfig } from './players/file-types';

youtube: YouTubeConfig;
soundcloud: SoundCloudConfig;
twitch: TwitchConfig;

@@ -32,0 +34,0 @@ file: FileConfig;

{
"name": "svelte-player",
"version": "0.0.7",
"version": "0.0.8",
"license": "MIT",

@@ -5,0 +5,0 @@ "repository": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc