send hls directly
This commit is contained in:
parent
0951feab2e
commit
34734bb7e4
@ -269,10 +269,13 @@ class MainHandler(tornado.web.RequestHandler):
|
|||||||
upstream_proxy = await handler.proxy.proxy_url(upstream, None)
|
upstream_proxy = await handler.proxy.proxy_url(upstream, None)
|
||||||
ctype = await handler.proxy.content_type(upstream_proxy)
|
ctype = await handler.proxy.content_type(upstream_proxy)
|
||||||
self.set_header("Content-Type", ctype)
|
self.set_header("Content-Type", ctype)
|
||||||
if redir:
|
if ctype == "application/vnd.apple.mpegurl":
|
||||||
|
async with handler.proxy.local() as session:
|
||||||
|
resp = await session.get(upstream_proxy)
|
||||||
|
data = await resp.read()
|
||||||
|
self.write(data)
|
||||||
|
elif redir:
|
||||||
self.redirect(upstream_proxy, status=303)
|
self.redirect(upstream_proxy, status=303)
|
||||||
else:
|
|
||||||
self.set_header("Content-Location", upstream_proxy)
|
|
||||||
|
|
||||||
async def get(self):
|
async def get(self):
|
||||||
await self.handle_any(True)
|
await self.handle_any(True)
|
||||||
|
@ -167,7 +167,7 @@ class MetaRunner(StreamProvider):
|
|||||||
self.logger.info(e)
|
self.logger.info(e)
|
||||||
return StreamData(None, data.get("og:image"), data.get("og:title"), data.get("og:description"), False)
|
return StreamData(None, data.get("og:image"), data.get("og:title"), data.get("og:description"), False)
|
||||||
|
|
||||||
upstream_cache = expiringdict.ExpiringDict(max_len=128, max_age_seconds=30)
|
upstream_cache = expiringdict.ExpiringDict(max_len=4096, max_age_seconds=1800)
|
||||||
|
|
||||||
async def get_from_runner(cache_key, runner, logger):
|
async def get_from_runner(cache_key, runner, logger):
|
||||||
result = None
|
result = None
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
video.className = "video-js vjs-big-play-centered";
|
video.className = "video-js vjs-big-play-centered";
|
||||||
body.appendChild(video);
|
body.appendChild(video);
|
||||||
const ctype = xhr.getResponseHeader("Content-Type");
|
const ctype = xhr.getResponseHeader("Content-Type");
|
||||||
const media = xhr.getResponseHeader("Content-Location");
|
|
||||||
const image = xhr.getResponseHeader("Custom-Poster");
|
const image = xhr.getResponseHeader("Custom-Poster");
|
||||||
console.log(ctype);
|
console.log(ctype);
|
||||||
const options = {};
|
const options = {};
|
||||||
@ -44,7 +43,7 @@
|
|||||||
}
|
}
|
||||||
const source = {};
|
const source = {};
|
||||||
source.type = ctype;
|
source.type = ctype;
|
||||||
source.src = media;
|
source.src = upstream;
|
||||||
player.src(source);
|
player.src(source);
|
||||||
const canPlayTypeRaw = player.canPlayType(ctype);
|
const canPlayTypeRaw = player.canPlayType(ctype);
|
||||||
const canPlayType = (canPlayTypeRaw === "maybe") || (canPlayTypeRaw === "probably");
|
const canPlayType = (canPlayTypeRaw === "maybe") || (canPlayTypeRaw === "probably");
|
||||||
|
Loading…
Reference in New Issue
Block a user