killergerbah / asbplayer

Browser-based media player and Chrome extension for subtitle sentence mining
MIT License
505 stars 65 forks source link

Expose subtitle timestamps as Anki fields (For embedding YouTube video in Anki card) #458

Closed lonlazer closed 2 months ago

lonlazer commented 3 months ago

Is your feature request related to a problem? Please describe. It would be great, if the timestamps of a subtile (start and end time) could be exposed as additional fields for Anki. This way it would be possible to embed a YouTube video into an Anki card and let it only play the desired timespan. It would be also helpful to have the video id instead of just the full URL as a separate field. However, this could also be done using JavaScript within the Anki card.

<iframe
    width="560"
    height="315"
    src="https://www.youtube.com/embed/{{id}}?start={{startSeconds}}&end={{endSeconds}}&autoplay=1"
    frameborder=0
       autoplay=1
/>

Describe the solution you'd like New fields: Start seconds, end seconds, YouTube video ID

Describe alternatives you've considered This is inspired by the youtube2anki plugin. However, it is difficult to use as it relies on the transcript rather than the subtitles (language not changable).

Additional context image

killergerbah commented 3 months ago

I'm inclined to set the URL or Source fields to the embed URL to solve your use-case for the Anki card, but why do you want the video ID separately?

lonlazer commented 3 months ago

Thank you for your reply :)

I'm inclined to set the URL or Source fields to the embed URL to solve your use-case for the Anki card

That would also be a great solution.

but why do you want the video ID separately?

That would be only necessary to compose the embed link like this: https://www.youtube.com/embed/{{id}}?start={{startSeconds}}&end={{endSeconds}} So it would not be required if the full embed URL was already included in the source field.

bpwhelan commented 2 weeks ago

This works well, but I was wondering if end={{endSeconds}} is really necessary?

It's really annoying to not be able to go forward in the video and I usually end up removing this part of the url before sending it to Anki, which is not that much of a problem, but I think like many users would have the same feel...

For example, the first link, you absolutely cannot go past that moment without removing end from the parameters. I think this is dumb by youtube, but I wouldn't expect them to ever change it.

https://www.youtube.com/embed/z7EZK9ndPkg?start=891&autoplay=1&end=895

https://www.youtube.com/embed/z7EZK9ndPkg?start=891&autoplay=1

Feel free to pushback on this, I understand the use-case for end=