I'm looking for a programmatic way to include videos from Google Drive on a Google Site. My current plan is to have a spreadsheet seeded with the embed URL per row that is then mined via Google Apps Script to embed the content.
However, at the core of this program, I believe I am running into a known issue based on the similarity to http://code.google.com/p/google-apps-script-issues/issues/detail?id=1649 which was a Google bug with embedding a YouTube video on a Google Site.
As shown at this URL below, I have very small HTML file that plays Apple's example MP4 file which I uploaded to a Google Drive so I can embed it and which works as expected:
http://www.pccc.com/downloads/junk/test/test.html
However, if I duplicate the same HTML for an Apps Script, all I see is the grey border and the "this is a test" text that was added to confirm the latest revision was published:
function doGet(e) {
var html = '<iframe src="https://docs.google.com/a/documentshare.com/file/d/0B7wNkTj2wH_TLTdwcWo2NW5SWnM/preview" width="640" height="385"></iframe> This is a test';
return HtmlService.createHtmlOutput(html);
}
Any pointers appreciated.
Unfortunately the HtmlService doesn't support iframes.
This is doable but in a different way. You can have full access to a sites page HTML including iframes via script. See the doumentation. Do the edit first manually on the sites page: Insert > Video > Google docs. Then use the HTML generated as a template to write your own programmatically.
Edit: For example, follow these steps:
The code will change the page programatically but you will still have a working video.