@depup/react-player 3.4.0-depup.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/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright © Pete Cook http://cookpete.com
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,40 @@
1
+ # @depup/react-player
2
+
3
+ > Dependency-bumped version of [react-player](https://www.npmjs.com/package/react-player)
4
+
5
+ Generated by [DepUp](https://github.com/depup/npm) -- all production
6
+ dependencies bumped to latest versions.
7
+
8
+ ## Installation
9
+
10
+ ```bash
11
+ npm install @depup/react-player
12
+ ```
13
+
14
+ | Field | Value |
15
+ |-------|-------|
16
+ | Original | [react-player](https://www.npmjs.com/package/react-player) @ 3.4.0 |
17
+ | Processed | 2026-03-17 |
18
+ | Smoke test | passed |
19
+ | Deps updated | 10 |
20
+
21
+ ## Dependency Changes
22
+
23
+ | Dependency | From | To |
24
+ |------------|------|-----|
25
+ | @mux/mux-player-react | ^3.8.0 | ^3.11.5 |
26
+ | cloudflare-video-element | ^1.3.4 | ^1.3.5 |
27
+ | dash-video-element | ^0.3.0 | ^0.3.1 |
28
+ | hls-video-element | ^1.5.9 | ^1.5.10 |
29
+ | spotify-audio-element | ^1.0.3 | ^1.0.4 |
30
+ | tiktok-video-element | ^0.1.1 | ^0.1.2 |
31
+ | twitch-video-element | ^0.1.5 | ^0.1.6 |
32
+ | vimeo-video-element | ^1.6.1 | ^1.7.0 |
33
+ | wistia-video-element | ^1.3.5 | ^1.3.6 |
34
+ | youtube-video-element | ^1.8.0 | ^1.9.0 |
35
+
36
+ ---
37
+
38
+ Source: https://github.com/depup/npm | Original: https://www.npmjs.com/package/react-player
39
+
40
+ License inherited from the original package.
package/changes.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "bumped": {
3
+ "@mux/mux-player-react": {
4
+ "from": "^3.8.0",
5
+ "to": "^3.11.5"
6
+ },
7
+ "cloudflare-video-element": {
8
+ "from": "^1.3.4",
9
+ "to": "^1.3.5"
10
+ },
11
+ "dash-video-element": {
12
+ "from": "^0.3.0",
13
+ "to": "^0.3.1"
14
+ },
15
+ "hls-video-element": {
16
+ "from": "^1.5.9",
17
+ "to": "^1.5.10"
18
+ },
19
+ "spotify-audio-element": {
20
+ "from": "^1.0.3",
21
+ "to": "^1.0.4"
22
+ },
23
+ "tiktok-video-element": {
24
+ "from": "^0.1.1",
25
+ "to": "^0.1.2"
26
+ },
27
+ "twitch-video-element": {
28
+ "from": "^0.1.5",
29
+ "to": "^0.1.6"
30
+ },
31
+ "vimeo-video-element": {
32
+ "from": "^1.6.1",
33
+ "to": "^1.7.0"
34
+ },
35
+ "wistia-video-element": {
36
+ "from": "^1.3.5",
37
+ "to": "^1.3.6"
38
+ },
39
+ "youtube-video-element": {
40
+ "from": "^1.8.0",
41
+ "to": "^1.9.0"
42
+ }
43
+ },
44
+ "timestamp": "2026-03-17T18:41:46.110Z",
45
+ "totalUpdated": 10
46
+ }
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import type { VideoElementProps } from './types.js';
3
+ declare const HtmlPlayer: React.ForwardRefExoticComponent<Omit<VideoElementProps, "ref"> & React.RefAttributes<HTMLVideoElement>>;
4
+ export default HtmlPlayer;
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { AUDIO_EXTENSIONS } from "./patterns.js";
3
+ const HtmlPlayer = React.forwardRef((props, ref) => {
4
+ const Media = AUDIO_EXTENSIONS.test(`${props.src}`) ? "audio" : "video";
5
+ return /* @__PURE__ */ React.createElement(Media, { ...props, ref }, props.children);
6
+ });
7
+ var HtmlPlayer_default = HtmlPlayer;
8
+ export {
9
+ HtmlPlayer_default as default
10
+ };
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import type { PlayerEntry } from './players.js';
3
+ import type { ReactPlayerProps } from './types.js';
4
+ type Player = React.ForwardRefExoticComponent<ReactPlayerProps & {
5
+ activePlayer: PlayerEntry['player'];
6
+ }>;
7
+ declare const Player: Player;
8
+ export default Player;
package/dist/Player.js ADDED
@@ -0,0 +1,98 @@
1
+ import React, { useCallback, useEffect, useRef } from "react";
2
+ const Player = React.forwardRef((props, ref) => {
3
+ const { playing, pip } = props;
4
+ const Player2 = props.activePlayer;
5
+ const playerRef = useRef(null);
6
+ const startOnPlayRef = useRef(true);
7
+ useEffect(() => {
8
+ var _a, _b;
9
+ if (!playerRef.current) return;
10
+ if (playerRef.current.paused && playing === true) {
11
+ playerRef.current.play();
12
+ }
13
+ if (!playerRef.current.paused && playing === false) {
14
+ playerRef.current.pause();
15
+ }
16
+ playerRef.current.playbackRate = (_a = props.playbackRate) != null ? _a : 1;
17
+ playerRef.current.volume = (_b = props.volume) != null ? _b : 1;
18
+ });
19
+ useEffect(() => {
20
+ var _a, _b, _c, _d, _e;
21
+ if (!playerRef.current || !globalThis.document) return;
22
+ if (pip && !document.pictureInPictureElement) {
23
+ try {
24
+ (_b = (_a = playerRef.current).requestPictureInPicture) == null ? void 0 : _b.call(_a);
25
+ } catch (err) {
26
+ }
27
+ }
28
+ if (!pip && document.pictureInPictureElement) {
29
+ try {
30
+ (_d = (_c = playerRef.current).exitPictureInPicture) == null ? void 0 : _d.call(_c);
31
+ (_e = document.exitPictureInPicture) == null ? void 0 : _e.call(document);
32
+ } catch (err) {
33
+ }
34
+ }
35
+ }, [pip]);
36
+ const handleLoadStart = (event) => {
37
+ var _a, _b;
38
+ startOnPlayRef.current = true;
39
+ (_a = props.onReady) == null ? void 0 : _a.call(props);
40
+ (_b = props.onLoadStart) == null ? void 0 : _b.call(props, event);
41
+ };
42
+ const handlePlay = (event) => {
43
+ var _a, _b;
44
+ if (startOnPlayRef.current) {
45
+ startOnPlayRef.current = false;
46
+ (_a = props.onStart) == null ? void 0 : _a.call(props, event);
47
+ }
48
+ (_b = props.onPlay) == null ? void 0 : _b.call(props, event);
49
+ };
50
+ if (!Player2) {
51
+ return null;
52
+ }
53
+ const eventProps = {};
54
+ const reactPlayerEventHandlers = ["onReady", "onStart"];
55
+ for (const key in props) {
56
+ if (key.startsWith("on") && !reactPlayerEventHandlers.includes(key)) {
57
+ eventProps[key] = props[key];
58
+ }
59
+ }
60
+ return /* @__PURE__ */ React.createElement(
61
+ Player2,
62
+ {
63
+ ...eventProps,
64
+ style: props.style,
65
+ className: props.className,
66
+ slot: props.slot,
67
+ ref: useCallback(
68
+ (node) => {
69
+ playerRef.current = node;
70
+ if (typeof ref === "function") {
71
+ ref(node);
72
+ } else if (ref !== null) {
73
+ ref.current = node;
74
+ }
75
+ },
76
+ [ref]
77
+ ),
78
+ src: props.src,
79
+ crossOrigin: props.crossOrigin,
80
+ preload: props.preload,
81
+ controls: props.controls,
82
+ muted: props.muted,
83
+ autoPlay: props.autoPlay,
84
+ loop: props.loop,
85
+ playsInline: props.playsInline,
86
+ disableRemotePlayback: props.disableRemotePlayback,
87
+ config: props.config,
88
+ onLoadStart: handleLoadStart,
89
+ onPlay: handlePlay
90
+ },
91
+ props.children
92
+ );
93
+ });
94
+ Player.displayName = "Player";
95
+ var Player_default = Player;
96
+ export {
97
+ Player_default as default
98
+ };
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import type { PreviewProps } from './types';
3
+ declare const Preview: ({ src, light, oEmbedUrl, onClickPreview, playIcon, previewTabIndex, previewAriaLabel, }: PreviewProps) => React.JSX.Element;
4
+ export default Preview;
@@ -0,0 +1,100 @@
1
+ import React, { useState, useEffect } from "react";
2
+ const ICON_SIZE = "64px";
3
+ const cache = {};
4
+ const Preview = ({
5
+ src,
6
+ light,
7
+ oEmbedUrl,
8
+ onClickPreview,
9
+ playIcon,
10
+ previewTabIndex,
11
+ previewAriaLabel
12
+ }) => {
13
+ const [image, setImage] = useState(null);
14
+ useEffect(() => {
15
+ if (!src || !light || !oEmbedUrl) return;
16
+ fetchImage({ src, light, oEmbedUrl });
17
+ }, [src, light, oEmbedUrl]);
18
+ const fetchImage = async ({
19
+ src: src2,
20
+ light: light2,
21
+ oEmbedUrl: oEmbedUrl2
22
+ }) => {
23
+ if (React.isValidElement(light2)) {
24
+ return;
25
+ }
26
+ if (typeof light2 === "string") {
27
+ setImage(light2);
28
+ return;
29
+ }
30
+ if (cache[src2]) {
31
+ setImage(cache[src2]);
32
+ return;
33
+ }
34
+ setImage(null);
35
+ const response = await fetch(oEmbedUrl2.replace("{url}", src2));
36
+ const data = await response.json();
37
+ if (data.thumbnail_url) {
38
+ const fetchedImage = data.thumbnail_url.replace("height=100", "height=480").replace("-d_295x166", "-d_640");
39
+ setImage(fetchedImage);
40
+ cache[src2] = fetchedImage;
41
+ }
42
+ };
43
+ const handleKeyPress = (e) => {
44
+ if (e.key === "Enter" || e.key === " ") {
45
+ onClickPreview == null ? void 0 : onClickPreview(e);
46
+ }
47
+ };
48
+ const handleClick = (e) => {
49
+ onClickPreview == null ? void 0 : onClickPreview(e);
50
+ };
51
+ const isElement = React.isValidElement(light);
52
+ const flexCenter = {
53
+ display: "flex",
54
+ alignItems: "center",
55
+ justifyContent: "center"
56
+ };
57
+ const styles = {
58
+ preview: {
59
+ width: "100%",
60
+ height: "100%",
61
+ backgroundImage: image && !isElement ? `url(${image})` : void 0,
62
+ backgroundSize: "cover",
63
+ backgroundPosition: "center",
64
+ cursor: "pointer",
65
+ ...flexCenter
66
+ },
67
+ shadow: {
68
+ background: "radial-gradient(rgb(0, 0, 0, 0.3), rgba(0, 0, 0, 0) 60%)",
69
+ borderRadius: ICON_SIZE,
70
+ width: ICON_SIZE,
71
+ height: ICON_SIZE,
72
+ position: isElement ? "absolute" : void 0,
73
+ ...flexCenter
74
+ },
75
+ playIcon: {
76
+ borderStyle: "solid",
77
+ borderWidth: "16px 0 16px 26px",
78
+ borderColor: "transparent transparent transparent white",
79
+ marginLeft: "7px"
80
+ }
81
+ };
82
+ const defaultPlayIcon = /* @__PURE__ */ React.createElement("div", { style: styles.shadow, className: "react-player__shadow" }, /* @__PURE__ */ React.createElement("div", { style: styles.playIcon, className: "react-player__play-icon" }));
83
+ return /* @__PURE__ */ React.createElement(
84
+ "div",
85
+ {
86
+ style: styles.preview,
87
+ className: "react-player__preview",
88
+ tabIndex: previewTabIndex,
89
+ onClick: handleClick,
90
+ onKeyDown: handleKeyPress,
91
+ ...previewAriaLabel ? { "aria-label": previewAriaLabel } : {}
92
+ },
93
+ isElement ? light : null,
94
+ playIcon || defaultPlayIcon
95
+ );
96
+ };
97
+ var Preview_default = Preview;
98
+ export {
99
+ Preview_default as default
100
+ };
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import type { ReactPlayerProps } from './types.js';
3
+ import type { PlayerEntry } from './players.js';
4
+ type ReactPlayer = React.ForwardRefExoticComponent<Omit<ReactPlayerProps, 'ref'> & React.RefAttributes<HTMLVideoElement>> & Partial<{
5
+ addCustomPlayer: (player: PlayerEntry) => void;
6
+ removeCustomPlayers: () => void;
7
+ canPlay: (src: string) => boolean;
8
+ canEnablePIP: (src: string) => boolean;
9
+ }>;
10
+ export declare const createReactPlayer: (players: PlayerEntry[], playerFallback: PlayerEntry) => ReactPlayer;
11
+ export {};
@@ -0,0 +1,109 @@
1
+ import React, { lazy, Suspense, useEffect, useState } from "react";
2
+ import { defaultProps } from "./props.js";
3
+ import Player from "./Player.js";
4
+ const Preview = lazy(() => import(
5
+ /* webpackChunkName: 'reactPlayerPreview' */
6
+ "./Preview.js"
7
+ ));
8
+ const customPlayers = [];
9
+ const createReactPlayer = (players, playerFallback) => {
10
+ const getActivePlayer = (src) => {
11
+ for (const player of [...customPlayers, ...players]) {
12
+ if (src && player.canPlay(src)) {
13
+ return player;
14
+ }
15
+ }
16
+ if (playerFallback) {
17
+ return playerFallback;
18
+ }
19
+ return null;
20
+ };
21
+ const ReactPlayer = React.forwardRef((_props, ref) => {
22
+ const props = { ...defaultProps, ..._props };
23
+ const { src, slot, className, style, width, height, fallback, wrapper } = props;
24
+ const [showPreview, setShowPreview] = useState(!!props.light);
25
+ useEffect(() => {
26
+ if (props.light) {
27
+ setShowPreview(true);
28
+ } else {
29
+ setShowPreview(false);
30
+ }
31
+ }, [props.light]);
32
+ const handleClickPreview = (e) => {
33
+ var _a;
34
+ setShowPreview(false);
35
+ (_a = props.onClickPreview) == null ? void 0 : _a.call(props, e);
36
+ };
37
+ const renderPreview = (src2) => {
38
+ if (!src2) return null;
39
+ const { light, playIcon, previewTabIndex, oEmbedUrl, previewAriaLabel } = props;
40
+ return /* @__PURE__ */ React.createElement(
41
+ Preview,
42
+ {
43
+ src: src2,
44
+ light,
45
+ playIcon,
46
+ previewTabIndex,
47
+ previewAriaLabel,
48
+ oEmbedUrl,
49
+ onClickPreview: handleClickPreview
50
+ }
51
+ );
52
+ };
53
+ const renderActivePlayer = (src2) => {
54
+ var _a, _b;
55
+ const player = getActivePlayer(src2);
56
+ if (!player) return null;
57
+ const { style: style2, width: width2, height: height2, wrapper: wrapper2 } = props;
58
+ const config = (_a = props.config) == null ? void 0 : _a[player.key];
59
+ return /* @__PURE__ */ React.createElement(
60
+ Player,
61
+ {
62
+ ...props,
63
+ ref,
64
+ activePlayer: (_b = player.player) != null ? _b : player,
65
+ slot: wrapper2 ? void 0 : slot,
66
+ className: wrapper2 ? void 0 : className,
67
+ style: wrapper2 ? { display: "block", width: "100%", height: "100%" } : { display: "block", width: width2, height: height2, ...style2 },
68
+ config
69
+ }
70
+ );
71
+ };
72
+ const Wrapper = wrapper == null ? ForwardChildren : wrapper;
73
+ const UniversalSuspense = fallback === false ? ForwardChildren : Suspense;
74
+ return /* @__PURE__ */ React.createElement(Wrapper, { slot, className, style: { width, height, ...style } }, /* @__PURE__ */ React.createElement(UniversalSuspense, { fallback }, showPreview ? renderPreview(src) : renderActivePlayer(src)));
75
+ });
76
+ ReactPlayer.displayName = "ReactPlayer";
77
+ ReactPlayer.addCustomPlayer = (player) => {
78
+ customPlayers.push(player);
79
+ };
80
+ ReactPlayer.removeCustomPlayers = () => {
81
+ customPlayers.length = 0;
82
+ };
83
+ ReactPlayer.canPlay = (src) => {
84
+ if (src) {
85
+ for (const Player2 of [...customPlayers, ...players]) {
86
+ if (Player2.canPlay(src)) {
87
+ return true;
88
+ }
89
+ }
90
+ }
91
+ return false;
92
+ };
93
+ ReactPlayer.canEnablePIP = (src) => {
94
+ var _a;
95
+ if (src) {
96
+ for (const Player2 of [...customPlayers, ...players]) {
97
+ if (Player2.canPlay(src) && ((_a = Player2.canEnablePIP) == null ? void 0 : _a.call(Player2))) {
98
+ return true;
99
+ }
100
+ }
101
+ }
102
+ return false;
103
+ };
104
+ return ReactPlayer;
105
+ };
106
+ const ForwardChildren = ({ children }) => children;
107
+ export {
108
+ createReactPlayer
109
+ };
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ declare const _default: import("react").ForwardRefExoticComponent<Omit<import("./types.js").ReactPlayerProps, "ref"> & import("react").RefAttributes<HTMLVideoElement>> & Partial<{
3
+ addCustomPlayer: (player: import("./players.js").PlayerEntry) => void;
4
+ removeCustomPlayers: () => void;
5
+ canPlay: (src: string) => boolean;
6
+ canEnablePIP: (src: string) => boolean;
7
+ }>;
8
+ export default _default;
package/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+ "use client";
2
+ import players from "./players.js";
3
+ import { createReactPlayer } from "./ReactPlayer.js";
4
+ const fallback = players[players.length - 1];
5
+ var src_default = createReactPlayer(players, fallback);
6
+ export {
7
+ src_default as default
8
+ };
@@ -0,0 +1,23 @@
1
+ export declare const AUDIO_EXTENSIONS: RegExp;
2
+ export declare const VIDEO_EXTENSIONS: RegExp;
3
+ export declare const HLS_EXTENSIONS: RegExp;
4
+ export declare const DASH_EXTENSIONS: RegExp;
5
+ export declare const MATCH_URL_MUX: RegExp;
6
+ export declare const MATCH_URL_YOUTUBE: RegExp;
7
+ export declare const MATCH_URL_VIMEO: RegExp;
8
+ export declare const MATCH_URL_WISTIA: RegExp;
9
+ export declare const MATCH_URL_SPOTIFY: RegExp;
10
+ export declare const MATCH_URL_TWITCH: RegExp;
11
+ export declare const MATCH_URL_TIKTOK: RegExp;
12
+ export declare const canPlay: {
13
+ html: (url: string) => boolean;
14
+ hls: (url: string) => boolean;
15
+ dash: (url: string) => boolean;
16
+ mux: (url: string) => boolean;
17
+ youtube: (url: string) => boolean;
18
+ vimeo: (url: string) => boolean;
19
+ wistia: (url: string) => boolean;
20
+ spotify: (url: string) => boolean;
21
+ twitch: (url: string) => boolean;
22
+ tiktok: (url: string) => boolean;
23
+ };
@@ -0,0 +1,51 @@
1
+ const AUDIO_EXTENSIONS = /\.(m4a|m4b|mp4a|mpga|mp2|mp2a|mp3|m2a|m3a|wav|weba|aac|oga|spx)($|\?)/i;
2
+ const VIDEO_EXTENSIONS = /\.(mp4|og[gv]|webm|mov|m4v)(#t=[,\d+]+)?($|\?)/i;
3
+ const HLS_EXTENSIONS = /\.(m3u8)($|\?)/i;
4
+ const DASH_EXTENSIONS = /\.(mpd)($|\?)/i;
5
+ const MATCH_URL_MUX = /stream\.mux\.com\/(?!\w+\.m3u8)(\w+)/;
6
+ 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\//;
7
+ const MATCH_URL_VIMEO = /vimeo\.com\/(?!progressive_redirect).+/;
8
+ const MATCH_URL_WISTIA = /(?:wistia\.(?:com|net)|wi\.st)\/(?:medias|embed)\/(?:iframe\/)?([^?]+)/;
9
+ const MATCH_URL_SPOTIFY = /open\.spotify\.com\/(\w+)\/(\w+)/i;
10
+ const MATCH_URL_TWITCH = /(?:www\.|go\.)?twitch\.tv\/([a-zA-Z0-9_]+|(videos?\/|\?video=)\d+)($|\?)/;
11
+ const MATCH_URL_TIKTOK = /tiktok\.com\/(?:player\/v1\/|share\/video\/|@[^/]+\/video\/)([0-9]+)/;
12
+ const canPlayFile = (url, test) => {
13
+ if (Array.isArray(url)) {
14
+ for (const item of url) {
15
+ if (typeof item === "string" && canPlayFile(item, test)) {
16
+ return true;
17
+ }
18
+ if (canPlayFile(item.src, test)) {
19
+ return true;
20
+ }
21
+ }
22
+ return false;
23
+ }
24
+ return test(url);
25
+ };
26
+ const canPlay = {
27
+ html: (url) => canPlayFile(url, (u) => AUDIO_EXTENSIONS.test(u) || VIDEO_EXTENSIONS.test(u)),
28
+ hls: (url) => canPlayFile(url, (u) => HLS_EXTENSIONS.test(u)),
29
+ dash: (url) => canPlayFile(url, (u) => DASH_EXTENSIONS.test(u)),
30
+ mux: (url) => MATCH_URL_MUX.test(url),
31
+ youtube: (url) => MATCH_URL_YOUTUBE.test(url),
32
+ vimeo: (url) => MATCH_URL_VIMEO.test(url) && !VIDEO_EXTENSIONS.test(url) && !HLS_EXTENSIONS.test(url),
33
+ wistia: (url) => MATCH_URL_WISTIA.test(url),
34
+ spotify: (url) => MATCH_URL_SPOTIFY.test(url),
35
+ twitch: (url) => MATCH_URL_TWITCH.test(url),
36
+ tiktok: (url) => MATCH_URL_TIKTOK.test(url)
37
+ };
38
+ export {
39
+ AUDIO_EXTENSIONS,
40
+ DASH_EXTENSIONS,
41
+ HLS_EXTENSIONS,
42
+ MATCH_URL_MUX,
43
+ MATCH_URL_SPOTIFY,
44
+ MATCH_URL_TIKTOK,
45
+ MATCH_URL_TWITCH,
46
+ MATCH_URL_VIMEO,
47
+ MATCH_URL_WISTIA,
48
+ MATCH_URL_YOUTUBE,
49
+ VIDEO_EXTENSIONS,
50
+ canPlay
51
+ };
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import type { VideoElementProps } from './types.js';
3
+ export type PlayerEntry = {
4
+ key: string;
5
+ name: string;
6
+ canPlay: (src: string) => boolean;
7
+ canEnablePIP?: () => boolean;
8
+ player?: React.ComponentType<VideoElementProps> | React.LazyExoticComponent<React.ComponentType<VideoElementProps>>;
9
+ };
10
+ declare const Players: PlayerEntry[];
11
+ export default Players;
@@ -0,0 +1,122 @@
1
+ import { lazy } from "react";
2
+ import { canPlay } from "./patterns.js";
3
+ import HtmlPlayer from "./HtmlPlayer.js";
4
+ const Players = [
5
+ {
6
+ key: "hls",
7
+ name: "hls.js",
8
+ canPlay: canPlay.hls,
9
+ canEnablePIP: () => true,
10
+ player: lazy(
11
+ () => import(
12
+ /* webpackChunkName: 'reactPlayerHls' */
13
+ "hls-video-element/react"
14
+ )
15
+ )
16
+ },
17
+ {
18
+ key: "dash",
19
+ name: "dash.js",
20
+ canPlay: canPlay.dash,
21
+ canEnablePIP: () => true,
22
+ player: lazy(
23
+ () => import(
24
+ /* webpackChunkName: 'reactPlayerDash' */
25
+ "dash-video-element/react"
26
+ )
27
+ )
28
+ },
29
+ {
30
+ key: "mux",
31
+ name: "Mux",
32
+ canPlay: canPlay.mux,
33
+ canEnablePIP: () => true,
34
+ player: lazy(
35
+ () => import(
36
+ /* webpackChunkName: 'reactPlayerMux' */
37
+ "@mux/mux-player-react"
38
+ )
39
+ )
40
+ },
41
+ {
42
+ key: "youtube",
43
+ name: "YouTube",
44
+ canPlay: canPlay.youtube,
45
+ player: lazy(
46
+ () => import(
47
+ /* webpackChunkName: 'reactPlayerYouTube' */
48
+ "youtube-video-element/react"
49
+ )
50
+ )
51
+ },
52
+ {
53
+ key: "vimeo",
54
+ name: "Vimeo",
55
+ canPlay: canPlay.vimeo,
56
+ player: lazy(
57
+ () => import(
58
+ /* webpackChunkName: 'reactPlayerVimeo' */
59
+ "vimeo-video-element/react"
60
+ )
61
+ )
62
+ },
63
+ {
64
+ key: "wistia",
65
+ name: "Wistia",
66
+ canPlay: canPlay.wistia,
67
+ canEnablePIP: () => true,
68
+ player: lazy(
69
+ () => import(
70
+ /* webpackChunkName: 'reactPlayerWistia' */
71
+ "wistia-video-element/react"
72
+ )
73
+ )
74
+ },
75
+ {
76
+ key: "spotify",
77
+ name: "Spotify",
78
+ canPlay: canPlay.spotify,
79
+ canEnablePIP: () => false,
80
+ player: lazy(
81
+ () => import(
82
+ /* webpackChunkName: 'reactPlayerSpotify' */
83
+ "spotify-audio-element/react"
84
+ )
85
+ )
86
+ },
87
+ {
88
+ key: "twitch",
89
+ name: "Twitch",
90
+ canPlay: canPlay.twitch,
91
+ canEnablePIP: () => false,
92
+ player: lazy(
93
+ () => import(
94
+ /* webpackChunkName: 'reactPlayerTwitch' */
95
+ "twitch-video-element/react"
96
+ )
97
+ )
98
+ },
99
+ {
100
+ key: "tiktok",
101
+ name: "TikTok",
102
+ canPlay: canPlay.tiktok,
103
+ canEnablePIP: () => false,
104
+ player: lazy(
105
+ () => import(
106
+ /* webpackChunkName: 'reactPlayerTiktok' */
107
+ "tiktok-video-element/react"
108
+ )
109
+ )
110
+ },
111
+ {
112
+ key: "html",
113
+ name: "html",
114
+ canPlay: canPlay.html,
115
+ canEnablePIP: () => true,
116
+ player: HtmlPlayer
117
+ }
118
+ ];
119
+ var players_default = Players;
120
+ export {
121
+ players_default as default
122
+ };
@@ -0,0 +1,2 @@
1
+ import type { ReactPlayerProps } from './types.js';
2
+ export declare const defaultProps: ReactPlayerProps;
package/dist/props.js ADDED
@@ -0,0 +1,30 @@
1
+ const defaultProps = {
2
+ // Falsy values don't need to be defined
3
+ //
4
+ // native video attrs
5
+ // src: undefined,
6
+ // preload: undefined,
7
+ // crossOrigin: undefined,
8
+ // autoPlay: false,
9
+ // muted: false,
10
+ // loop: false,
11
+ // controls: false,
12
+ // playsInline: false,
13
+ // disableRemotePlayback: false,
14
+ width: "320px",
15
+ height: "180px",
16
+ // native video props
17
+ volume: 1,
18
+ playbackRate: 1,
19
+ // custom props
20
+ // playing: undefined,
21
+ // pip: false,
22
+ // light: false,
23
+ // fallback: null,
24
+ previewTabIndex: 0,
25
+ previewAriaLabel: "",
26
+ oEmbedUrl: "https://noembed.com/embed?url={url}"
27
+ };
28
+ export {
29
+ defaultProps
30
+ };
@@ -0,0 +1,53 @@
1
+ import type { MediaHTMLAttributes, SyntheticEvent } from 'react';
2
+ import type HlsVideoElement from 'hls-video-element';
3
+ import type SpotifyAudioElement from 'spotify-audio-element';
4
+ import type YouTubeVideoElement from 'youtube-video-element';
5
+ import type VimeoVideoElement from 'vimeo-video-element';
6
+ import type TwitchVideoElement from 'twitch-video-element';
7
+ import type TikTokVideoElement from 'tiktok-video-element';
8
+ interface VideoHTMLAttributes<T> extends MediaHTMLAttributes<T> {
9
+ height?: number | string | undefined;
10
+ playsInline?: boolean | undefined;
11
+ poster?: string | undefined;
12
+ width?: number | string | undefined;
13
+ disablePictureInPicture?: boolean | undefined;
14
+ disableRemotePlayback?: boolean | undefined;
15
+ onEnterPictureInPicture?: ((this: HTMLVideoElement, ev: Event) => void) | undefined;
16
+ onLeavePictureInPicture?: ((this: HTMLVideoElement, ev: Event) => void) | undefined;
17
+ }
18
+ export interface VideoElementProps extends React.DetailedHTMLProps<VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement> {
19
+ playbackRate?: number;
20
+ volume?: number;
21
+ config?: Config;
22
+ }
23
+ export interface ReactPlayerProps extends PreviewProps, VideoElementProps {
24
+ config?: Config;
25
+ fallback?: React.ReactNode;
26
+ onReady?: () => void;
27
+ onStart?: (event: SyntheticEvent<HTMLVideoElement>) => void;
28
+ pip?: boolean;
29
+ playing?: boolean;
30
+ wrapper?: string | React.ComponentType<React.HTMLAttributes<HTMLDivElement>>;
31
+ }
32
+ export interface PreviewProps {
33
+ src?: string;
34
+ light?: boolean | string | React.ReactElement;
35
+ oEmbedUrl?: string;
36
+ onClickPreview?: (event: React.SyntheticEvent) => void;
37
+ playIcon?: React.ReactNode;
38
+ previewAriaLabel?: string;
39
+ previewTabIndex?: number;
40
+ }
41
+ export interface Config {
42
+ dash?: Record<string, unknown>;
43
+ hls?: HlsVideoElement['config'];
44
+ html?: Record<string, unknown>;
45
+ mux?: Record<string, unknown>;
46
+ spotify?: SpotifyAudioElement['config'];
47
+ tiktok?: TikTokVideoElement['config'];
48
+ twitch?: TwitchVideoElement['config'];
49
+ vimeo?: VimeoVideoElement['config'];
50
+ wistia?: Record<string, unknown>;
51
+ youtube?: YouTubeVideoElement['config'];
52
+ }
53
+ export {};
package/dist/types.js ADDED
File without changes
package/package.json ADDED
@@ -0,0 +1,160 @@
1
+ {
2
+ "name": "@depup/react-player",
3
+ "version": "3.4.0-depup.0",
4
+ "description": "[DepUp] A React component for playing a variety of URLs, including file paths, Mux, YouTube, Vimeo, and Wistia",
5
+ "author": "Pete Cook (https://github.com/cookpete)",
6
+ "license": "MIT",
7
+ "homepage": "https://github.com/cookpete/react-player",
8
+ "bugs": {
9
+ "url": "https://github.com/cookpete/react-player/issues"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/cookpete/react-player.git"
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "changes.json",
18
+ "README.md"
19
+ ],
20
+ "main": "dist/index.js",
21
+ "type": "module",
22
+ "exports": {
23
+ ".": {
24
+ "types": "./dist/index.d.ts",
25
+ "default": "./dist/index.js"
26
+ },
27
+ "./*": {
28
+ "types": "./dist/*.d.ts",
29
+ "default": "./dist/*.js"
30
+ }
31
+ },
32
+ "scripts": {
33
+ "clean": "rimraf dist demo coverage",
34
+ "start": "run-p 'types -- -w' 'build:esm -- --watch=forever' 'build:demo -- --watch=forever --servedir=demo'",
35
+ "lint": "biome lint src/*",
36
+ "test": "tester test/*.tsx test/*/*.tsx test/*.js test/*/*.js --outdir=disttest --platform=node --format=esm --bundle --external:sinon --external:zora --target=esnext --sourcemap=inline",
37
+ "test:coverage": "c8 --src src --exclude 'test/**' --exclude 'node_modules/**' --exclude 'scripts/**' --exclude-after-remap npm test",
38
+ "test:codecov": "npm run test:coverage && c8 report --reporter json && codecov -f coverage/coverage-final.json",
39
+ "types": "tsc",
40
+ "build": "run-s types build:*",
41
+ "build:esm": "builder \"src/**/*.*s*\" --outdir=dist --format=esm",
42
+ "prebuild:demo": "rimraf demo && cp -r examples/react/public demo",
43
+ "build:demo": "builder ./examples/react/src/index.js --format=esm --splitting --bundle --outdir=demo --minify",
44
+ "preversion": "run-s lint test",
45
+ "version": "auto-changelog -p && git add CHANGELOG.md",
46
+ "postpublish": "npm run clean"
47
+ },
48
+ "peerDependencies": {
49
+ "@types/react": "^17.0.0 || ^18 || ^19",
50
+ "react": "^17.0.2 || ^18 || ^19",
51
+ "react-dom": "^17.0.2 || ^18 || ^19"
52
+ },
53
+ "dependencies": {
54
+ "@mux/mux-player-react": "^3.11.5",
55
+ "cloudflare-video-element": "^1.3.5",
56
+ "dash-video-element": "^0.3.1",
57
+ "hls-video-element": "^1.5.10",
58
+ "spotify-audio-element": "^1.0.4",
59
+ "tiktok-video-element": "^0.1.2",
60
+ "twitch-video-element": "^0.1.6",
61
+ "vimeo-video-element": "^1.7.0",
62
+ "wistia-video-element": "^1.3.6",
63
+ "youtube-video-element": "^1.9.0"
64
+ },
65
+ "devDependencies": {
66
+ "@biomejs/biome": "1.8.2",
67
+ "@types/node": "^20.14.6",
68
+ "@types/react": "^18.3.3",
69
+ "@types/react-dom": "^18.3.0",
70
+ "@types/react-test-renderer": "^18.3.0",
71
+ "auto-changelog": "^2.0.0",
72
+ "builder": "file:./scripts/builder",
73
+ "c8": "^8.0.1",
74
+ "codecov": "^3.6.5",
75
+ "cross-env": "^7.0.2",
76
+ "esbuild": "^0.21.5",
77
+ "npm-run-all": "^4.1.5",
78
+ "react": "^18.3.1",
79
+ "react-dom": "^18.3.1",
80
+ "react-test-renderer": "^18.3.1",
81
+ "rimraf": "^3.0.2",
82
+ "screenfull": "^5.0.2",
83
+ "sinon": "^16.0.0",
84
+ "tester": "file:./scripts/tester",
85
+ "typescript": "^5.4.5",
86
+ "zora": "^5.2.0"
87
+ },
88
+ "auto-changelog": {
89
+ "breakingPattern": "Breaking changes:"
90
+ },
91
+ "sideEffects": [
92
+ "./test/**/*"
93
+ ],
94
+ "keywords": [
95
+ "depup",
96
+ "dependency-bumped",
97
+ "updated-deps",
98
+ "react-player",
99
+ "react",
100
+ "media",
101
+ "player",
102
+ "video",
103
+ "audio",
104
+ "youtube",
105
+ "vimeo",
106
+ "wistia",
107
+ "hls",
108
+ "dash",
109
+ "react-component"
110
+ ],
111
+ "depup": {
112
+ "changes": {
113
+ "@mux/mux-player-react": {
114
+ "from": "^3.8.0",
115
+ "to": "^3.11.5"
116
+ },
117
+ "cloudflare-video-element": {
118
+ "from": "^1.3.4",
119
+ "to": "^1.3.5"
120
+ },
121
+ "dash-video-element": {
122
+ "from": "^0.3.0",
123
+ "to": "^0.3.1"
124
+ },
125
+ "hls-video-element": {
126
+ "from": "^1.5.9",
127
+ "to": "^1.5.10"
128
+ },
129
+ "spotify-audio-element": {
130
+ "from": "^1.0.3",
131
+ "to": "^1.0.4"
132
+ },
133
+ "tiktok-video-element": {
134
+ "from": "^0.1.1",
135
+ "to": "^0.1.2"
136
+ },
137
+ "twitch-video-element": {
138
+ "from": "^0.1.5",
139
+ "to": "^0.1.6"
140
+ },
141
+ "vimeo-video-element": {
142
+ "from": "^1.6.1",
143
+ "to": "^1.7.0"
144
+ },
145
+ "wistia-video-element": {
146
+ "from": "^1.3.5",
147
+ "to": "^1.3.6"
148
+ },
149
+ "youtube-video-element": {
150
+ "from": "^1.8.0",
151
+ "to": "^1.9.0"
152
+ }
153
+ },
154
+ "depsUpdated": 10,
155
+ "originalPackage": "react-player",
156
+ "originalVersion": "3.4.0",
157
+ "processedAt": "2026-03-17T18:41:59.597Z",
158
+ "smokeTest": "passed"
159
+ }
160
+ }