Redo av codec settings & selections to accomodate webm

Allows for ranked preferences for h264, av1, and vp9 codecs in
settings, along with equal preferences which are tiebroken using
smaller file size.

For each quality, gives av-merge a list of video sources
and audio sources sorted based on preference & file size. It
will pick the first one that the browser supports.

Closes #84

Signed-off-by: Jesús <heckyel@hyperbola.info>
This commit is contained in:
James Taylor
2021-09-06 12:58:27 -07:00
committed by Jesús
parent 854ab81b91
commit 9c7e93ecf8
7 changed files with 174 additions and 103 deletions

View File

@@ -4,16 +4,15 @@ function changeQuality(selection) {
var currentVideoTime = video.currentTime;
var videoPaused = video.paused;
var videoSpeed = video.playbackRate;
var videoSource;
var srcInfo;
if (avMerge)
avMerge.close();
if (selection.type == 'uni'){
videoSource = data['uni_sources'][selection.index];
video.src = videoSource.url;
srcInfo = data['uni_sources'][selection.index];
video.src = srcInfo.url;
} else {
let srcPair = data['pair_sources'][selection.index];
videoSource = srcPair[0];
avMerge = new AVMerge(video, srcPair, currentVideoTime);
srcInfo = data['pair_sources'][selection.index];
avMerge = new AVMerge(video, srcInfo, currentVideoTime);
}
video.currentTime = currentVideoTime;
if (!videoPaused){
@@ -26,7 +25,6 @@ function changeQuality(selection) {
var avMerge;
if (data.using_pair_sources) {
var srcPair = data['pair_sources'][data['pair_idx']];
var videoSource = srcPair[0];
// Do it dynamically rather than as the default in jinja
// in case javascript is disabled
avMerge = new AVMerge(video, srcPair, 0);