mirror of
https://github.com/mediacms-io/mediacms.git
synced 2025-11-06 15:38:53 -05:00
wtv
This commit is contained in:
parent
32f61cf566
commit
e34bd55e7a
@ -256,7 +256,7 @@ def video_chapters(request, friendly_token):
|
||||
return HttpResponseRedirect("/")
|
||||
|
||||
try:
|
||||
data = json.loads(request.body)["chapters"]
|
||||
data = json.loads(request.body)["segments"]
|
||||
chapters = []
|
||||
for _, chapter_data in enumerate(data):
|
||||
start_time = chapter_data.get('startTime')
|
||||
|
||||
@ -968,7 +968,7 @@ const TimelineControls = ({
|
||||
useEffect(() => {
|
||||
const loadSavedSegments = () => {
|
||||
// Get savedSegments directly from window.MEDIA_DATA
|
||||
let savedData = (typeof window !== 'undefined' && (window as any).MEDIA_DATA?.savedSegments) || null;
|
||||
let savedData = (typeof window !== 'undefined' && (window as any).MEDIA_DATA?.chapters) || null;
|
||||
|
||||
// If no saved segments, use default segments
|
||||
if (!savedData) {
|
||||
|
||||
@ -94,33 +94,7 @@ const useVideoChapters = () => {
|
||||
// Check if we have existing chapters from the backend
|
||||
const existingChapters =
|
||||
(typeof window !== 'undefined' && (window as any).MEDIA_DATA?.chapters) ||
|
||||
[
|
||||
/* {
|
||||
name: 'Chapter 1',
|
||||
from: '00:00:00',
|
||||
to: '00:00:03',
|
||||
},
|
||||
{
|
||||
name: 'Chapter 2',
|
||||
from: '00:00:03',
|
||||
to: '00:00:06',
|
||||
},
|
||||
{
|
||||
name: 'Chapter 3',
|
||||
from: '00:00:09',
|
||||
to: '00:00:12',
|
||||
},
|
||||
{
|
||||
name: 'Chapter 4',
|
||||
from: '00:00:15',
|
||||
to: '00:00:18',
|
||||
},
|
||||
{
|
||||
name: 'Chapter 5',
|
||||
from: '00:00:21',
|
||||
to: '00:00:24',
|
||||
}, */
|
||||
];
|
||||
[];
|
||||
|
||||
if (existingChapters.length > 0) {
|
||||
// Create segments from existing chapters
|
||||
@ -128,8 +102,8 @@ const useVideoChapters = () => {
|
||||
const chapter = existingChapters[i];
|
||||
|
||||
// Parse time strings to seconds
|
||||
const startTime = parseTimeToSeconds(chapter.from);
|
||||
const endTime = parseTimeToSeconds(chapter.to);
|
||||
const startTime = parseTimeToSeconds(chapter.startTime);
|
||||
const endTime = parseTimeToSeconds(chapter.endTime);
|
||||
|
||||
// Generate thumbnail for this segment
|
||||
const segmentThumbnail = await generateThumbnail(video, (startTime + endTime) / 2);
|
||||
@ -140,7 +114,7 @@ const useVideoChapters = () => {
|
||||
startTime: startTime,
|
||||
endTime: endTime,
|
||||
thumbnail: segmentThumbnail,
|
||||
chapterTitle: chapter.name, // Set the chapter title from backend data
|
||||
chapterTitle: chapter.text,
|
||||
};
|
||||
|
||||
initialSegments.push(segment);
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -16,8 +16,10 @@
|
||||
mediaId: "{{ media_object.friendly_token }}",
|
||||
redirectURL: "{{ media_object.get_absolute_url }}",
|
||||
redirectUserMediaURL: "{{ media_object.user.get_absolute_url }}",
|
||||
chapters: "{{ chapters }}",
|
||||
chapters: {{ chapters|safe }},
|
||||
};
|
||||
|
||||
console.log(window.MEDIA_DATA.chapters)
|
||||
</script>
|
||||
{%endblock topimports %}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user