Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
This is an iOS compatible method of embedding a video from SharePoint, if blob storage is not enabled.
<video controls="true" style="min-height:360px;width:100%;">
<source src="/PublishingImages/your-video.mp4">
Sorry, your browser does not support playback of this video.
if (/iPhone|iPad|iPod/i.test(navigator.userAgent) ||'video-ios-test') != -1) {
var source = jQuery("video source[src$=mp4]").attr('src');
var req = new XMLHttpRequest();'GET', source, true);
req.responseType = 'blob';
req.onload = function () {
if (this.status === 200) {
var videoBlob = this.response;
var vid = URL.createObjectURL(videoBlob);
jQuery('#iOSVideo').html('<a href="'+vid+'">Video ready! Click here to watch.</a>')
jQuery("video source[src$=mp4]").attr('src', vid)
} else {
jQuery('#iOSVideo').html('sorry, video could not be loaded.');
req.onerror = function () {
jQuery('#iOSVideo').html('sorry, there was an error loading the video.');
jQuery('video').after('<span id="iOSVideo">Please wait, video is loading... <i class="fa fa-spinner fa-spin"></i></span>');
jQuery('video').hide().attr('controls', 'false');

This comment has been minimized.

Copy link
Owner Author

@alirobe alirobe commented Jun 21, 2018

this should be saved as a text file in the style library, and referenced through a CEWP file link.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment