Ott 667 player autoplay fix (#251)

* fix(667): removed stream request timeout

* fix(667): filter out unknown video qualities
keep-around/af30b88d367751c9e05a735e4a0467a96238ef47
Mirlan 5 years ago committed by GitHub
parent 0339b68d14
commit ac2e0a55a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      src/features/StreamPlayer/hooks/useVideoQuality.tsx
  2. 1
      src/requests/getLiveVideos.tsx

@ -12,6 +12,7 @@ import uniqBy from 'lodash/uniqBy'
import isEmpty from 'lodash/isEmpty'
import orderBy from 'lodash/orderBy'
import isString from 'lodash/isString'
import filter from 'lodash/fp/filter'
import { useLocalStore } from 'hooks'
@ -20,10 +21,20 @@ const autoQuality = {
level: -1,
}
/**
* Убирает из списка качества без height
*
* Когда в манифесте нет данных о качествах стрима hls.levels содержит
* непонятное качество без свойств height, width и тд для определения
* какое это качество
*/
const filterOutUnknownQualities = filter(({ height }: Hls.Level) => Boolean(height))
const getVideoQualities = (levels: Array<Hls.Level>) => {
if (isEmpty(levels)) return []
const qualities = map(levels, (level, i) => ({
const filteredQualities = filterOutUnknownQualities(levels)
const qualities = map(filteredQualities, (level, i) => ({
label: String(level.height),
level: i,
}))

@ -18,7 +18,6 @@ export const getLiveVideos = (
return callApi({
config,
timeout: 2000,
url: `${API_ROOT}/video/stream`,
}).then((videos: LiveVideos) => {
if (isEmpty(videos)) return Promise.reject()

Loading…
Cancel
Save