Add medium video quality video to the settings (#230)
This commit is contained in:
1 parent
6e4262e6a5
commit
54b0acbe8f
4 files changed
+41
-8
No files matched your search
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
|
||||
- Medium video quality in the settings (For most videos, this is 360p)
|
||||
|
||||
### Fixed
|
||||
|
||||
- (Regression) Issue where auto-play keeps playing the same videos in a loop
|
||||
|
||||
@@ -154,9 +154,13 @@ namespace Invidious
|
||||
return request.Await()
|
||||
end function
|
||||
|
||||
function GetVideoStreamUrl(videoId as string) as string
|
||||
function GetVideoStreamUrl(videoId as string, itag = invalid as dynamic) as string
|
||||
instance = m.GetInstance()
|
||||
return `${instance}/latest_version?id=${videoId}`
|
||||
url = `${instance}/latest_version?id=${videoId}`
|
||||
if itag <> invalid
|
||||
url = `${url}&itag=${itag}`
|
||||
end if
|
||||
return url
|
||||
end function
|
||||
|
||||
function MarkFeedPagination(feedContentNode as object) as object
|
||||
|
||||
@@ -63,12 +63,12 @@ function CreateStreamUrls(metadata as object, service as Invidious.InvidiousServ
|
||||
else
|
||||
preferredQuality = preferences["playback.preferred_quality"]
|
||||
|
||||
if preferredQuality = "720p"
|
||||
AddStreamUrls(streamUrls, metadata, service, proxyVideos)
|
||||
if preferredQuality = "auto"
|
||||
AddDashUrls(streamUrls, metadata, proxyVideos, playletServerPort)
|
||||
AddStreamUrls(streamUrls, metadata, service, proxyVideos, preferredQuality)
|
||||
else
|
||||
AddStreamUrls(streamUrls, metadata, service, proxyVideos, preferredQuality)
|
||||
AddDashUrls(streamUrls, metadata, proxyVideos, playletServerPort)
|
||||
AddStreamUrls(streamUrls, metadata, service, proxyVideos)
|
||||
end if
|
||||
end if
|
||||
|
||||
@@ -101,12 +101,33 @@ function AddDashUrls(streamUrls as object, metadata as object, proxyVideos as st
|
||||
AddUrls(streamUrls, dashUrl, dashUrlLocal, proxyVideos)
|
||||
end function
|
||||
|
||||
function AddStreamUrls(streamUrls as object, metadata as object, service as Invidious.InvidiousService, proxyVideos as string) as void
|
||||
function AddStreamUrls(streamUrls as object, metadata as object, service as Invidious.InvidiousService, proxyVideos as string, preferredQuality as string) as void
|
||||
if metadata.formatStreams = invalid or metadata.formatStreams.Count() = 0
|
||||
return
|
||||
end if
|
||||
|
||||
url = service.GetVideoStreamUrl(metadata.videoId)
|
||||
itag = invalid
|
||||
' If we prefer medium quality, we check if we have a 360p or 480p streams
|
||||
if preferredQuality = "medium"
|
||||
' These are roughly the itags for 360p and 480p
|
||||
' Most videos will hit 18, which is 360p
|
||||
mediumItags = {
|
||||
"18": true,
|
||||
"43": true,
|
||||
"44": true,
|
||||
"82": true,
|
||||
"83": true,
|
||||
"101": true
|
||||
}
|
||||
for each formatStream in metadata.formatStreams
|
||||
if mediumItags[ValidString(formatStream.itag)] = true
|
||||
itag = formatStream.itag
|
||||
exit for
|
||||
end if
|
||||
end for
|
||||
end if
|
||||
|
||||
url = service.GetVideoStreamUrl(metadata.videoId, itag)
|
||||
localUrl = AddLocalFlag(url)
|
||||
|
||||
AddUrls(streamUrls, url, localUrl, proxyVideos)
|
||||
|
||||
@@ -19,13 +19,17 @@
|
||||
defaultValue: "auto",
|
||||
options: [
|
||||
{
|
||||
displayText: "Auto",
|
||||
displayText: "Auto (DASH)",
|
||||
value: "auto",
|
||||
},
|
||||
{
|
||||
displayText: "720p",
|
||||
value: "720p",
|
||||
},
|
||||
{
|
||||
displayText: "Medium",
|
||||
value: "medium",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
Reference in new issue
Block a user