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.11 to 0.0.12

dist/players/vimeo-types.d.ts

208

dist/players/global-types.d.ts

@@ -506,2 +506,207 @@ import type Hls from 'hls.js';

};
export type VimeoEmbedIDOption = {
id: number;
};
export type VimeoEmbedURLOption = {
url: string;
};
export type VimeoPlayerOptions = {
autopause: boolean;
autopip: boolean;
autoplay: boolean;
background: boolean;
byline: boolean;
color: string;
colors: string[];
controls: boolean;
dnt: string;
height: number;
interactive_params: string;
keyboard: boolean;
loop: boolean;
maxheight: number;
maxwidth: number;
muted: boolean;
pip: boolean;
playsinline: boolean;
portrait: boolean;
quality: string;
responsive: boolean;
speed: boolean;
texttrack: string;
title: boolean;
transparent: boolean;
width: number;
};
export type VimeoEmbedOptions = (VimeoEmbedIDOption | VimeoEmbedURLOption) & VimeoPlayerOptions;
export type VimeoPlayerBUFFERENDEvent = 'bufferend';
export type VimeoPlayerBUFFERSTARTEvent = 'bufferstart';
export type VimeoPlayerENDEDEvent = 'ended';
export type VimeoPlayerERROREvent = 'error';
export type VimeoPlayerLOADEDEvent = 'loaded';
export type VimeoPlayerPAUSEEvent = 'pause';
export type VimeoPlayerPLAYEvent = 'play';
export type VimeoPlayerPLAYBACKRATECHANGEEvent = 'playbackratechange';
export type VimeoPlayerPROGRESSEvent = 'progress';
export type VimeoPlayerSEEKEDEvent = 'seeked';
export type VimeoPlayerTIMEUPDATEEvent = 'timeupdate';
export type VimeoPlayerVOLUMECHANGEEvent = 'volumechange';
export type VimeoPlayerCHAPTESRCHANGEEvent = 'chapterchange';
export type VimeoPlayerCUECHANGEEvent = 'cuechange';
export type VimeoPlayerCUEPOINTEvent = 'cuepoint';
export type VimeoPlayerTEXTTRACKCHANGEEvent = 'texttrackchange';
export type VimeoPlayerINTERACTIVEHOTSPOTCLICKEDEvent = 'interactivehotspotclicked';
export type VimeoPlayerINTERACTIVEOVERPLAYPANELCLICKEDEvent = 'interactiveoverlaypanelclicked';
export type VimeoPlayerNoDataEventEvents = VimeoPlayerBUFFERENDEvent | VimeoPlayerBUFFERSTARTEvent;
export type VimeoPlayerProgressEvents = VimeoPlayerENDEDEvent | VimeoPlayerPAUSEEvent | VimeoPlayerPLAYEvent | VimeoPlayerPROGRESSEvent | VimeoPlayerSEEKEDEvent | VimeoPlayerTIMEUPDATEEvent;
export type VimeoPlayerEvents = VimeoPlayerNoDataEventEvents | VimeoPlayerProgressEvents | VimeoPlayerERROREvent | VimeoPlayerPLAYBACKRATECHANGEEvent | VimeoPlayerVOLUMECHANGEEvent | VimeoPlayerCHAPTESRCHANGEEvent | VimeoPlayerCUECHANGEEvent | VimeoPlayerCUEPOINTEvent | VimeoPlayerTEXTTRACKCHANGEEvent;
export type VimeoPlayerPROGRESSEventCallbackData = {
duration: number;
percent: number;
seconds: number;
};
export type VimeoPlayerERROREventCallbackData = {
message: string;
method: string;
name: string;
};
export type VimeoPlayerLOADEDEventCallbackData = {
id: VimeoEmbedIDOption['id'];
};
export type VimeoPlayerPLAYBACKRATECHANGEEventCallbackData = {
playbackRate: number;
};
export type VimeoPlayerVOLUMECHANGEEventCallbackData = {
volume: number;
};
export type VimeoPlayerChapter = {
index: number;
startTime: number;
title: string;
};
export type VimeoPlayerCUECHANGEEventCallbackCue = {
html: string;
text: string;
};
export type VimeoPlayerCUECHANGEEventCallbackData = {
cues: VimeoPlayerCUECHANGEEventCallbackCue[];
kind: string;
label: string;
language: string;
};
export type CuePointData = Record<string, unknown>;
export type VimeoPlayerCuePoint = {
time: number;
data: CuePointData;
id: string;
};
export type VimeoPlayerTEXTTRACKCHANGEEventCallbackData = {
label: string;
language: string;
kind: string;
};
export type VimeoPlayerTextTrack = VimeoPlayerTEXTTRACKCHANGEEventCallbackData & {
mode: string;
};
export type VimeoPlayerINTERACTIVEHOTSPOTCLICKEDActionPreference = {
pauseOnAction: boolean;
overlayId: number;
seekTo: number;
url: string;
};
export type VimeoPlayerINTERACTIVEHOTSPOTCLICKEDEventCallbackData = {
action: string;
actionPreference: VimeoPlayerINTERACTIVEHOTSPOTCLICKEDActionPreference;
currentTime: number;
customPayloadData: unknown | null;
hotspotId: number;
};
export type VimeoPlayerINTERACTIVEOVERPLAYPANELCLICKEDActionPreference = {
pauseOnAction: boolean;
seekTo: number;
url: string;
};
export type VimeoPlayerINTERACTIVEOVERPLAYPANELCLICKEDEventCallbackData = {
action: string;
actionPreference: VimeoPlayerINTERACTIVEOVERPLAYPANELCLICKEDActionPreference;
currentTime: number;
customPayloadData: unknown | null;
overlayId: number;
panelId: string;
};
export type VimeoPlayerWithDataEventCallback<T> = (data: T) => void;
export type VimeoPlayerNoDataEventCallback = VimeoPlayerWithDataEventCallback<undefined>;
export type VimeoPlayerPROGRESSEventCallback = VimeoPlayerWithDataEventCallback<VimeoPlayerPROGRESSEventCallbackData>;
export type VimeoPlayerERROREventCallback = VimeoPlayerWithDataEventCallback<VimeoPlayerERROREventCallbackData>;
export type VimeoPlayerLOADEDEventCallback = VimeoPlayerWithDataEventCallback<VimeoPlayerLOADEDEventCallbackData>;
export type VimeoPlayerPLAYBACKRATECHANGEEventCallback = VimeoPlayerWithDataEventCallback<VimeoPlayerPLAYBACKRATECHANGEEventCallbackData>;
export type VimeoPlayerVOLUMECHANGEEventCallback = VimeoPlayerWithDataEventCallback<VimeoPlayerVOLUMECHANGEEventCallbackData>;
export type VimeoPlayerCHAPTERCHANGEEventCallback = VimeoPlayerWithDataEventCallback<VimeoPlayerChapter>;
export type VimeoPlayerCUECHANGEEventCallback = VimeoPlayerWithDataEventCallback<VimeoPlayerCUECHANGEEventCallbackData>;
export type VimeoPlayerCUEPOINTEventCallback = VimeoPlayerWithDataEventCallback<VimeoPlayerCuePoint>;
export type VimeoPlayerTEXTTRACKCHANGEEventCallback = VimeoPlayerWithDataEventCallback<VimeoPlayerTEXTTRACKCHANGEEventCallbackData>;
export type VimeoPlayerINTERACTIVEHOTSPOTCLICKEDEventCallback = VimeoPlayerWithDataEventCallback<VimeoPlayerINTERACTIVEHOTSPOTCLICKEDEventCallbackData>;
export type VimeoPlayerINTERACTIVEOVERPLAYPANELCLICKEDEventCallback = VimeoPlayerWithDataEventCallback<VimeoPlayerINTERACTIVEOVERPLAYPANELCLICKEDEventCallbackData>;
export type VimeoPlayerSetAutopauseParams<T extends VimeoEmbedOptions['autopause']> = {
autopause: T;
};
export interface VimeoPlayer {
getAutopause(): Promise<VimeoEmbedOptions['autopause']>;
getCurrentTime(): Promise<number>;
getDuration(): Promise<number>;
getEnded(): Promise<boolean>;
getLoop(): Promise<VimeoEmbedOptions['loop']>;
getPaused(): Promise<boolean>;
getPlaybackRate(): Promise<number>;
getVolume(): Promise<number>;
pause(): Promise<void>;
play(): Promise<void>;
setAutopause<T extends VimeoEmbedOptions['autopause']>(params: VimeoPlayerSetAutopauseParams<T>): T;
setCurrentTime<T extends number>(seconds: T): Promise<T>;
setLoop<T extends VimeoEmbedOptions['loop']>(loop: T): Promise<T>;
setPlaybackRate<T extends number>(playbackRate: T): Promise<T>;
setVolume<T extends number>(volume: T): Promise<T>;
getChapters(): Promise<VimeoPlayerChapter[]>;
getCurrentChapter(): Promise<VimeoPlayerChapter>;
addCuePoint(time: number, data: CuePointData): Promise<string>;
getCuePoints(): Promise<VimeoPlayerCuePoint[]>;
removeCuePoint<T extends string>(id: T): Promise<T>;
disableTextTrack(): Promise<void>;
enableTextTrack(language: string, kind?: string): Promise<VimeoPlayerTextTrack>;
getTextTracks(): Promise<VimeoPlayerTextTrack[]>;
destroy(): Promise<void>;
getColor(): Promise<VimeoPlayerOptions['color']>;
getColors(): Promise<VimeoPlayerOptions['colors']>;
getVideoEmbedCode(): Promise<string>;
getVideoHeight(): Promise<VimeoPlayerOptions['height']>;
getVideoId(): Promise<VimeoEmbedIDOption['id']>;
getVideoTitle(): Promise<string>;
getVideoUrl(): Promise<VimeoEmbedURLOption['url']>;
getVideoWidth(): Promise<VimeoPlayerOptions['width']>;
ready(): Promise<void>;
setColor<T extends VimeoPlayerOptions['color']>(color: T): T;
setColors<T extends VimeoPlayerOptions['colors']>(colors: T): T;
unload(): void;
loadVideo(idOrUrl: VimeoEmbedIDOption['id'] | VimeoEmbedURLOption['url']): Promise<VimeoEmbedIDOption['id']>;
on(event: VimeoPlayerNoDataEventEvents, callback: VimeoPlayerNoDataEventCallback): void;
on(event: VimeoPlayerProgressEvents, callback: VimeoPlayerPROGRESSEventCallback): void;
on(event: VimeoPlayerERROREvent, callback: VimeoPlayerERROREventCallback): void;
on(event: VimeoPlayerLOADEDEvent, callback: VimeoPlayerLOADEDEventCallback): void;
on(event: VimeoPlayerPLAYBACKRATECHANGEEvent, callback: VimeoPlayerPLAYBACKRATECHANGEEventCallback): void;
on(event: VimeoPlayerVOLUMECHANGEEvent, callback: VimeoPlayerVOLUMECHANGEEventCallback): void;
on(event: VimeoPlayerCHAPTESRCHANGEEvent, callback: VimeoPlayerCHAPTERCHANGEEventCallback): void;
on(event: VimeoPlayerCUECHANGEEvent, callback: VimeoPlayerCUECHANGEEventCallback): void;
on(event: VimeoPlayerCUEPOINTEvent, callback: VimeoPlayerCUEPOINTEventCallback): void;
on(event: VimeoPlayerTEXTTRACKCHANGEEvent, callback: VimeoPlayerTEXTTRACKCHANGEEventCallback): void;
on(event: VimeoPlayerINTERACTIVEHOTSPOTCLICKEDEvent, callback: VimeoPlayerINTERACTIVEHOTSPOTCLICKEDEventCallback): void;
on(event: VimeoPlayerINTERACTIVEOVERPLAYPANELCLICKEDEvent, callback: VimeoPlayerINTERACTIVEOVERPLAYPANELCLICKEDEventCallback): void;
off(event: VimeoPlayerEvents, callback?: AnyFunction): void;
}
export interface VimeoPlayerConstructor {
new (container: HTMLElement | string, options?: Partial<VimeoEmbedOptions>): VimeoPlayer;
readonly prototype: VimeoPlayer;
}
export type Vimeo = {
Player: VimeoPlayerConstructor;
};
type TypeOfDashJS = typeof dashjs;

