Playing Videos stored in Google Drive
If you want to play a GoogleDrive video in mp4 format on your HTML page, do the following:
- Open your GoogleDrive and right click on the video your want to play on your HTML page.
- In the menu that opens, choose 'get link'.
- In the tab that opens, make your link public (= anyone who has the link can see the video) and click on 'copy link'. The copied link looks like
https://drive.google.com/file/d/1KrtLp296xfwnxA3bDTajXtPOKTqDs8Cb/view?usp=sharing or something similar. The id of the video is the part in green.
- Now in order to play the video using the video embed element, replace the copied link with https://drive.google.com/uc?export=download&id=1KrtLp296xfwnxA3bDTajXtPOKTqDs8Cb. (In more general terms, replace https://drive.google.com/file/d/VIDEOID/view?usp=sharing with https://drive.google.com/uc?export=download&id=VIDEOID).
So this works:
<video controls src="https://drive.google.com/uc?export=download&id=1KrtLp296xfwnxA3bDTajXtPOKTqDs8Cb "></video>
If you want to dynamically include GoogleDrive videos in your page, you can do the following:
- Put this script in the head of your page.
- Create a link like <a style="cursor: pointer; text-decoration: underline" onclick="create_video('https://drive.google.com/uc?export=download&id=1KrtLp296xfwnxA3bDTajXtPOKTqDs8Cb', '80%', '80%') " >Liszt: Dante Symphony</a>
A click on this link will load a centered video whose size is 80% of the window (you may adapt the size) and whose position is fixed. The script provides it with a close button. You can make as many links as you want.
IMPORTANT: If the user's browser cookie settings are 'too secure', this may not work. The script will signal this to the user whenever this is the case.
DEMOS:
Tchaikovsky, Symphony No. 1 , First Movement
Liszt, Symphonic Poems (complete)
Liszt: Dante Symphony