mirror of
https://github.com/mediacms-io/mediacms.git
synced 2025-11-08 00:18: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 {
|
||||
constructor(player, options) {
|
||||
super(player, options);
|
||||
this.nextLink = options.nextLink || '';
|
||||
}
|
||||
|
||||
createEl() {
|
||||
@ -42,6 +43,7 @@ class NextVideoButton extends Button {
|
||||
}
|
||||
|
||||
handleClick() {
|
||||
console.log('NextVideoButton handleClick', this.nextLink);
|
||||
this.player().trigger('nextVideo');
|
||||
}
|
||||
}
|
||||
|
||||
@ -562,6 +562,7 @@ function VideoJSPlayer() {
|
||||
},
|
||||
siteUrl: '',
|
||||
hasNextLink: true,
|
||||
nextLink: 'https://demo.mediacms.io/view?m=YjGJafibO',
|
||||
},
|
||||
[]
|
||||
);
|
||||
@ -588,6 +589,7 @@ function VideoJSPlayer() {
|
||||
poster: mediaData.siteUrl + mediaData.data?.poster_url || '',
|
||||
previewSprite: mediaData?.previewSprite || {},
|
||||
related_media: mediaData.data?.related_media || [],
|
||||
nextLink: mediaData.nextLink || '',
|
||||
sources: mediaData.data?.original_media_url
|
||||
? [
|
||||
{
|
||||
@ -1023,7 +1025,9 @@ function VideoJSPlayer() {
|
||||
|
||||
// BEGIN: Implement custom next video button
|
||||
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
|
||||
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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user