YT: resolve redirects on the Clapper side

Instead of providing URIs directly to GStreamer, follow redirects and provide that final URI. With this change souphttpsrc will not have to go through redirects from the beginning for each video segment.
This commit is contained in:
Rafostar
2021-04-11 14:46:08 +02:00
parent b5711b145b
commit 7cf86e92eb
3 changed files with 84 additions and 36 deletions

View File

@@ -86,16 +86,23 @@ class ClapperPlayer extends PlayerBase
if(!info)
throw new Error('no YouTube video info');
const dash = Dash.generateDash(info);
let videoUri = null;
const dashInfo = await this.ytClient.getDashInfoAsync(info).catch(debug);
if(dash) {
const dashFile = await FileOps.saveFilePromise(
'tmp', null, 'clapper.mpd', dash
).catch(debug);
if(dashInfo) {
debug('parsed video info to dash info');
const dash = Dash.generateDash(dashInfo);
if(dashFile)
videoUri = dashFile.get_uri();
if(dash) {
debug('got dash');
const dashFile = await FileOps.saveFilePromise(
'tmp', null, 'clapper.mpd', dash
).catch(debug);
if(dashFile)
videoUri = dashFile.get_uri();
}
}
if(!videoUri)