Choose higher-quality audio stream URL (#189)

* Choose higher-quality audio stream URL

This change is kind of a shortcut that is a temporary fix before FreeTube migrates to using the adaptive formats to choose the streaming option URLs.

* Higher quality audio stream

fixed typo
This commit is contained in:
Andy 2018-11-07 08:57:53 -06:00 committed by Preston
parent bd16e8646e
commit 2fb43b059d
1 changed files with 5 additions and 5 deletions

View File

@ -68,8 +68,9 @@ function playVideo(videoId, playlistId = '') {
playerView.channelName = data.author;
playerView.channelId = data.authorId;
playerView.channelIcon = data.authorThumbnails[2].url;
let videoUrls = data.formatStreams;
let formatUrls = data.adaptiveFormats;
// Add commas to the video view count.
playerView.videoViews = data.viewCount.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
@ -94,12 +95,11 @@ function playVideo(videoId, playlistId = '') {
playerView.video720p = decodeURIComponent(videoUrls[key]['url']);
//console.log(video720p);
break;
case '36':
playerView.videoAudio = decodeURIComponent(videoUrls[key]['url']);
//console.log(video720p);
break;
}
});
// Last adaptive format will be best the quality audio stream (migrate fully to adaptive formats later)
playerView.videoAudio = decodeURIComponent(formatUrls[formatUrls.length - 1]['url']);
if (typeof(playerView.videoAudio) === 'undefined') {
playerView.validAudio = false;