🌻 Lingua Libre SignIt web-browser extension translates selected word in French Sign Language via an elegant pop up so you learn sign language while reading online.
As mentioned in previous PR , video tag was replaced by iframe. While this allowed our extension to work on sites with strict CSP headers like Github or X, it also broke twospeed feature. The twospeed feature enabled users to view the video first in normal speed and then in slow mo.
To counter this @hugolpz came up with the approach of using video hosted on github pages ,set as iframe's src. While iframe didn't violate CSP headers' media-src directive, using a page that is hosted by us allowed us to manipulate the DOM and have control over the embedded video. Hence the twospeed feature is back again.
The way this works goes something like this :
refactor : changed iframe's src attribute - When embedding video inside iframe we pass the link of the github pages hosted site along with our desired video and twospeed value as query parameters.
108 - Inside our page , we manipulate the DOM such that we extract the video URL and twospeed value from URL of our page, embed the video inside another iframe , access the element by Id and implement the twospeed feature when the video is ended given the value is true.
code cleanup - Since code related to the above feature was already in a different file , I thought of cleaning the code base to avoid any confusion.
With this our extension would work on all the sites , even the ones with strict CSP values and we won't be lacking on any other features as well and #107 can be closed!
Description
As mentioned in previous PR ,
video
tag was replaced byiframe
. While this allowed our extension to work on sites with strict CSP headers like Github or X, it also broketwospeed
feature. Thetwospeed
feature enabled users to view the video first in normal speed and then in slow mo.To counter this @hugolpz came up with the approach of using video hosted on github pages ,set as
iframe
's src. While iframe didn't violate CSP headers' media-src directive, using a page that is hosted by us allowed us to manipulate the DOM and have control over the embedded video. Hence thetwospeed
feature is back again.The way this works goes something like this :
twospeed
value as query parameters.108 - Inside our page , we manipulate the DOM such that we extract the video URL and
twospeed
value from URL of our page, embed the video inside another iframe , access the element by Id and implement thetwospeed
feature when the video is ended given the value is true.code cleanup - Since code related to the above feature was already in a different file , I thought of cleaning the code base to avoid any confusion.
With this our extension would work on all the sites , even the ones with strict CSP values and we won't be lacking on any other features as well and #107 can be closed!