fix: add eventType support for touch devices (#3508)
fixes Not selectable items in quality settings menu #3368
This commit is contained in:
parent
d3a8ffb3b7
commit
139ec51dde
@ -58,10 +58,17 @@ export function createVideoSettingsMenuButton(
|
||||
});
|
||||
});
|
||||
|
||||
let clickEvent;
|
||||
if ('ontouchstart' in window) {
|
||||
clickEvent = 'touchend'; // Use touchend event for touch devices
|
||||
} else {
|
||||
clickEvent = 'click'; // Use click for all other devices
|
||||
}
|
||||
|
||||
for (let i = 0; i < items.length; i += 1) {
|
||||
const item = items[i];
|
||||
// Quality selected
|
||||
item.on('click', () => {
|
||||
item.on(clickEvent, () => {
|
||||
// If for some reason tech doesn't exist, then don't do anything
|
||||
if (!tech) {
|
||||
console.warn('Invalid attempt to access null player tech');
|
||||
@ -77,7 +84,7 @@ export function createVideoSettingsMenuButton(
|
||||
});
|
||||
}
|
||||
|
||||
defaultAutoItem.on('click', () => {
|
||||
defaultAutoItem.on(clickEvent, () => {
|
||||
// Re-enable all representations.
|
||||
tech.vhs.representations().forEach(rep => {
|
||||
rep.enabled(true);
|
||||
|
Loading…
Reference in New Issue
Block a user