mirror of
https://github.com/mediacms-io/mediacms.git
synced 2025-11-11 01:48:53 -05:00
feat: Skip the autoplay if is playlist by passing the isPlayList to the video.js
This commit is contained in:
parent
8201d523d0
commit
f3888981db
@ -1039,6 +1039,7 @@ function VideoJSPlayer({ videoId = 'default-video' }) {
|
|||||||
|
|
||||||
// other
|
// other
|
||||||
useRoundedCorners: false,
|
useRoundedCorners: false,
|
||||||
|
isPlayList: true,
|
||||||
previewSprite: {
|
previewSprite: {
|
||||||
url: 'https://deic.mediacms.io/media/original/thumbnails/user/thorkild/2ca18fadeef8475eae513c12cc0830d3.19990812hd_1920_1080_30fps.mp4sprites.jpg',
|
url: 'https://deic.mediacms.io/media/original/thumbnails/user/thorkild/2ca18fadeef8475eae513c12cc0830d3.19990812hd_1920_1080_30fps.mp4sprites.jpg',
|
||||||
frame: { width: 160, height: 90, seconds: 10 },
|
frame: { width: 160, height: 90, seconds: 10 },
|
||||||
@ -1293,6 +1294,7 @@ function VideoJSPlayer({ videoId = 'default-video' }) {
|
|||||||
poster: mediaData.data?.poster_url ? mediaData.siteUrl + mediaData.data.poster_url : '',
|
poster: mediaData.data?.poster_url ? mediaData.siteUrl + mediaData.data.poster_url : '',
|
||||||
previewSprite: mediaData?.previewSprite || {},
|
previewSprite: mediaData?.previewSprite || {},
|
||||||
useRoundedCorners: mediaData?.useRoundedCorners,
|
useRoundedCorners: mediaData?.useRoundedCorners,
|
||||||
|
isPlayList: mediaData?.isPlayList,
|
||||||
related_media: mediaData.data?.related_media || [],
|
related_media: mediaData.data?.related_media || [],
|
||||||
nextLink: mediaData?.nextLink || null,
|
nextLink: mediaData?.nextLink || null,
|
||||||
urlAutoplay: mediaData?.urlAutoplay || true,
|
urlAutoplay: mediaData?.urlAutoplay || true,
|
||||||
@ -2538,6 +2540,21 @@ function VideoJSPlayer({ videoId = 'default-video' }) {
|
|||||||
const hasNextVideo = mediaData.nextLink !== null;
|
const hasNextVideo = mediaData.nextLink !== null;
|
||||||
|
|
||||||
if (!isEmbedPlayer && isAutoplayEnabled && hasNextVideo) {
|
if (!isEmbedPlayer && isAutoplayEnabled && hasNextVideo) {
|
||||||
|
// If it's a playlist, skip countdown and play directly
|
||||||
|
if (currentVideo.isPlayList) {
|
||||||
|
// Clean up any existing overlays
|
||||||
|
if (endScreen) {
|
||||||
|
playerRef.current.removeChild(endScreen);
|
||||||
|
endScreen = null;
|
||||||
|
}
|
||||||
|
if (autoplayCountdown) {
|
||||||
|
playerRef.current.removeChild(autoplayCountdown);
|
||||||
|
autoplayCountdown = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Play next video directly without countdown
|
||||||
|
goToNextVideo();
|
||||||
|
} else {
|
||||||
// Get next video data for countdown display - find the next video in related videos
|
// Get next video data for countdown display - find the next video in related videos
|
||||||
let nextVideoData = {
|
let nextVideoData = {
|
||||||
title: 'Next Video',
|
title: 'Next Video',
|
||||||
@ -2548,8 +2565,6 @@ function VideoJSPlayer({ videoId = 'default-video' }) {
|
|||||||
|
|
||||||
// Try to find the next video by URL matching or just use the first related video
|
// Try to find the next video by URL matching or just use the first related video
|
||||||
if (relatedVideos.length > 0) {
|
if (relatedVideos.length > 0) {
|
||||||
// For now, use the first related video as the next video
|
|
||||||
// In a real implementation, you might want to find the specific next video
|
|
||||||
const nextVideo = relatedVideos[0];
|
const nextVideo = relatedVideos[0];
|
||||||
nextVideoData = {
|
nextVideoData = {
|
||||||
title: nextVideo.title || 'Next Video',
|
title: nextVideo.title || 'Next Video',
|
||||||
@ -2572,7 +2587,7 @@ function VideoJSPlayer({ videoId = 'default-video' }) {
|
|||||||
// Show autoplay countdown
|
// Show autoplay countdown
|
||||||
autoplayCountdown = new AutoplayCountdownOverlay(playerRef.current, {
|
autoplayCountdown = new AutoplayCountdownOverlay(playerRef.current, {
|
||||||
nextVideoData: nextVideoData,
|
nextVideoData: nextVideoData,
|
||||||
countdownSeconds: 5,
|
countdownSeconds: 500,
|
||||||
onPlayNext: () => {
|
onPlayNext: () => {
|
||||||
goToNextVideo();
|
goToNextVideo();
|
||||||
},
|
},
|
||||||
@ -2588,6 +2603,7 @@ function VideoJSPlayer({ videoId = 'default-video' }) {
|
|||||||
|
|
||||||
playerRef.current.addChild(autoplayCountdown);
|
playerRef.current.addChild(autoplayCountdown);
|
||||||
autoplayCountdown.startCountdown();
|
autoplayCountdown.startCountdown();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Autoplay disabled or no next video - show regular end screen
|
// Autoplay disabled or no next video - show regular end screen
|
||||||
showEndScreen();
|
showEndScreen();
|
||||||
|
|||||||
@ -16,6 +16,7 @@ import React, { useEffect, useRef } from 'react';
|
|||||||
const VideoJSEmbed = ({
|
const VideoJSEmbed = ({
|
||||||
data,
|
data,
|
||||||
useRoundedCorners,
|
useRoundedCorners,
|
||||||
|
isPlayList,
|
||||||
playerVolume,
|
playerVolume,
|
||||||
playerSoundMuted,
|
playerSoundMuted,
|
||||||
videoQuality,
|
videoQuality,
|
||||||
@ -66,6 +67,7 @@ const VideoJSEmbed = ({
|
|||||||
window.MEDIA_DATA = {
|
window.MEDIA_DATA = {
|
||||||
data: data || {},
|
data: data || {},
|
||||||
useRoundedCorners: useRoundedCorners,
|
useRoundedCorners: useRoundedCorners,
|
||||||
|
isPlayList: isPlayList,
|
||||||
playerVolume: playerVolume || 0.5,
|
playerVolume: playerVolume || 0.5,
|
||||||
playerSoundMuted: playerSoundMuted || (urlMuted === '1'),
|
playerSoundMuted: playerSoundMuted || (urlMuted === '1'),
|
||||||
videoQuality: videoQuality || 'auto',
|
videoQuality: videoQuality || 'auto',
|
||||||
|
|||||||
@ -392,6 +392,7 @@ export default class VideoViewer extends React.PureComponent {
|
|||||||
return React.createElement(VideoJSEmbed, {
|
return React.createElement(VideoJSEmbed, {
|
||||||
data: this.props.data,
|
data: this.props.data,
|
||||||
useRoundedCorners: site.useRoundedCorners,
|
useRoundedCorners: site.useRoundedCorners,
|
||||||
|
isPlayList: !!MediaPageStore.get('playlist-id'),
|
||||||
playerVolume: this.browserCache.get('player-volume'),
|
playerVolume: this.browserCache.get('player-volume'),
|
||||||
playerSoundMuted: this.browserCache.get('player-sound-muted'),
|
playerSoundMuted: this.browserCache.get('player-sound-muted'),
|
||||||
videoQuality: this.browserCache.get('video-quality'),
|
videoQuality: this.browserCache.get('video-quality'),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user