Skip to content

Commit

Permalink
feat: improve live stream selection page
Browse files Browse the repository at this point in the history
  • Loading branch information
Arcath committed Jan 29, 2024
1 parent 0aab88d commit aeb87a2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/routes/live.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {useLoaderData} from '@remix-run/react'
import {useState, useEffect, useRef} from 'react'
import dashjs from '~/lib/dash.client'
import {type LiveStream} from '@prisma/client'
import {formatDistance} from 'date-fns'

import {getUPNFromHeaders, getUserFromUPN} from '~/lib/user.server'
import {getConfigValue} from '~/lib/config.server'
Expand Down Expand Up @@ -41,7 +42,9 @@ const Live = () => {
const {streamUrl, streams} = useLoaderData<typeof loader>()

const [start, setStart] = useState<boolean>(false)
const [selectedStream, setSelectedStream] = useState<LiveStream | undefined>()
const [selectedStream, setSelectedStream] = useState<
Pick<LiveStream, 'id' | 'key'> | undefined
>()

const videoRef = useRef(null)
const playerRef = useRef<dashjs.MediaPlayerClass | null>(null)
Expand Down Expand Up @@ -97,6 +100,11 @@ const Live = () => {
>
Join Stream
</button>
<br />
<i>
Started {formatDistance(new Date(stream.updatedAt), new Date())}{' '}
ago
</i>
</div>
)
})}
Expand Down

0 comments on commit aeb87a2

Please sign in to comment.