Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add transcript selection to Via #1057

Open
seanh opened this issue Jul 10, 2023 · 4 comments
Open

Add transcript selection to Via #1057

seanh opened this issue Jul 10, 2023 · 4 comments

Comments

@seanh
Copy link
Contributor

seanh commented Jul 10, 2023

Via's YouTube transcript API currently just returns one of the video's English transcripts (and errors if there's no English transcript).

We need to add support to Via for specifying which transcript to use when a video has multiple transcripts, and this needs to be done in such a way that LMS can specify the transcript to Via when launching an assignment. (LMS will be showing a list of transcripts to the instructor when creating an assignment and storing the instructor's choice of transcript in LMS's DB, but that's a separate issue: this issue is just about the Via part.)

@seanh
Copy link
Contributor Author

seanh commented Jul 10, 2023

Proposed Solution

Via's video player page (/video/youtube)

The URL for Via's video player (which the LMS app embeds in assignment pages) is currently:

/video/youtube?url={YOUTUBE_URL}

We should add an optional transcript query param to this, for example:

/video/youtube?url={YOUTUBE_URL}&transcript={TRANSCRIPT_ID}

The LMS app will then include the transcript={TRANSCRIPT_ID} query param in the URL when embedding Via.

If there's no transcript_id query param then Via's video player page will fall back to its current behaviour: Via will choose one of the video's transcripts by default according to Via's own default transcript selection algorithm. This default fallback behaviour might be used:

  • For existing LMS YouTube test assignments that were created before we added transcript selection to LMS
  • When the user just pastes a URL into Via's front page (the user doesn't get a chance to select the transcript in this case). The Via front page is currently used for testing the video annotations feature in dev and QA. In future it may be released to public Via users. We might want to add UI to Via for public Via users to select the transcript, but that's for the future.
  • When the user creates an LMS YouTube assignment without selecting a transcript, if the UI makes this possible. For example this might happen if the user chooses the paste-a-URL option when creating an assignment (instead of the special YouTube picker) and pastes in a YouTube URL. Even with the YouTube picker we may want to make selecting the language an optional step in the UX design. LMS's assignment creation UI could theoretically avoid the user ever being able to create a YouTube assignment by any means without selecting a language, but this might be undesirable in UX terms, in any case I don't think we want to require this from the UI.

Via's transcript API (/api/youtube/transcript)

The video player page at /video/youtube?url={YOUTUBE_URL}&transcript={TRANSCRIPT_ID} then makes a GET request to Via's get_transcript() API. This transcript API currently uses URLs like:

/api/youtube/transcript/{video_id}

We should add a transcript component to the path, like this:

/api/youtube/transcript/{video_id}/{transcript_id}

This makes the transcript ID a required parameter to this API: requesting /api/youtube/transcript/{video_id} without the /{transcript_id} will 404. This will work because the view for the video player page that makes these API requests will apply a default transcript selection if no transcript ID is provided and will never make an API request without the /{transcript_id}. This simplifies the API code and avoids duplicating the default value.

If the chosen transcript ID isn't available from YouTube then the API will return an error of some sort.

@acelaya
Copy link
Contributor

acelaya commented Jul 10, 2023

Couple of notes:

  • For example this might happen if the user chooses the paste-a-URL option when creating an assignment (instead of the special YouTube picker)

    This should not happen very often, as we changed the regular URLPicker to disallow YouTube URLs: Do not allow YouTube video URLs when using the URLPicker lms#5503

    But of course this is just client-side validation. Someone could bypass this by triggering a LMS backend call from the browser console or a similar mechanism, so not entirely impossible.

  • Right now, the YouTubePicker is passing YouTube's raw URL as the assignment's URL, which I guess is later "translated" into via's /video/youtube?url={YOUTUBE_URL} by LMS backend.

    We will need to think on a way to pass the language as well, maybe by re-considering the usage of a custom URL for YouTube assignments where we can pass multiple params (eg, video://youtube/{id}/{language})

@seanh seanh changed the title Add YouTube transcript language selection to Via Add transcript language selection to Via Jul 25, 2023
@seanh seanh added the Backend label Jul 25, 2023
@seanh
Copy link
Contributor Author

seanh commented Jul 25, 2023

For example this might happen if the user chooses the paste-a-URL option when creating an assignment (instead of the special YouTube picker)

This should not happen very often, as we changed the regular URLPicker to disallow YouTube URLs: hypothesis/lms#5503

But of course this is just client-side validation. Someone could bypass this by triggering a LMS backend call from the browser console or a similar mechanism, so not entirely impossible.

Even if the user does use the frontend's special YouTube picker to create an assignment I don't think we necessarily want that picker to make the user view the list of transcripts for the YouTube video and select one. I think we may want a UX that allows the user to skip this step by default, not having to either view the list of transcripts or select one of the transcripts, but allows the user to view the transcripts and select one only if they want to. (Of course this depends on what UX design we come up with for transcript selection in LMS.)

In these cases where the LMS user creates a YouTube assignment without selecting a transcript we might want LMS itself to select a default transcript and store that selection with the assignment in its DB, rather than letting Via select the default transcript, but that's for later: when we come to adding transcript selection to LMS's assignment creation. This issue is just about adding a transcript selection capability to Via (which later LMS work will make use of).

@seanh
Copy link
Contributor Author

seanh commented Jul 25, 2023

Right now, the YouTubePicker is passing YouTube's raw URL as the assignment's URL, which I guess is later "translated" into via's /video/youtube?url={YOUTUBE_URL} by LMS backend.

We will need to think on a way to pass the language as well, maybe by re-considering the usage of a custom URL for YouTube assignments where we can pass multiple params (eg, video://youtube/{id}/{language})

That's for later: there'll be a separate issue about adding a transcript selection feature to LMS's assignment creation. This issue is just about adding a transcript selection capability to Via (which later LMS work will make use of).

@seanh seanh changed the title Add transcript language selection to Via Add transcript selection to Via Jul 25, 2023
@seanh seanh removed their assignment Aug 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants