mirror of
https://github.com/mediacms-io/mediacms.git
synced 2025-11-08 08:28:54 -05:00
dev mode is now handle from env file
This commit is contained in:
parent
d702689a0c
commit
5474db0b86
4
frontend-tools/video-js/.env.example
Normal file
4
frontend-tools/video-js/.env.example
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# Copy this file to .env and adjust values as needed
|
||||||
|
|
||||||
|
# Set to true to enable development mode
|
||||||
|
VITE_DEV_MODE=true
|
||||||
1
frontend-tools/video-js/.gitignore
vendored
1
frontend-tools/video-js/.gitignore
vendored
@ -22,3 +22,4 @@ dist-ssr
|
|||||||
*.njsproj
|
*.njsproj
|
||||||
*.sln
|
*.sln
|
||||||
*.sw?
|
*.sw?
|
||||||
|
.env
|
||||||
|
|||||||
@ -24,9 +24,9 @@ function VideoJSPlayer({ videoId = 'default-video' }) {
|
|||||||
// Check if this is an embed player (disable next video and autoplay features)
|
// Check if this is an embed player (disable next video and autoplay features)
|
||||||
const isEmbedPlayer = videoId === 'video-embed';
|
const isEmbedPlayer = videoId === 'video-embed';
|
||||||
|
|
||||||
const enableDevEnvironment = true;
|
// Environment-based development mode configuration
|
||||||
const isDevelopment = enableDevEnvironment || window.location.hostname.includes('vercel.app');
|
const isDevMode = import.meta.env.VITE_DEV_MODE === 'true' || window.location.hostname.includes('vercel.app');
|
||||||
console.log('isDevelopment', isDevelopment);
|
console.log('isDevMode', isDevMode);
|
||||||
console.log('window.location.hostname', window.location.hostname);
|
console.log('window.location.hostname', window.location.hostname);
|
||||||
|
|
||||||
// Safely access window.MEDIA_DATA with fallback using useMemo
|
// Safely access window.MEDIA_DATA with fallback using useMemo
|
||||||
@ -1060,7 +1060,7 @@ function VideoJSPlayer({ videoId = 'default-video' }) {
|
|||||||
const chaptersData =
|
const chaptersData =
|
||||||
mediaData?.data?.chapter_data && mediaData?.data?.chapter_data.length > 0
|
mediaData?.data?.chapter_data && mediaData?.data?.chapter_data.length > 0
|
||||||
? mediaData?.data?.chapter_data
|
? mediaData?.data?.chapter_data
|
||||||
: isDevelopment
|
: isDevMode
|
||||||
? [
|
? [
|
||||||
{ startTime: 0, endTime: 4, text: 'Introduction' },
|
{ startTime: 0, endTime: 4, text: 'Introduction' },
|
||||||
{ startTime: 5, endTime: 10, text: 'Overview of Marine Life' },
|
{ startTime: 5, endTime: 10, text: 'Overview of Marine Life' },
|
||||||
@ -1374,7 +1374,7 @@ function VideoJSPlayer({ videoId = 'default-video' }) {
|
|||||||
// const demoSubtitleTracks = []; // NO Subtitles. TODO: hide it on production
|
// const demoSubtitleTracks = []; // NO Subtitles. TODO: hide it on production
|
||||||
|
|
||||||
// Get subtitle tracks from backend response or fallback based on environment
|
// Get subtitle tracks from backend response or fallback based on environment
|
||||||
const backendSubtitles = mediaData?.data?.subtitles_info || (isDevelopment ? demoSubtitleTracks : []);
|
const backendSubtitles = mediaData?.data?.subtitles_info || (isDevMode ? demoSubtitleTracks : []);
|
||||||
const hasSubtitles = backendSubtitles.length > 0;
|
const hasSubtitles = backendSubtitles.length > 0;
|
||||||
const subtitleTracks = hasSubtitles
|
const subtitleTracks = hasSubtitles
|
||||||
? backendSubtitles.map((track) => ({
|
? backendSubtitles.map((track) => ({
|
||||||
@ -1841,7 +1841,7 @@ function VideoJSPlayer({ videoId = 'default-video' }) {
|
|||||||
// END: Implement custom time display component
|
// END: Implement custom time display component
|
||||||
|
|
||||||
// BEGIN: Implement custom next video button
|
// BEGIN: Implement custom next video button
|
||||||
if (!isEmbedPlayer && (mediaData?.nextLink || isDevelopment)) {
|
if (!isEmbedPlayer && (mediaData?.nextLink || isDevMode)) {
|
||||||
// it seems that the nextLink is not always available, and it is need the this.player().trigger('nextVideo'); from NextVideoButton.js // TODO: remove the 1===1 and the mediaData?.nextLink
|
// it seems that the nextLink is not always available, and it is need the this.player().trigger('nextVideo'); from NextVideoButton.js // TODO: remove the 1===1 and the mediaData?.nextLink
|
||||||
const nextVideoButton = new NextVideoButton(playerRef.current, {
|
const nextVideoButton = new NextVideoButton(playerRef.current, {
|
||||||
nextLink: mediaData.nextLink,
|
nextLink: mediaData.nextLink,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user