Skip to content

🎥 Make videos programmatically with React

show streams with biggest bandwidth first

Jonny Burgerfd240209776c
diff --git a/packages/media-parser/src/containers/m3u/get-streams.ts b/packages/media-parser/src/containers/m3u/get-streams.ts
index 7127bd42ce..3eb6671408 100644
--- a/packages/media-parser/src/containers/m3u/get-streams.ts
+++ b/packages/media-parser/src/containers/m3u/get-streams.ts
@@ -103,6 +103,12 @@ export const getM3uStreams = (
const bResolution = b.resolution
? b.resolution.width * b.resolution.height
: 0;
+ if (aResolution === bResolution) {
+ const bandwidthA = a.averageBandwidth ?? a.bandwidth ?? 0;
+ const bandwidthB = b.averageBandwidth ?? b.bandwidth ?? 0;
+ return bandwidthB - bandwidthA;
+ }
+
return bResolution - aResolution;
});