I’ve been using Google Apps Script to deploy a web app, which plays videos on the side bar. The video links are from the Google Sheet. It worked until I have two files about 500mb each. The videos couldn’t play at all. When I manually reduced the file size, it worked. But it’s inconvenient to do so everytime. So I was wondering if there’s a better way out? Thanks!
Html:
<video id="vid" controls autoplay muted> <source src="" type="video/MP4"> </video>
JavaScript (partial):
let source=document.querySelector('#vid > source');
source.src=e.target.options.vidID;
source.parentNode.load();
vidID holds the content of a cell in a Google Sheet column that holds the links to the videos in Drive. It is part of the codes where each row in the Sheet is recorded as a marker and used to produce an interactive map.
2
Answers
It seems that it varies depending on what you are using to host your
website/app
. This is whatGoogle Studio Help
has to say aboutfile size limits
:Yes, there is a limit to the file size of a video that can be played using the HTML5
<video>
tag. The exact limit will depend on several factors, such as the browser being used, the available memory of the device, and the video codec being used.However, in general, most modern web browsers can handle video files up to a few gigabytes in size. For example, Google Chrome can typically play videos up to 2 GB in size, while Mozilla Firefox can handle videos up to 512 MB. However, it’s important to note that playing large video files can put a strain on the user’s device, potentially causing performance issues or even crashes.
The size limit may vary depending on the browser, device,
and network conditions:
Network: File size have an impact the time it takes for the video to load and start playing.
If the network bandwidth is limited, a large video file may take longer to load, resulting in longer buffering times,
interruptions.
Device: Playing large files on devices with limited processing power or memory may result in performance issues, such as freezing or crashing.
Browser: Some older browsers may have limitations on the maximum size of a video file that can be played
using the tag. Modern browsers generally have support for playing large video files.
Finally, it is best to use video files that are optimized for web playback, such as MP4 files with H.264 video codec and to compress the video to a reasonable size to ensure smooth playback on different devices and network conditions.
The spec advises the attribute
preload
to be set tometadata
which indicates that only video metadata (e.g. length) is fetched hence better in performance.