1
0
Fork 0
mirror of https://github.com/LaQuay/TDTChannels.git synced 2025-10-15 19:50:23 +02:00

Improve audio formats

This commit is contained in:
Marc 2018-12-15 23:56:57 +01:00
parent cf8b067f83
commit eba390365e

View file

@ -65,15 +65,15 @@
</button> </button>
</div> </div>
</div> </div>
<audio id="audio-controller" controls> <audio id="audio-controller" controls autoplay="">
<source id="audio-player" src="" autoplay> <source id="audio-player" src="" type="audio/mpeg">
Your browser does not support the audio element. Your browser does not support the audio element.
</audio> </audio>
<div id="audio-information" class="shadow-sm p-3 mb-5 bg-white rounded" style="margin-top: 15px"> <div id="audio-information" class="shadow-sm p-3 mb-5 bg-white rounded" style="margin-top: 15px">
<p class="lead">Información de la reproducción</p> <p class="lead">Información de la reproducción</p>
Formatos soportados Formatos soportados
<br> <br>
<em>nsv</em> <em>aac</em>, <em>mp3</em>, <em>nsv</em><em>audio/mpeg</em>
</div> </div>
</div> </div>
</div> </div>
@ -116,9 +116,8 @@
} }
function reproduceVideo(channelToReproduce) { function reproduceVideo(channelToReproduce) {
console.log("Reproducing " + channelToReproduce); console.log("Reproducing video: " + channelToReproduce);
if (channelToReproduce.includes("m3u8")) { if (channelToReproduce.includes("m3u8")) {
console.log("Reproducing video")
var divInfo = document.getElementById("video-player").childElementCount; var divInfo = document.getElementById("video-player").childElementCount;
if (divInfo == 0) { if (divInfo == 0) {
player = new Clappr.Player({ player = new Clappr.Player({
@ -140,27 +139,23 @@
} }
function reproduceAudio(channelToReproduce) { function reproduceAudio(channelToReproduce) {
console.log("Reproducing " + channelToReproduce); console.log("Reproducing audio: " + channelToReproduce);
if (channelToReproduce.includes("nsv")) {
console.log("Reproducing audio")
var audioSource = document.getElementById('audio-controller'); var audioSource = document.getElementById('audio-controller');
var audioPlayer = document.getElementById('audio-player'); var audioPlayer = document.getElementById('audio-player');
audioPlayer.src = channelToReproduce; audioPlayer.src = channelToReproduce;
audioSource.load();
audioSource.pause();
audioSource.load(); var playPromise = audioSource.play();
audioSource.pause(); if (playPromise !== undefined) {
var playPromise = audioSource.play(); playPromise.then(function() {
// Automatic playback started!
if (playPromise !== undefined) { }).catch(function(error) {
playPromise.then(function() { // Automatic playback failed.
// Automatic playback started! // Show a UI element to let the user manually start playback.
}).catch(function(error) { });
// Automatic playback failed.
// Show a UI element to let the user manually start playback.
});
}
} }
} }