Skip to content

Commit

Permalink
fix: Fix autoplay setting for YouTube videos
Browse files Browse the repository at this point in the history
  • Loading branch information
Maham Akif authored and Maham Akif committed Aug 13, 2024
1 parent 8d4a976 commit 0e105bd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/video/VideoPlayer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import VideoJS from './VideoJS';

const hlsExtension = '.m3u8';
const defaultOptions = {
autoplay: false,
autoplay: true,
controls: true,
responsive: true,
fluid: true,
Expand All @@ -17,6 +17,8 @@ const VideoPlayer = ({ videoURL, onReady, customOptions }) => {
if (isMp4Video) {
return {
...defaultOptions,
// Disable autoplay if `showTranscripts` is enabled (video detail page); enable autoplay otherwise.
autoplay: !customOptions?.showTranscripts,
sources: [{ src: videoURL, type: 'video/mp4' }],
};
}
Expand Down

0 comments on commit 0e105bd

Please sign in to comment.