Youtube in ECML
Introduction
This page explains the design and implementation to make able to add YouTube videos in between slides while creating content.
Background
When a user is trying to Add video
, the pop up that contains two tabs – Library and Google Drive shows up where the users can either add videos from their Google drive or from already published Youtube video with CCBY4.0 license.
Problem Statement
Currently, in the content editor, a user can add/upload video only from Google drive and Library.
- The process is more complex as the user has to first create a resource with youtube on Generic Editor,
- Get the resource reviewed and published.
- And on Content Editor, search for the desired content and add it to the slides.
Solution 1 - Dedicated API for validation resources at the time of entering Youtube URL
A dedicated API to validate the license of YouTube video will be used while creating the content.
With the help of the video plugin org.ekstep.video-1.x
, similar to how the upload process of Google Drive videos, a user will be able to add a video through YouTube URLs upon license validation.
When a user gives Youtube URL, it is first validated against the permissible licenses. Based on the validation result, the user is shown a relevant message whether to add/preview or try a different video.
- On success - Using
org.ekstep.video-1.x
, the user will be able to preview the video and add to the stage - On failure - a warning message will be shown.
API Structure
Request Method: POST { "mime-type": "video/x-youtube", "url": "https://www.youtube.com/watch?v=06atTvwkuJE" } Response { "licenseType": "", "duration":"", "author": "" }
Sending for review:
When the editor sends it for review, the URL validation API is again hit to validate the license of the video and the relevant message is shown.
Pros:
- Content need not be in the review or published state for any sort of validation.
- A dedicated API will open up the scope to validate any type of content in the future.
Cons:
- There is a limitation in the number of times the GoogleAPI can be accessed.
- Every time the user enters a Youtube URL, a network request happens as many times for license validation
Solution 2 - Dedicated API for validation resources only at the time of reviewing content.
Once the editor is done creating content and hitting save, then the URL validation happens for all the Youtube videos present in the content.
For the Learning Platform to know if the content has to be scanned for Youtube License check, we have to include the meta in the ECML manifest.
The meta will include the following:
- Each Youtube video will be passed as
<media>
tag. <media>
tag will havetype
set toyoutube
- It will also have an attribute called
validate
. - This will help us validate any content type in the future by just parsing the manifest.
Cons:
- If there are many youtube videos inside the content, it will be difficult for the user to identify the invalid video in case of mass validation.
- The time the editor has taken to create the content will go in vain.
Solution 3- ContentEditor Level API check
In the Content Editor, the GoogleAPI can be directly used as a service to get the license of the entered Youtube URL.
- On success - Using
org.ekstep.video-1.x
, the user will be able to preview the video and add to the stage - On failure - a warning message will be shown.
Cons:
- API secret keys will get exposed to public.
Solution 4 - Create a content in the background and mark as flagged.
When the editor is trying to enter YouTube URL, create it as a content in the background and send it for License validation. The created content then will be published and marked as flagged so that it does not show up anywhere else in the platform.
- On success - Using
org.ekstep.video-1.x
, the user will be able to preview the video and add to the stage - On failure - a warning message will be shown.
URL validation from LP team
URL validation from LP team
Send for review
Conclusion:
- Create a validate API which internally calls getMetaData API.
- The API will be called at the time when an editor is inputting an URL as well as at the time of Save
- In the ECML Manifest - introduce a new property
youtube
to the attributetype
in<media>
tag. - Create
<media type='youtube'>
while adding YouTube video through via library as well as URL. - The LP team will have to make sure that any asset of
<media type='youtube'>
is refrained from attempting to download.