mirror of
https://github.com/mediacms-io/mediacms.git
synced 2025-11-08 08:28:54 -05:00
fix: Next video link
This commit is contained in:
parent
df2e168184
commit
de520e9faa
@ -6,6 +6,7 @@ const Button = videojs.getComponent('Button');
|
|||||||
class NextVideoButton extends Button {
|
class NextVideoButton extends Button {
|
||||||
constructor(player, options) {
|
constructor(player, options) {
|
||||||
super(player, options);
|
super(player, options);
|
||||||
|
this.nextLink = options.nextLink || '';
|
||||||
}
|
}
|
||||||
|
|
||||||
createEl() {
|
createEl() {
|
||||||
@ -42,6 +43,7 @@ class NextVideoButton extends Button {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleClick() {
|
handleClick() {
|
||||||
|
console.log('NextVideoButton handleClick', this.nextLink);
|
||||||
this.player().trigger('nextVideo');
|
this.player().trigger('nextVideo');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -562,6 +562,7 @@ function VideoJSPlayer() {
|
|||||||
},
|
},
|
||||||
siteUrl: '',
|
siteUrl: '',
|
||||||
hasNextLink: true,
|
hasNextLink: true,
|
||||||
|
nextLink: 'https://demo.mediacms.io/view?m=YjGJafibO',
|
||||||
},
|
},
|
||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
@ -588,6 +589,7 @@ function VideoJSPlayer() {
|
|||||||
poster: mediaData.siteUrl + mediaData.data?.poster_url || '',
|
poster: mediaData.siteUrl + mediaData.data?.poster_url || '',
|
||||||
previewSprite: mediaData?.previewSprite || {},
|
previewSprite: mediaData?.previewSprite || {},
|
||||||
related_media: mediaData.data?.related_media || [],
|
related_media: mediaData.data?.related_media || [],
|
||||||
|
nextLink: mediaData.nextLink || '',
|
||||||
sources: mediaData.data?.original_media_url
|
sources: mediaData.data?.original_media_url
|
||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
@ -1023,7 +1025,9 @@ function VideoJSPlayer() {
|
|||||||
|
|
||||||
// BEGIN: Implement custom next video button
|
// BEGIN: Implement custom next video button
|
||||||
if (mediaData.hasNextLink) {
|
if (mediaData.hasNextLink) {
|
||||||
const nextVideoButton = new NextVideoButton(playerRef.current);
|
const nextVideoButton = new NextVideoButton(playerRef.current, {
|
||||||
|
nextLink: mediaData.nextLink,
|
||||||
|
});
|
||||||
const playToggleIndex = controlBar.children().indexOf(playToggle); // Insert it after play button
|
const playToggleIndex = controlBar.children().indexOf(playToggle); // Insert it after play button
|
||||||
controlBar.addChild(nextVideoButton, {}, playToggleIndex + 1);
|
controlBar.addChild(nextVideoButton, {}, playToggleIndex + 1);
|
||||||
}
|
}
|
||||||
@ -1659,7 +1663,12 @@ function VideoJSPlayer() {
|
|||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return <video ref={videoRef} className="video-js vjs-default-skin" tabIndex="0" />;
|
return (
|
||||||
|
<>
|
||||||
|
<video ref={videoRef} className="video-js vjs-default-skin" tabIndex="0" />
|
||||||
|
<em>nextLink: {currentVideo.nextLink}</em>
|
||||||
|
</>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default VideoJSPlayer;
|
export default VideoJSPlayer;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user