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