Skip to content

Commit

Permalink
chore: fix types in setCurrentQuality
Browse files Browse the repository at this point in the history
  • Loading branch information
ambar committed Jan 27, 2022
1 parent 8c319dc commit b8e5b60
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/griffith/src/contexts/VideoSourceProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, {useEffect, useMemo, useState} from 'react'
import {PlaySourceMap, PlaybackRate, RealQuality} from '../types'
import {PlaySourceMap, PlaybackRate, RealQuality, Quality} from '../types'
import VideoSourceContext from './VideoSourceContext'
import {getQualities, getSources} from './parsePlaylist'
import {EVENTS} from 'griffith-message'
Expand Down Expand Up @@ -57,7 +57,7 @@ const VideoSourceProvider: React.FC<VideoSourceProviderProps> = ({
)
const [playbackRate, setPlaybackRate] = useState(defaultPlaybackRate)

const setCurrentQuality = useHandler((quality: RealQuality) => {
const setCurrentQuality = useHandler((quality: Quality) => {
if (currentQuality !== quality) {
setCurrentQualityRaw(quality)
emitEvent(EVENTS.QUALITY_CHANGE, {
Expand All @@ -71,7 +71,7 @@ const VideoSourceProvider: React.FC<VideoSourceProviderProps> = ({
const prevQualities = usePrevious(qualities)
useEffect(() => {
if (prevQualities && prevQualities !== qualities) {
setCurrentQuality((defaultQuality || qualities[0]) as RealQuality)
setCurrentQuality(defaultQuality || qualities[0])
}
}, [prevQualities, qualities, defaultQuality, setCurrentQuality])

Expand Down

0 comments on commit b8e5b60

Please sign in to comment.