mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-19 03:11:20 -08:00
feat(artplayer-plugin-dash-control)!: support dash.js v5
- replace removed v4 APIs with their v5 equivalents: getRepresentationsByType / getCurrentRepresentationForType / setRepresentationForTypeByIndex - bump dash.js CDN references from 4.5.2 to 5.2.1 (modern/umd build) - rebuild dist, docs/compiled and docs/uncompiled artifacts - regenerate vitepress docs
This commit is contained in:
1 parent
42c4ca735d
commit
cb69e4ad66
96 files changed
+199
-195
No files matched your search
@@ -18,7 +18,7 @@ export default function artplayerPluginDashControl(option = {}) {
|
||||
const { errorHandle } = art.constructor.utils
|
||||
|
||||
function updateQuality(dash) {
|
||||
const qualities = dash.getBitrateInfoListFor('video')
|
||||
const qualities = dash.getRepresentationsByType('video')
|
||||
if (!qualities || !qualities.length)
|
||||
return
|
||||
|
||||
@@ -26,16 +26,17 @@ export default function artplayerPluginDashControl(option = {}) {
|
||||
const auto = config.auto || 'Auto'
|
||||
const title = config.title || 'Quality'
|
||||
const getName = config.getName || (level => `${level.height}p`)
|
||||
const currentQuality = dash.getQualityFor('video')
|
||||
const currentRepresentation = dash.getCurrentRepresentationForType('video')
|
||||
const currentId = currentRepresentation && currentRepresentation.id
|
||||
const currentAuto = dash.getSettings().streaming.abr.autoSwitchBitrate.video
|
||||
const defaultHtml = currentAuto ? auto : getName(qualities[currentQuality])
|
||||
const defaultHtml = !currentAuto && currentRepresentation ? getName(currentRepresentation) : auto
|
||||
|
||||
const selector = uniqBy(
|
||||
qualities.map((item) => {
|
||||
qualities.map((item, index) => {
|
||||
return {
|
||||
html: getName(item),
|
||||
value: item.qualityIndex,
|
||||
default: currentQuality === item.qualityIndex && !currentAuto,
|
||||
value: index,
|
||||
default: !currentAuto && !!currentId && item.id === currentId,
|
||||
}
|
||||
}),
|
||||
'html',
|
||||
@@ -69,7 +70,7 @@ export default function artplayerPluginDashControl(option = {}) {
|
||||
},
|
||||
},
|
||||
})
|
||||
dash.setQualityFor('video', item.value)
|
||||
dash.setRepresentationForTypeByIndex('video', item.value)
|
||||
}
|
||||
art.notice.show = `${title}: ${item.html}`
|
||||
if (config.control)
|
||||
|
||||
Reference in new issue
Block a user