DASH support
This commit is contained in:
1 parent
adfcfabad1
commit
b113fcfe7e
3 files changed
+23
-19
No files matched your search
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- Play video API
|
- Play video API
|
||||||
- Play video by ID/URL in web app
|
- Play video by ID/URL in web app
|
||||||
- Metadata to Video Player
|
- Metadata to Video Player
|
||||||
|
- Support for DASH and Live videos
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Bug where Settings page and home page are both visible, if settings page is selected, and user logs in.
|
- Bug where Settings page and home page are both visible, if settings page is selected, and user logs in.
|
||||||
|
|||||||
@@ -79,13 +79,17 @@ function OnVideoPlayerStateChange() as void
|
|||||||
' A hack to see if we could use the proxy here
|
' A hack to see if we could use the proxy here
|
||||||
if m.videoPlayingSuccess <> true
|
if m.videoPlayingSuccess <> true
|
||||||
errorInfo = m.videoPlayer.errorInfo
|
errorInfo = m.videoPlayer.errorInfo
|
||||||
if errorInfo.category = "http"
|
' http for stream format, mediaerror for DASH
|
||||||
videoId = m.videoPlayer.videoId
|
if errorInfo.category = "http" or errorInfo.category = "mediaerror"
|
||||||
itag = m.videoPlayer.content.itag
|
|
||||||
url = m.videoPlayer.content.url
|
url = m.videoPlayer.content.url
|
||||||
if url.InStr("local=true") = -1
|
if url.InStr("local=true") = -1
|
||||||
print(`Video ${url} failed to play. Trying a proxy (local=true)`)
|
print(`Video ${url} failed to play. Trying a proxy (local=true)`)
|
||||||
m.videoPlayer.content.url = Invidious.GetVideoUrl(videoId, itag, true)
|
if url.InStr("?") = -1
|
||||||
|
url += "?local=true"
|
||||||
|
else
|
||||||
|
url += "&local=true"
|
||||||
|
end if
|
||||||
|
m.videoPlayer.content.url = url
|
||||||
' This video errored, and is about to finish, so don't close the video yet
|
' This video errored, and is about to finish, so don't close the video yet
|
||||||
' TODO: perhaps creating a second player is better?
|
' TODO: perhaps creating a second player is better?
|
||||||
m.videoPlayer.ignoreNextFinishedState = true
|
m.videoPlayer.ignoreNextFinishedState = true
|
||||||
@@ -123,10 +127,20 @@ function StartVideoDetailsTask(videoId as string)
|
|||||||
videoId = task.output.videoId
|
videoId = task.output.videoId
|
||||||
metadata = task.output.metadata
|
metadata = task.output.metadata
|
||||||
if metadata <> invalid
|
if metadata <> invalid
|
||||||
stream = metadata.formatStreams[metadata.formatStreams.Count() - 1]
|
|
||||||
contentNode = CreateObject("roSGNode", "ContentNode")
|
contentNode = CreateObject("roSGNode", "ContentNode")
|
||||||
contentNode.addFields({ videoId: videoId, itag: stream.itag })
|
contentNode.addFields({ videoId: videoId })
|
||||||
contentNode.url = stream.url
|
|
||||||
|
if metadata.hlsUrl <> invalid
|
||||||
|
contentNode.url = metadata.hlsUrl
|
||||||
|
else if metadata.dashUrl <> invalid
|
||||||
|
contentNode.url = metadata.dashUrl
|
||||||
|
else
|
||||||
|
stream = metadata.formatStreams[metadata.formatStreams.Count() - 1]
|
||||||
|
itag = stream.itag
|
||||||
|
' Use an url relative to the host, so we can proxy(local=true) in case it fails
|
||||||
|
contentNode.url = Invidious.GetVideoUrl(videoId, itag)
|
||||||
|
end if
|
||||||
|
|
||||||
contentNode.title = metadata.title
|
contentNode.title = metadata.title
|
||||||
contentNode.secondaryTitle = metadata.author
|
contentNode.secondaryTitle = metadata.author
|
||||||
SetCaptions(metadata, m.videoPlayer, contentNode)
|
SetCaptions(metadata, m.videoPlayer, contentNode)
|
||||||
|
|||||||
@@ -75,18 +75,7 @@ namespace Invidious
|
|||||||
|
|
||||||
' TODO: handle 500 {"error":"This video is unavailable"}
|
' TODO: handle 500 {"error":"This video is unavailable"}
|
||||||
if response.statuscode = 200
|
if response.statuscode = 200
|
||||||
videoMetadata = response.json
|
return response.json
|
||||||
lastItag = videoMetadata.formatStreams[videoMetadata.formatStreams.Count() - 1].itag
|
|
||||||
|
|
||||||
' GetVideoUrl returns a url that redirects to the video stream
|
|
||||||
' TODO: is this reliable?
|
|
||||||
videoUrl = Invidious.GetVideoUrl(videoId, lastItag, false)
|
|
||||||
|
|
||||||
videoMetadata.formatStreams.push({
|
|
||||||
itag: lastItag,
|
|
||||||
url: videoUrl
|
|
||||||
})
|
|
||||||
return videoMetadata
|
|
||||||
end if
|
end if
|
||||||
return invalid
|
return invalid
|
||||||
end function
|
end function
|
||||||
|
|||||||
Reference in new issue
Block a user