FullFact / health-misinfo-shared

Raphael health misinformation project, shared by Full Fact and Google
MIT License
0 stars 0 forks source link

Embedded YouTube player does not jump to the correct timestamp (under quite specific circumstances!) #85

Open andylolz opened 2 months ago

andylolz commented 2 months ago

Describe the bug

This actually appears to be a YouTube Player API bug, but one that we might want to work around.

If you are logged into YouTube (I think this includes being logged into any Google account) and watch a long (more than 20 minutes, I think) video on the YouTube website, YouTube attempts to remember your position in the video. If you close the tab and reopen, it will continue playing from the same point. (I am not exactly sure how this works / what the parameters are.)

If YouTube has a remembered last position in the video and you run the same video through Raphael, this messes up jumping to timestamp in the YouTube embed. Clicking a claim to jump to the timestamp causes the embedded player to jump to that timestamp and then immediately jump to the last played position. This means it’s not really possible to jump to the right point in the video using the embedded player.

To Reproduce

Steps to reproduce the behaviour:

  1. Ensure you are logged into YouTube / Google
  2. Open a long video on the YouTube website e.g. this one: https://www.youtube.com/watch?v=4DWKf5RqU-s
  3. Skip halfway through the video
  4. Close the tab and click the link above again, to confirm that YouTube has remembered your position in the video
  5. Run the same video through Raphael, to extract claims
  6. Click a claim to jump to its timestamp
  7. Notice that for a split second, the embedded player jumps to the correct timestamp, and then jumps immediately to the wrong one.

Workarounds

This problem doesn’t occur if:

I had an initial go at technical workarounds, but I’m afraid I wasn’t able to find one.

andylolz commented 1 month ago

@JamesMcMinn suggests customising the embed code, e.g. to use youtube-nocookie.com to prevent cookies interfering. This sounds like a good route forward, and I suspect it’s possible to get it working with a bit more fiddling. But I wasn’t able to get it playing nicely with the YouTube Player API.