132 lines
4.7 KiB
JavaScript
132 lines
4.7 KiB
JavaScript
define(["exports", "./globalize.js"], function (_exports, _globalize) {
|
|
Object.defineProperty(_exports, "__esModule", { value: !0 }),
|
|
(_exports.default = void 0),
|
|
(_exports.default = {
|
|
getVideoQualityOptions: function (options) {
|
|
var maxStreamingBitrate = options.currentMaxBitrate,
|
|
maxAllowedWidth = options.videoWidth || 4096,
|
|
qualityOptions = [],
|
|
maxAllowedWidth =
|
|
(3400 <= maxAllowedWidth &&
|
|
(qualityOptions.push({
|
|
name: "4K",
|
|
maxHeight: 2160,
|
|
bitrate: 16e7,
|
|
})),
|
|
1440 <= maxAllowedWidth
|
|
? (qualityOptions.push({
|
|
name: "1080p",
|
|
maxHeight: 1080,
|
|
bitrate: 6e7,
|
|
}))
|
|
: 1200 <= maxAllowedWidth
|
|
? (qualityOptions.push({
|
|
name: "720p",
|
|
maxHeight: 720,
|
|
bitrate: 1e7,
|
|
}))
|
|
: 620 <= maxAllowedWidth &&
|
|
(qualityOptions.push({
|
|
name: "480p",
|
|
maxHeight: 480,
|
|
bitrate: 4000001,
|
|
})),
|
|
1260 <= maxAllowedWidth &&
|
|
(qualityOptions.push({
|
|
name: "720p",
|
|
maxHeight: 720,
|
|
bitrate: 4e6,
|
|
})),
|
|
qualityOptions.push({
|
|
name: "480p",
|
|
maxHeight: 480,
|
|
bitrate: 1e6,
|
|
}),
|
|
qualityOptions.push({ name: "360p", maxHeight: 360, bitrate: 4e5 }),
|
|
qualityOptions.push({
|
|
name: "240p",
|
|
maxHeight: 240,
|
|
bitrate: 32e4,
|
|
}),
|
|
qualityOptions.push({
|
|
name: "144p",
|
|
maxHeight: 144,
|
|
bitrate: 192e3,
|
|
}),
|
|
{
|
|
name: _globalize.default.translate("Auto"),
|
|
bitrate: 0,
|
|
selected: options.isAutomaticBitrateEnabled,
|
|
});
|
|
if (
|
|
(options.enableAuto && qualityOptions.push(maxAllowedWidth),
|
|
maxStreamingBitrate)
|
|
) {
|
|
for (
|
|
var selectedIndex = -1, i = 0, length = qualityOptions.length;
|
|
i < length;
|
|
i++
|
|
)
|
|
-1 === selectedIndex &&
|
|
qualityOptions[i].bitrate <= maxStreamingBitrate &&
|
|
(selectedIndex = i);
|
|
var currentQualityOption =
|
|
qualityOptions[
|
|
(selectedIndex =
|
|
-1 === selectedIndex
|
|
? qualityOptions.length - 1
|
|
: selectedIndex)
|
|
];
|
|
options.isAutomaticBitrateEnabled
|
|
? (maxAllowedWidth.autoText = currentQualityOption.name)
|
|
: (currentQualityOption.selected = !0);
|
|
}
|
|
return qualityOptions;
|
|
},
|
|
getAudioQualityOptions: function (options) {
|
|
var maxStreamingBitrate = options.currentMaxBitrate,
|
|
qualityOptions = [],
|
|
autoQualityOption =
|
|
(qualityOptions.push({ name: "2 Mbps", bitrate: 2e6 }),
|
|
qualityOptions.push({ name: "1.5 Mbps", bitrate: 15e5 }),
|
|
qualityOptions.push({ name: "1 Mbps", bitrate: 1e6 }),
|
|
qualityOptions.push({ name: "512 kbps", bitrate: 512e3 }),
|
|
qualityOptions.push({ name: "320 kbps", bitrate: 32e4 }),
|
|
qualityOptions.push({ name: "256 kbps", bitrate: 256e3 }),
|
|
qualityOptions.push({ name: "192 kbps", bitrate: 192e3 }),
|
|
qualityOptions.push({ name: "128 kbps", bitrate: 128e3 }),
|
|
qualityOptions.push({ name: "96 kbps", bitrate: 96e3 }),
|
|
qualityOptions.push({ name: "64 kbps", bitrate: 64e3 }),
|
|
{
|
|
name: _globalize.default.translate("Auto"),
|
|
bitrate: 0,
|
|
selected: options.isAutomaticBitrateEnabled,
|
|
});
|
|
if (
|
|
(options.enableAuto && qualityOptions.push(autoQualityOption),
|
|
maxStreamingBitrate)
|
|
) {
|
|
for (
|
|
var selectedIndex = -1, i = 0, length = qualityOptions.length;
|
|
i < length;
|
|
i++
|
|
)
|
|
-1 === selectedIndex &&
|
|
qualityOptions[i].bitrate <= maxStreamingBitrate &&
|
|
(selectedIndex = i);
|
|
var currentQualityOption =
|
|
qualityOptions[
|
|
(selectedIndex =
|
|
-1 === selectedIndex
|
|
? qualityOptions.length - 1
|
|
: selectedIndex)
|
|
];
|
|
options.isAutomaticBitrateEnabled
|
|
? (autoQualityOption.autoText = currentQualityOption.name)
|
|
: (currentQualityOption.selected = !0);
|
|
}
|
|
return qualityOptions;
|
|
},
|
|
});
|
|
});
|