Fix webinar recording detection to support M3U8 and MP4 from Adilo
The issue was that MemberAccess.tsx was only checking recording_url (YouTube) and not fetching or checking m3u8_url, mp4_url, or video_host fields. Changes: - Added m3u8_url, mp4_url, video_host, and event_start to product queries - Updated UserAccess interface to include these fields - Changed webinar recording check to support all recording types - Now properly detects Adilo recordings as available 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -23,6 +23,10 @@ interface UserAccess {
|
|||||||
type: string;
|
type: string;
|
||||||
meeting_link: string | null;
|
meeting_link: string | null;
|
||||||
recording_url: string | null;
|
recording_url: string | null;
|
||||||
|
m3u8_url: string | null;
|
||||||
|
mp4_url: string | null;
|
||||||
|
video_host: 'youtube' | 'adilo' | 'unknown' | null;
|
||||||
|
event_start: string | null;
|
||||||
description: string;
|
description: string;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -55,7 +59,7 @@ export default function MemberAccess() {
|
|||||||
// Get direct user_access
|
// Get direct user_access
|
||||||
supabase
|
supabase
|
||||||
.from('user_access')
|
.from('user_access')
|
||||||
.select(`id, granted_at, expires_at, product:products (id, title, slug, type, meeting_link, recording_url, description)`)
|
.select(`id, granted_at, expires_at, product:products (id, title, slug, type, meeting_link, recording_url, m3u8_url, mp4_url, video_host, event_start, description)`)
|
||||||
.eq('user_id', user!.id),
|
.eq('user_id', user!.id),
|
||||||
// Get products from paid orders (via order_items)
|
// Get products from paid orders (via order_items)
|
||||||
supabase
|
supabase
|
||||||
@@ -63,7 +67,7 @@ export default function MemberAccess() {
|
|||||||
.select(
|
.select(
|
||||||
`
|
`
|
||||||
order_items (
|
order_items (
|
||||||
product:products (id, title, slug, type, meeting_link, recording_url, description)
|
product:products (id, title, slug, type, meeting_link, recording_url, m3u8_url, mp4_url, video_host, event_start, description)
|
||||||
)
|
)
|
||||||
`,
|
`,
|
||||||
)
|
)
|
||||||
@@ -151,8 +155,11 @@ export default function MemberAccess() {
|
|||||||
// Check if webinar has ended
|
// Check if webinar has ended
|
||||||
const webinarEnded = item.product.event_start && new Date(item.product.event_start) <= new Date();
|
const webinarEnded = item.product.event_start && new Date(item.product.event_start) <= new Date();
|
||||||
|
|
||||||
|
// Check if any recording exists (YouTube, M3U8, or MP4)
|
||||||
|
const hasRecording = item.product.recording_url || item.product.m3u8_url || item.product.mp4_url;
|
||||||
|
|
||||||
// If recording exists, show it
|
// If recording exists, show it
|
||||||
if (item.product.recording_url) {
|
if (hasRecording) {
|
||||||
return (
|
return (
|
||||||
<Button onClick={() => navigate(`/webinar/${item.product.slug}`)} className="shadow-sm">
|
<Button onClick={() => navigate(`/webinar/${item.product.slug}`)} className="shadow-sm">
|
||||||
<Video className="w-4 h-4 mr-2" />
|
<Video className="w-4 h-4 mr-2" />
|
||||||
|
|||||||
Reference in New Issue
Block a user