Sponsorblock add mute sections
This commit is contained in:
1 parent
7fd466fb25
commit
3f5cb84696
1 file changed
+17
@@ -196,6 +196,8 @@ function SetCaptions(metadata as object, videoPlayer as object, contentNode as o
|
|||||||
end function
|
end function
|
||||||
|
|
||||||
function OnPositionChangeSkipSponsorBlockSections() as void
|
function OnPositionChangeSkipSponsorBlockSections() as void
|
||||||
|
shouldMute = false
|
||||||
|
muteCategory = ""
|
||||||
segments = m.videoPlayer.skipSegments
|
segments = m.videoPlayer.skipSegments
|
||||||
for each segment in segments
|
for each segment in segments
|
||||||
' TODO: handle other action types
|
' TODO: handle other action types
|
||||||
@@ -211,5 +213,20 @@ function OnPositionChangeSkipSponsorBlockSections() as void
|
|||||||
return
|
return
|
||||||
end if
|
end if
|
||||||
end if
|
end if
|
||||||
|
if segment["actionType"] = "mute"
|
||||||
|
segmentRange = segment["segment"]
|
||||||
|
segmentStart = segmentRange[0]
|
||||||
|
segmentEnd = segmentRange[1]
|
||||||
|
currentPosition = m.videoPlayer.position
|
||||||
|
if (segmentStart < currentPosition) and (segmentEnd > currentPosition)
|
||||||
|
shouldMute = true
|
||||||
|
muteCategory = segment["category"]
|
||||||
|
exit for
|
||||||
|
end if
|
||||||
|
end if
|
||||||
end for
|
end for
|
||||||
|
if m.videoPlayer.mute <> shouldMute
|
||||||
|
print(`Muting section: ${muteCategory} - ${shouldMute}`)
|
||||||
|
m.videoPlayer.mute = shouldMute
|
||||||
|
end if
|
||||||
end function
|
end function
|
||||||
Reference in new issue
Block a user