-
-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
371ff6e
commit bfbd9f9
Showing
20 changed files
with
533 additions
and
296 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
<template> | ||
<v-container fill-height fluid class="pa-0"> | ||
<div ref="videoContainer"> | ||
<video ref="videoPlayer" :poster="poster" autoplay></video> | ||
</div> | ||
</v-container> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import Vue from 'vue'; | ||
import { stringify } from 'qs'; | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
import shaka from 'shaka-player/dist/shaka-player.ui'; | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
import muxjs from 'mux.js'; | ||
import 'shaka-player/dist/controls.css'; | ||
declare global { | ||
interface Window { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
muxjs: any; | ||
} | ||
} | ||
export default Vue.extend({ | ||
props: { | ||
item: { | ||
type: Object, | ||
required: true | ||
}, | ||
poster: { | ||
type: String, | ||
default: '' | ||
} | ||
}, | ||
data() { | ||
return { | ||
source: '', | ||
player: null as any, | ||
ui: null as any | ||
}; | ||
}, | ||
watch: { | ||
async source(newSource) { | ||
if (this.player) { | ||
try { | ||
await this.player.load(newSource); | ||
} catch (e) { | ||
console.error('Error code', e.code, 'object', e); | ||
} | ||
} | ||
} | ||
}, | ||
async mounted() { | ||
try { | ||
const response = await this.$api.mediaInfo.getPostedPlaybackInfo({ | ||
itemId: this.$route.params.itemId, | ||
userId: this.$auth.user.Id, | ||
deviceProfileDto: { | ||
DeviceProfile: this.$playbackProfile | ||
} | ||
}); | ||
let mediaSource; | ||
if (response?.data?.MediaSources) { | ||
mediaSource = response.data.MediaSources[0]; | ||
} else { | ||
throw new Error("This item can't be played."); | ||
} | ||
if (mediaSource.SupportsDirectStream) { | ||
const directOptions: Record<string, any> = { | ||
Static: true, | ||
mediaSourceId: mediaSource.Id, | ||
deviceId: this.$store.state.deviceProfile.deviceId, | ||
api_key: this.$store.state.user.accessToken | ||
}; | ||
if (mediaSource.ETag) { | ||
directOptions.Tag = mediaSource.ETag; | ||
} | ||
if (mediaSource.LiveStreamId) { | ||
directOptions.LiveStreamId = mediaSource.LiveStreamId; | ||
} | ||
const params = stringify(directOptions); | ||
this.source = `${this.$axios.defaults.baseURL}/Videos/${mediaSource.Id}/stream.${mediaSource.Container}?${params}`; | ||
} else if ( | ||
mediaSource.SupportsTranscoding && | ||
mediaSource.TranscodingUrl | ||
) { | ||
this.source = this.$axios.defaults.baseURL + mediaSource.TranscodingUrl; | ||
} | ||
window.muxjs = muxjs; | ||
shaka.polyfill.installAll(); | ||
if (shaka.Player.isBrowserSupported()) { | ||
// Everything looks good! | ||
this.player = new shaka.Player(this.$refs.videoPlayer); | ||
this.ui = new shaka.ui.Overlay( | ||
this.player, | ||
this.$refs.videoContainer, | ||
this.$refs.videoPlayer | ||
); | ||
} else { | ||
this.$nuxt.error({ | ||
message: this.$t('browserNotSupported') as string | ||
}); | ||
} | ||
} catch (error) { | ||
this.$nuxt.error({ | ||
statusCode: 404, | ||
message: error | ||
}); | ||
} | ||
}, | ||
beforeDestroy() { | ||
if (this.player) { | ||
window.muxjs = undefined; | ||
this.player.unload(); | ||
this.player.destroy(); | ||
} | ||
} | ||
}); | ||
</script> | ||
|
||
<style scoped> | ||
video { | ||
width: 100vw; | ||
height: 100vh; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,34 @@ | ||
{ | ||
"badRequest": "Fehlerhafte Anfrage. Erneut versuchen", | ||
"continueListening": "Weiter zuhören", | ||
"continueWatching": "Weiter anschauen", | ||
"home": "Startseite", | ||
"incorrectUsernameOrPassword": "Ungültiger Benutzername oder Passwort", | ||
"login": "Anmelden", | ||
"logout": "Abmelden", | ||
"more": "Mehr", | ||
"play": "Abspielen", | ||
"serverAddressMustBeUrl": "Serveradresse muss eine gültige URL sein", | ||
"serverAddressRequired": "Serveradresse ist erforderlich", | ||
"serverNotFound": "Server nicht gefunden", | ||
"settings": "Einstellungen", | ||
"unexpectedError": "Unerwarteter Fehler", | ||
"upNext": "Als nächstes", | ||
"usernameRequired": "Benutzername erforderlich", | ||
"signIn": "Anmelden", | ||
"password": "Passwort", | ||
"username": "Benutzername", | ||
"serverAddress": "Serveradresse", | ||
"itemNotFound": "Element nicht gefunden", | ||
"libraryNotFound": "Bibliothek nicht gefunden", | ||
"episodeNumber": "Episode {episodeNumber}", | ||
"playType": "{mediaType} abspielen", | ||
"moreLikeThis": "Ähnliches", | ||
"present": "Jetzt", | ||
"endsAt": "Endet um {time}", | ||
"libraryEmpty": "Diese Bibliothek ist leer", | ||
"rating": "Bewertung", | ||
"endDate": "Enddatum", | ||
"releaseDate": "Erscheinungsdatum", | ||
"alphabetically": "Alphabetisch" | ||
"badRequest": "Fehlerhafte Anfrage. Erneut versuchen", | ||
"continueListening": "Weiter zuhören", | ||
"continueWatching": "Weiter anschauen", | ||
"home": "Startseite", | ||
"incorrectUsernameOrPassword": "Ungültiger Benutzername oder Passwort", | ||
"login": "Anmelden", | ||
"logout": "Abmelden", | ||
"more": "Mehr", | ||
"play": "Abspielen", | ||
"serverAddressMustBeUrl": "Serveradresse muss eine gültige URL sein", | ||
"serverAddressRequired": "Serveradresse ist erforderlich", | ||
"serverNotFound": "Server nicht gefunden", | ||
"settings": "Einstellungen", | ||
"unexpectedError": "Unerwarteter Fehler", | ||
"upNext": "Als nächstes", | ||
"usernameRequired": "Benutzername erforderlich", | ||
"signIn": "Anmelden", | ||
"password": "Passwort", | ||
"username": "Benutzername", | ||
"serverAddress": "Serveradresse", | ||
"itemNotFound": "Element nicht gefunden", | ||
"libraryNotFound": "Bibliothek nicht gefunden", | ||
"episodeNumber": "Episode {episodeNumber}", | ||
"playType": "{mediaType} abspielen", | ||
"moreLikeThis": "Ähnliches", | ||
"present": "Jetzt", | ||
"endsAt": "Endet um {time}", | ||
"libraryEmpty": "Diese Bibliothek ist leer", | ||
"rating": "Bewertung", | ||
"endDate": "Enddatum", | ||
"releaseDate": "Erscheinungsdatum", | ||
"alphabetically": "Alphabetisch" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,34 @@ | ||
{ | ||
"badRequest": "Mauvaise requête. Réessayez", | ||
"continueListening": "Poursuivre l'écoute", | ||
"continueWatching": "Poursuivre le visionnage", | ||
"home": "Accueil", | ||
"incorrectUsernameOrPassword": "Nom d'utilisateur ou mot de passe incorrect", | ||
"login": "Connexion", | ||
"logout": "Se déconnecter", | ||
"more": "Plus", | ||
"play": "Lire", | ||
"serverAddressMustBeUrl": "L'adresse du serveur doit être une URL valide", | ||
"serverAddressRequired": "L'adresse du serveur est requise", | ||
"serverNotFound": "Serveur introuvable", | ||
"settings": "Paramètres", | ||
"unexpectedError": "Erreur inattendue", | ||
"usernameRequired": "Nom d'utilisateur requis", | ||
"serverAddress": "Adresse du serveur", | ||
"username": "Nom d'utilisateur", | ||
"password": "Mot de passe", | ||
"signIn": "Se connecter", | ||
"upNext": "À suivre", | ||
"libraryNotFound": "Médiathèque introuvable", | ||
"itemNotFound": "Élément introuvable", | ||
"episodeNumber": "Épisode {episodeNumber}", | ||
"playType": "Lire {mediaType}", | ||
"present": "Maintenant", | ||
"endsAt": "Se termine à {time}", | ||
"moreLikeThis": "Similaires", | ||
"libraryEmpty": "Cette médiathèque est vide", | ||
"rating": "Critique", | ||
"endDate": "Date de fin", | ||
"releaseDate": "Date de sortie", | ||
"alphabetically": "Alphabétique" | ||
"badRequest": "Mauvaise requête. Réessayez", | ||
"continueListening": "Poursuivre l'écoute", | ||
"continueWatching": "Poursuivre le visionnage", | ||
"home": "Accueil", | ||
"incorrectUsernameOrPassword": "Nom d'utilisateur ou mot de passe incorrect", | ||
"login": "Connexion", | ||
"logout": "Se déconnecter", | ||
"more": "Plus", | ||
"play": "Lire", | ||
"serverAddressMustBeUrl": "L'adresse du serveur doit être une URL valide", | ||
"serverAddressRequired": "L'adresse du serveur est requise", | ||
"serverNotFound": "Serveur introuvable", | ||
"settings": "Paramètres", | ||
"unexpectedError": "Erreur inattendue", | ||
"usernameRequired": "Nom d'utilisateur requis", | ||
"serverAddress": "Adresse du serveur", | ||
"username": "Nom d'utilisateur", | ||
"password": "Mot de passe", | ||
"signIn": "Se connecter", | ||
"upNext": "À suivre", | ||
"libraryNotFound": "Médiathèque introuvable", | ||
"itemNotFound": "Élément introuvable", | ||
"episodeNumber": "Épisode {episodeNumber}", | ||
"playType": "Lire {mediaType}", | ||
"present": "Maintenant", | ||
"endsAt": "Se termine à {time}", | ||
"moreLikeThis": "Similaires", | ||
"libraryEmpty": "Cette médiathèque est vide", | ||
"rating": "Critique", | ||
"endDate": "Date de fin", | ||
"releaseDate": "Date de sortie", | ||
"alphabetically": "Alphabétique" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
{ | ||
"badRequest": "Onjuist verzoek. Probeer het opnieuw", | ||
"continueListening": "Verder luisteren", | ||
"continueWatching": "Verder kijken", | ||
"home": "Home", | ||
"incorrectUsernameOrPassword": "Onjuiste gebruikersnaam en/of wachtwoord", | ||
"login": "Inloggen", | ||
"logout": "Uitloggen", | ||
"more": "Meer", | ||
"play": "Afspelen", | ||
"serverAddressMustBeUrl": "Server adres moet een geldige URL zijn", | ||
"serverAddressRequired": "Server adres is verplicht", | ||
"serverNotFound": "Server niet gevonden", | ||
"settings": "Instellingen", | ||
"unexpectedError": "Onverwachte fout", | ||
"upNext": "Volgende", | ||
"usernameRequired": "Gebruikersnaam is verplicht", | ||
"itemNotFound": "Item niet gevonden", | ||
"libraryNotFound": "Bibliotheek niet gevonden", | ||
"signIn": "Inloggen", | ||
"password": "Wachtwoord", | ||
"username": "Gebruikersnaam", | ||
"serverAddress": "Server adres", | ||
"episodeNumber": "Aflevering {episodeNumber}", | ||
"playType": "Speel {mediaType}", | ||
"present": "Huidig", | ||
"moreLikeThis": "Meer zoals dit", | ||
"endsAt": "Eindigt om {time}" | ||
"badRequest": "Onjuist verzoek. Probeer het opnieuw", | ||
"continueListening": "Verder luisteren", | ||
"continueWatching": "Verder kijken", | ||
"home": "Home", | ||
"incorrectUsernameOrPassword": "Onjuiste gebruikersnaam en/of wachtwoord", | ||
"login": "Inloggen", | ||
"logout": "Uitloggen", | ||
"more": "Meer", | ||
"play": "Afspelen", | ||
"serverAddressMustBeUrl": "Server adres moet een geldige URL zijn", | ||
"serverAddressRequired": "Server adres is verplicht", | ||
"serverNotFound": "Server niet gevonden", | ||
"settings": "Instellingen", | ||
"unexpectedError": "Onverwachte fout", | ||
"upNext": "Volgende", | ||
"usernameRequired": "Gebruikersnaam is verplicht", | ||
"itemNotFound": "Item niet gevonden", | ||
"libraryNotFound": "Bibliotheek niet gevonden", | ||
"signIn": "Inloggen", | ||
"password": "Wachtwoord", | ||
"username": "Gebruikersnaam", | ||
"serverAddress": "Server adres", | ||
"episodeNumber": "Aflevering {episodeNumber}", | ||
"playType": "Speel {mediaType}", | ||
"present": "Huidig", | ||
"moreLikeThis": "Meer zoals dit", | ||
"endsAt": "Eindigt om {time}" | ||
} |
Oops, something went wrong.