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]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Medium video quality in the settings (For most videos, this is 360p)
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- (Regression) Issue where auto-play keeps playing the same videos in a loop
|
- (Regression) Issue where auto-play keeps playing the same videos in a loop
|
||||||
|
|||||||
@@ -154,9 +154,13 @@ namespace Invidious
|
|||||||
return request.Await()
|
return request.Await()
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function GetVideoStreamUrl(videoId as string) as string
|
function GetVideoStreamUrl(videoId as string, itag = invalid as dynamic) as string
|
||||||
instance = m.GetInstance()
|
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
|
end function
|
||||||
|
|
||||||
function MarkFeedPagination(feedContentNode as object) as object
|
function MarkFeedPagination(feedContentNode as object) as object
|
||||||
|
|||||||
@@ -63,12 +63,12 @@ function CreateStreamUrls(metadata as object, service as Invidious.InvidiousServ
|
|||||||
else
|
else
|
||||||
preferredQuality = preferences["playback.preferred_quality"]
|
preferredQuality = preferences["playback.preferred_quality"]
|
||||||
|
|
||||||
if preferredQuality = "720p"
|
if preferredQuality = "auto"
|
||||||
AddStreamUrls(streamUrls, metadata, service, proxyVideos)
|
|
||||||
AddDashUrls(streamUrls, metadata, proxyVideos, playletServerPort)
|
AddDashUrls(streamUrls, metadata, proxyVideos, playletServerPort)
|
||||||
|
AddStreamUrls(streamUrls, metadata, service, proxyVideos, preferredQuality)
|
||||||
else
|
else
|
||||||
|
AddStreamUrls(streamUrls, metadata, service, proxyVideos, preferredQuality)
|
||||||
AddDashUrls(streamUrls, metadata, proxyVideos, playletServerPort)
|
AddDashUrls(streamUrls, metadata, proxyVideos, playletServerPort)
|
||||||
AddStreamUrls(streamUrls, metadata, service, proxyVideos)
|
|
||||||
end if
|
end if
|
||||||
end if
|
end if
|
||||||
|
|
||||||
@@ -101,12 +101,33 @@ function AddDashUrls(streamUrls as object, metadata as object, proxyVideos as st
|
|||||||
AddUrls(streamUrls, dashUrl, dashUrlLocal, proxyVideos)
|
AddUrls(streamUrls, dashUrl, dashUrlLocal, proxyVideos)
|
||||||
end function
|
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
|
if metadata.formatStreams = invalid or metadata.formatStreams.Count() = 0
|
||||||
return
|
return
|
||||||
end if
|
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)
|
localUrl = AddLocalFlag(url)
|
||||||
|
|
||||||
AddUrls(streamUrls, url, localUrl, proxyVideos)
|
AddUrls(streamUrls, url, localUrl, proxyVideos)
|
||||||
|
|||||||
@@ -19,13 +19,17 @@
|
|||||||
defaultValue: "auto",
|
defaultValue: "auto",
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
displayText: "Auto",
|
displayText: "Auto (DASH)",
|
||||||
value: "auto",
|
value: "auto",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayText: "720p",
|
displayText: "720p",
|
||||||
value: "720p",
|
value: "720p",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
displayText: "Medium",
|
||||||
|
value: "medium",
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in new issue
Block a user