I have a presentation in Google Slides that includes a Video from Drive. I'd like to use an Apps Script to programmatically replace this Video with another, also from Drive.
There are two ways I thought I could approach this:
Unfortunately (1) won't work because even though there is a getUrl
method for Video
, there is no corresponding setUrl
method. In fact, I realised that for a Video
that has been inserted from Drive, getUrl
returns null
. You can only use getVideoId
to get the Drive id for that video.
I couldn't get (2) to work either. There is an insertVideo
method for Slide
but it will only work for YouTube videos or for videos that exist in other slides or presentations.
Currently there is no way of doing it, as you said first option is not possible, and second is not available for Drive, only for Youtube.
I've tried possible workarounds based on the Drive API, specifically modifying the original video binary file with the content of the new one so we could keep the same ID and thus change the video on slides, but it does not work either, don't waste your time trying.
At this point, what I recommend is to submit a Feature request to add the setUrl method on Slides API, or to be able to change the VideoId.
On here you'll be able to do it, remember to add this post over the request.
https://issuetracker.google.com
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With