Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions examples/react/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,12 @@ const App = () => {
{renderLoadButton('https://www.tiktok.com/@scout2015/video/6718335390845095173', 'Test B')}
</td>
</tr>
<tr>
<th>PeerTube</th>
<td>
{renderLoadButton('https://video.mshparisnord.fr/w/p/aWDVVLYnVGutCDQogoEDf4', 'Test A')}
</td>
</tr>
<tr>
<th>Custom</th>
<td>
Expand Down
20 changes: 20 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"cloudflare-video-element": "^1.3.4",
"dash-video-element": "^0.3.0",
"hls-video-element": "^1.5.9",
"peertube-video-element": "^1.1.0",
"spotify-audio-element": "^1.0.3",
"tiktok-video-element": "^0.1.1",
"twitch-video-element": "^0.1.5",
Expand Down
3 changes: 3 additions & 0 deletions src/patterns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export const MATCH_URL_WISTIA =
export const MATCH_URL_SPOTIFY = /open\.spotify\.com\/(\w+)\/(\w+)/i;
export const MATCH_URL_TWITCH = /(?:www\.|go\.)?twitch\.tv\/([a-zA-Z0-9_]+|(videos?\/|\?video=)\d+)($|\?)/;
export const MATCH_URL_TIKTOK = /tiktok\.com\/(?:player\/v1\/|share\/video\/|@[^/]+\/video\/)([0-9]+)/;
export const MATCH_URL_PEERTUBE = /(?:videos\/(?:watch|embed)|\/w)\/([^/?#&\s]+)/;


const canPlayFile = (url: string, test: (u: string) => boolean) => {
if (Array.isArray(url)) {
Expand Down Expand Up @@ -42,4 +44,5 @@ export const canPlay = {
spotify: (url: string) => MATCH_URL_SPOTIFY.test(url),
twitch: (url: string) => MATCH_URL_TWITCH.test(url),
tiktok: (url: string) => MATCH_URL_TIKTOK.test(url),
peertube: (url: string)=> MATCH_URL_PEERTUBE.test(url)
};
9 changes: 9 additions & 0 deletions src/players.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,15 @@ const Players: PlayerEntry[] = [
() => import(/* webpackChunkName: 'reactPlayerTiktok' */ 'tiktok-video-element/react')
) as React.LazyExoticComponent<React.ComponentType<VideoElementProps>>,
},
{
key: 'peertube',
name: 'PeerTube',
canPlay: canPlay.peertube,
canEnablePIP: () => false,
player: lazy(
() => import(/* webpackChunkName: 'reactPlayerTiktok' */ 'peertube-video-element/react')
) as React.LazyExoticComponent<React.ComponentType<VideoElementProps>>,
},
{
key: 'html',
name: 'html',
Expand Down
2 changes: 2 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type YouTubeVideoElement from 'youtube-video-element';
import type VimeoVideoElement from 'vimeo-video-element';
import type TwitchVideoElement from 'twitch-video-element';
import type TikTokVideoElement from 'tiktok-video-element';
import type PeerTubeVideoElement from 'peertube-video-element';

interface VideoHTMLAttributes<T> extends MediaHTMLAttributes<T> {
height?: number | string | undefined;
Expand Down Expand Up @@ -55,4 +56,5 @@ export interface Config {
vimeo?: VimeoVideoElement['config'];
wistia?: Record<string, unknown>;
youtube?: YouTubeVideoElement['config'];
peertube?: PeerTubeVideoElement['config'];
}