Spaces:
Running
Running
Fix VLC player issue with HLS stream with a status code & bump version
Browse files- README.md +2 -2
- mediaflow_proxy/handlers.py +5 -7
- pyproject.toml +1 -1
README.md
CHANGED
@@ -53,7 +53,7 @@ Set the following environment variables:
|
|
53 |
|
54 |
#### Using pip
|
55 |
|
56 |
-
> ![
|
57 |
> Ensure that you have Python 3.10 or higher installed.
|
58 |
|
59 |
1. Install the package:
|
@@ -74,7 +74,7 @@ Set the following environment variables:
|
|
74 |
|
75 |
#### Using git & poetry
|
76 |
|
77 |
-
> ![
|
78 |
> Ensure that you have Python 3.10 or higher installed.
|
79 |
|
80 |
|
|
|
53 |
|
54 |
#### Using pip
|
55 |
|
56 |
+
> ![IMPORTANT]
|
57 |
> Ensure that you have Python 3.10 or higher installed.
|
58 |
|
59 |
1. Install the package:
|
|
|
74 |
|
75 |
#### Using git & poetry
|
76 |
|
77 |
+
> ![IMPORTANT]
|
78 |
> Ensure that you have Python 3.10 or higher installed.
|
79 |
|
80 |
|
mediaflow_proxy/handlers.py
CHANGED
@@ -5,7 +5,6 @@ import httpx
|
|
5 |
from fastapi import Request, Response, HTTPException
|
6 |
from pydantic import HttpUrl
|
7 |
from starlette.background import BackgroundTask
|
8 |
-
from starlette.status import HTTP_206_PARTIAL_CONTENT
|
9 |
|
10 |
from .configs import settings
|
11 |
from .const import SUPPORTED_RESPONSE_HEADERS
|
@@ -69,7 +68,7 @@ async def handle_hls_stream_proxy(
|
|
69 |
|
70 |
return EnhancedStreamingResponse(
|
71 |
streamer.stream_content(destination, headers),
|
72 |
-
status_code=
|
73 |
headers=response_headers,
|
74 |
background=BackgroundTask(streamer.close),
|
75 |
)
|
@@ -137,12 +136,12 @@ async def handle_stream_request(method: str, video_url: str, headers: dict, veri
|
|
137 |
|
138 |
if method == "HEAD":
|
139 |
await streamer.close()
|
140 |
-
return Response(headers=response_headers, status_code=
|
141 |
else:
|
142 |
return EnhancedStreamingResponse(
|
143 |
streamer.stream_content(video_url, headers),
|
144 |
headers=response_headers,
|
145 |
-
status_code=
|
146 |
background=BackgroundTask(streamer.close),
|
147 |
)
|
148 |
except httpx.HTTPStatusError as e:
|
@@ -183,9 +182,8 @@ async def fetch_and_process_m3u8(
|
|
183 |
content=processed_content,
|
184 |
media_type="application/vnd.apple.mpegurl",
|
185 |
headers={
|
186 |
-
"
|
187 |
-
"
|
188 |
-
"Expires": "0",
|
189 |
},
|
190 |
)
|
191 |
except httpx.HTTPStatusError as e:
|
|
|
5 |
from fastapi import Request, Response, HTTPException
|
6 |
from pydantic import HttpUrl
|
7 |
from starlette.background import BackgroundTask
|
|
|
8 |
|
9 |
from .configs import settings
|
10 |
from .const import SUPPORTED_RESPONSE_HEADERS
|
|
|
68 |
|
69 |
return EnhancedStreamingResponse(
|
70 |
streamer.stream_content(destination, headers),
|
71 |
+
status_code=response.status_code,
|
72 |
headers=response_headers,
|
73 |
background=BackgroundTask(streamer.close),
|
74 |
)
|
|
|
136 |
|
137 |
if method == "HEAD":
|
138 |
await streamer.close()
|
139 |
+
return Response(headers=response_headers, status_code=response.status_code)
|
140 |
else:
|
141 |
return EnhancedStreamingResponse(
|
142 |
streamer.stream_content(video_url, headers),
|
143 |
headers=response_headers,
|
144 |
+
status_code=response.status_code,
|
145 |
background=BackgroundTask(streamer.close),
|
146 |
)
|
147 |
except httpx.HTTPStatusError as e:
|
|
|
182 |
content=processed_content,
|
183 |
media_type="application/vnd.apple.mpegurl",
|
184 |
headers={
|
185 |
+
"Content-Disposition": "inline",
|
186 |
+
"Accept-Ranges": "none",
|
|
|
187 |
},
|
188 |
)
|
189 |
except httpx.HTTPStatusError as e:
|
pyproject.toml
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
[tool.poetry]
|
2 |
name = "mediaflow-proxy"
|
3 |
-
version = "1.
|
4 |
description = "A high-performance proxy server for streaming media, supporting HTTP(S), HLS, and MPEG-DASH with real-time DRM decryption."
|
5 |
authors = ["mhdzumair <[email protected]>"]
|
6 |
readme = "README.md"
|
|
|
1 |
[tool.poetry]
|
2 |
name = "mediaflow-proxy"
|
3 |
+
version = "1.5.0"
|
4 |
description = "A high-performance proxy server for streaming media, supporting HTTP(S), HLS, and MPEG-DASH with real-time DRM decryption."
|
5 |
authors = ["mhdzumair <[email protected]>"]
|
6 |
readme = "README.md"
|