mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-24 06:59:52 +01:00
video fixes: disable adding a fixed buffer on unbounded range requests,
as that messes up FF html5 player.. (it assumes a full stream) video response: ensure Accept-Ranges: bytes is being added on 206 responses
This commit is contained in:
parent
bbe5068321
commit
8a87966ebd
@ -33,7 +33,7 @@ class HeaderRewriter:
|
|||||||
'xml': ['/xml', '+xml', '.xml', '.rss'],
|
'xml': ['/xml', '+xml', '.xml', '.rss'],
|
||||||
}
|
}
|
||||||
|
|
||||||
PROXY_HEADERS = ['content-type', 'content-disposition', 'content-range']
|
PROXY_HEADERS = ['content-type', 'content-disposition', 'content-range', 'accept-ranges']
|
||||||
|
|
||||||
URL_REWRITE_HEADERS = ['location', 'content-location', 'content-base']
|
URL_REWRITE_HEADERS = ['location', 'content-location', 'content-base']
|
||||||
|
|
||||||
|
@ -54,14 +54,16 @@ __wbvidrw = (function() {
|
|||||||
if (child.tagName == "PARAM" && !obj_url) {
|
if (child.tagName == "PARAM" && !obj_url) {
|
||||||
var name = child.getAttribute("name");
|
var name = child.getAttribute("name");
|
||||||
name = name.toLowerCase();
|
name = name.toLowerCase();
|
||||||
if (name == "flashvars") {
|
/* if (name == "flashvars") {
|
||||||
var value = child.getAttribute("value");
|
var value = child.getAttribute("value");
|
||||||
value = decodeURIComponent(value);
|
value = decodeURIComponent(value);
|
||||||
var inx = value.indexOf("=http");
|
var inx = value.indexOf("=http");
|
||||||
if (inx >= 0) {
|
if (inx >= 0) {
|
||||||
obj_url = value.substring(inx + 1);
|
obj_url = value.substring(inx + 1);
|
||||||
}
|
}
|
||||||
} else if (name == "movie") {
|
}
|
||||||
|
*/
|
||||||
|
if (name == "movie") {
|
||||||
var value = child.getAttribute("value");
|
var value = child.getAttribute("value");
|
||||||
obj_url = value;
|
obj_url = value;
|
||||||
}
|
}
|
||||||
@ -86,6 +88,8 @@ __wbvidrw = (function() {
|
|||||||
// Wait to see if video is playing, if so, don't replace it
|
// Wait to see if video is playing, if so, don't replace it
|
||||||
window.setTimeout(function() {
|
window.setTimeout(function() {
|
||||||
if (ytvideo[0].readyState == 0) {
|
if (ytvideo[0].readyState == 0) {
|
||||||
|
delete window.yt;
|
||||||
|
delete window.ytplayer;
|
||||||
check_replacement(ytvideo[0], wbinfo.url);
|
check_replacement(ytvideo[0], wbinfo.url);
|
||||||
}
|
}
|
||||||
}, 4000);
|
}, 4000);
|
||||||
@ -114,6 +118,13 @@ __wbvidrw = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
src = src.replace(VIMEO_RX, "http://player.vimeo.com/video/$1");
|
src = src.replace(VIMEO_RX, "http://player.vimeo.com/video/$1");
|
||||||
|
|
||||||
|
if (window.yt) {
|
||||||
|
delete window.yt;
|
||||||
|
}
|
||||||
|
if (window.ytplayer) {
|
||||||
|
delete window.ytplayer;
|
||||||
|
}
|
||||||
// end special cases
|
// end special cases
|
||||||
|
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
@ -357,5 +368,8 @@ __wbvidrw = (function() {
|
|||||||
flashembed(div_id, opts, {"config": config});
|
flashembed(div_id, opts, {"config": config});
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", check_videos);
|
document.addEventListener("DOMContentLoaded", function() {
|
||||||
|
window.setTimeout(check_videos, 200);
|
||||||
|
});
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
@ -71,7 +71,8 @@ class RangeCache(object):
|
|||||||
if len(parts) == 2 and parts[1]:
|
if len(parts) == 2 and parts[1]:
|
||||||
end = int(parts[1])
|
end = int(parts[1])
|
||||||
else:
|
else:
|
||||||
end = start + self.DEFAULT_BUFF - 1
|
#end = start + self.DEFAULT_BUFF - 1
|
||||||
|
end = ''
|
||||||
|
|
||||||
return url, start, end, use_206
|
return url, start, end, use_206
|
||||||
|
|
||||||
@ -142,10 +143,12 @@ class RangeCache(object):
|
|||||||
|
|
||||||
status_headers = StatusAndHeaders('206 Partial Content', spec['headers'])
|
status_headers = StatusAndHeaders('206 Partial Content', spec['headers'])
|
||||||
status_headers.replace_header('Content-Range', content_range)
|
status_headers.replace_header('Content-Range', content_range)
|
||||||
|
status_headers.replace_header('Accept-Ranges', 'bytes')
|
||||||
else:
|
else:
|
||||||
status_headers = StatusAndHeaders('200 OK', spec['headers'])
|
status_headers = StatusAndHeaders('200 OK', spec['headers'])
|
||||||
|
|
||||||
status_headers.replace_header('Content-Length', str(maxlen))
|
status_headers.replace_header('Content-Length', str(maxlen))
|
||||||
|
|
||||||
return status_headers, read_range()
|
return status_headers, read_range()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user