diff --git a/src/components/VideoPlayer.vue b/src/components/VideoPlayer.vue index 94063864..accf052e 100644 --- a/src/components/VideoPlayer.vue +++ b/src/components/VideoPlayer.vue @@ -472,14 +472,7 @@ export default { this.$ui = new shaka.ui.Overlay(localPlayer, this.$refs.container, videoEl); - const overflowMenuButtons = [ - "quality", - "language", - "captions", - "picture_in_picture", - "playback_rate", - "airplay", - ]; + const overflowMenuButtons = ["quality", "captions", "picture_in_picture", "playback_rate", "airplay"]; if (this.isEmbed) { overflowMenuButtons.push("open_new_tab"); @@ -544,6 +537,18 @@ export default { player.selectAudioLanguage(lang); } + const audioLanguages = player.getAudioLanguages(); + if (audioLanguages.length > 1) { + const overflowMenuButtons = this.$ui.getConfiguration().overflowMenuButtons; + // append language menu on index 1 + const newOverflowMenuButtons = [ + ...overflowMenuButtons.slice(0, 1), + "language", + ...overflowMenuButtons.slice(1), + ]; + this.$ui.configure("overflowMenuButtons", newOverflowMenuButtons); + } + if (qualityConds) { var leastDiff = Number.MAX_VALUE; var bestStream = null;