@@ -525,2 +730,3 @@ type DashJSLogLevel = TypeOfDashJS['LogLevel'];

SC: SoundCloud;
Vimeo: Vimeo;
FB: Facebook;

@@ -537,2 +743,3 @@ Twitch: Twitch;

export type GlobalSDKSoundCloudKey = Extract<GlobalSDKType, 'SC'>;
export type GlobalSDKVimeoKey = Extract<GlobalSDKType, 'Vimeo'>;
export type GlobalSDKFacebookKey = Extract<GlobalSDKType, 'FB'>;

@@ -548,2 +755,3 @@ export type GlobalSDKTwitchKey = Extract<GlobalSDKType, 'Twitch'>;

export type GlobalSDKSoundCloud = Extract<GlobalSDKValue, SoundCloud>;
export type GlobalSDKVimeo = Extract<GlobalSDKValue, Vimeo>;
export type GlobalSDKFacebook = Extract<GlobalSDKValue, Facebook>;

@@ -550,0 +758,0 @@ export type GlobalSDKTwitch = Extract<GlobalSDKValue, Twitch>;

7

dist/players/index.d.ts
import type { FilePlayerUrl } from './types';
import { canPlayYoutube, canPlayFile, canPlayTwitch, canPlaySoundCloud, canPlayMixcloud, canPlayDailyMotion, canPlayFacebook } from './patterns';
import { canPlayYoutube, canPlayFile, canPlayTwitch, canPlaySoundCloud, canPlayMixcloud, canPlayDailyMotion, canPlayFacebook, canPlayVimeo } from './patterns';
declare const players: readonly [{

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

}, {
readonly key: "vimeo";
readonly canPlay: typeof canPlayVimeo;
readonly canEnablePIP: undefined;
readonly loadComponent: () => Promise<typeof import("./Vimeo.svelte")>;
}, {
readonly key: "facebook";

@@ -16,0 +21,0 @@ readonly canPlay: typeof canPlayFacebook;

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

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

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

{
key: 'vimeo',
canPlay: canPlayVimeo,
canEnablePIP: undefined,
loadComponent: () => {
return import('./Vimeo.svelte');
}
},
{
key: 'facebook',

@@ -23,0 +31,0 @@ canPlay: canPlayFacebook,

import type { FilePlayerUrl } from './types';
export declare const MATCH_URL_YOUTUBE: RegExp;
export declare const MATCH_URL_SOUNDCLOUD: RegExp;
export declare const MATCH_URL_VIMEO: RegExp;
export declare const MATCH_URL_FACEBOOK: RegExp;

@@ -18,2 +19,3 @@ export declare const MATCH_URL_FACEBOOK_WATCH: RegExp;

export declare function canPlaySoundCloud(url: FilePlayerUrl): boolean;
export declare function canPlayVimeo(url: FilePlayerUrl): boolean;
export declare function canPlayFacebook(url: FilePlayerUrl): boolean;

@@ -20,0 +22,0 @@ export declare function canPlayTwitch(url: FilePlayerUrl): boolean;

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

export const MATCH_URL_SOUNDCLOUD = /(?:soundcloud\.com|snd\.sc)\/[^.]+$/;
export const MATCH_URL_VIMEO = /vimeo\.com\/(?!progressive_redirect).+/;
export const MATCH_URL_FACEBOOK = /^https?:\/\/(www\.)?facebook\.com.*\/(video(s)?|watch|story)(\.php?|\/).+$/;

@@ -41,2 +42,8 @@ export const MATCH_URL_FACEBOOK_WATCH = /^https?:\/\/fb\.watch\/.+$/;

}
export function canPlayVimeo(url) {
if (url instanceof Array) {
return false;
}
return MATCH_URL_VIMEO.test(url) && !VIDEO_EXTENSIONS.test(url) && !HLS_EXTENSIONS.test(url);
}
export function canPlayFacebook(url) {

@@ -43,0 +50,0 @@ if (url instanceof Array) {

4

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

@@ -6,0 +6,0 @@ url: string;

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

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

@@ -8,2 +8,3 @@ declare global {

SC: GlobalSDKSoundCloud;
Vimeo: GlobalSDKVimeo;
FB: GlobalSDKFacebook;

@@ -10,0 +11,0 @@ fbAsyncInit(): void;

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

},
vimeo: {
playerOptions: {
autopause: false,
byline: false,
portrait: false,
title: false
},
title: null
},
file: {

@@ -37,0 +46,0 @@ attributes: {},

@@ -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 | import("./players/global-types").SoundCloudPlayer | import("./players/global-types").MixcloudWidget | import("./players/global-types").DailyMotionPlayer | import("./players/global-types").FacebookPlayer | import("./players/global-types").NotImplementedPlayer | 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").MixcloudWidget | import("./players/global-types").DailyMotionPlayer | import("./players/global-types").FacebookPlayer | import("./players/global-types").VimeoPlayer | import("./players/global-types").NotImplementedPlayer | HTMLAudioElement | null) | undefined;
seekTo?: ((fraction: number, type?: SeekToType, keepPlaying?: boolean) => null | undefined) | undefined;

@@ -45,2 +45,3 @@ };

playbackQualityChange: any;
loaded: CustomEvent<undefined>;
mount: CustomEvent<undefined>;

@@ -51,3 +52,2 @@ bufferEnd: CustomEvent<Event | undefined>;

disablePIP: CustomEvent<Event>;
loaded: CustomEvent<undefined>;
ready: CustomEvent<PlayerRef>;

@@ -73,5 +73,5 @@ onClickPreview: CustomEvent<null>;

get getSecondsLoaded(): () => number | null;
get getInternalPlayer(): (key?: InternalPlayerKey) => import("./players/global-types").YTPlayer | import("./players/global-types").TwitchPlayer | import("./players/global-types").SoundCloudPlayer | import("./players/global-types").MixcloudWidget | import("./players/global-types").DailyMotionPlayer | import("./players/global-types").FacebookPlayer | import("./players/global-types").NotImplementedPlayer | 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").MixcloudWidget | import("./players/global-types").DailyMotionPlayer | import("./players/global-types").FacebookPlayer | import("./players/global-types").VimeoPlayer | 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/soundcloud-types';
import type { ViemoConfig } from './players/vimeo-types';
import type { FacebookConfig } from './players/facebook-types';

@@ -35,2 +36,3 @@ import type { TwitchConfig } from './players/twitch-types';

soundcloud: SoundCloudConfig;
vimeo: ViemoConfig;
facebook: FacebookConfig;

@@ -37,0 +39,0 @@ twitch: TwitchConfig;

{
"name": "svelte-player",
"version": "0.0.11",
"version": "0.0.12",
"license": "MIT",

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

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