Skip to content

Commit

Permalink
fix: video don't refresh after clicking on Mark as Complete/Incomplete
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruvilmehta committed Mar 29, 2024
1 parent c20e36f commit f5a8082
Showing 1 changed file with 19 additions and 22 deletions.
41 changes: 19 additions & 22 deletions src/components/admin/ContentRendererClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useSearchParams, useRouter } from 'next/navigation';
// import { QualitySelector } from '../QualitySelector';
import { VideoPlayerSegment } from '@/components/VideoPlayerSegment';
import VideoContentChapters from '../VideoContentChapters';
import { useState } from 'react';
import { useMemo, useState } from 'react';
import { handleMarkAsCompleted } from '@/lib/utils';

export const ContentRendererClient = ({
Expand Down Expand Up @@ -47,31 +47,28 @@ export const ContentRendererClient = ({
}

const mpdUrl = metadata?.[quality || '1080'] || '';
let source = {};

if (mpdUrl.endsWith('.mpd')) {
//@ts-ignore
source = {
src: mpdUrl,
type: 'application/dash+xml',
keySystems: {
'com.widevine.alpha':
'https://widevine-dash.ezdrm.com/proxy?pX=288FF5&user_id=MTAwMA==',
},
};
} else if (mpdUrl.endsWith('.m3u8')) {
//@ts-ignore
source = {
src: mpdUrl,
type: 'application/x-mpegURL',
};
} else {
//@ts-ignore
source = {
const source = useMemo(() => {
if (mpdUrl.endsWith('.mpd')) {
return {
src: mpdUrl,
type: 'application/dash+xml',
keySystems: {
'com.widevine.alpha':
'https://widevine-dash.ezdrm.com/proxy?pX=288FF5&user_id=MTAwMA==',
},
};
} else if (mpdUrl.endsWith('.m3u8')) {
return {
src: mpdUrl,
type: 'application/x-mpegURL',
};
}
return {
src: mpdUrl,
type: 'video/mp4',
};
}
}, [mpdUrl]);

const toggleShowChapters = () => {
setShowChapters((prev) => !prev);
Expand Down

0 comments on commit f5a8082

Please sign in to comment.