diff --git a/browser/src/layer/vector/SVGGroup.js b/browser/src/layer/vector/SVGGroup.js index f347f95940af7..8240df4e924d4 100644 --- a/browser/src/layer/vector/SVGGroup.js +++ b/browser/src/layer/vector/SVGGroup.js @@ -3,6 +3,8 @@ * L.SVGGroup */ +/* global _ */ + L.SVGGroup = L.Layer.extend({ options: { @@ -78,6 +80,31 @@ L.SVGGroup = L.Layer.extend({ var point = this._map.latLngToLayerPoint(this._bounds.getNorthWest()); svgLastChild.setAttribute('x', point.x); svgLastChild.setAttribute('y', point.y); + + var video = svgLastChild.getElementsByTagName('video')[0]; + var source = svgLastChild.getElementsByTagName('source')[0]; + this.checkVideoSupport(video, source); + }, + + checkVideoSupport: function(video,source) { + var that = this; + var videoWarning = _('Document contains uncompatible video'); + + video.addEventListener('playing', function() { + window.setTimeout(function() { + if (video.webkitDecodedFrameCount === 0) { + that._map.uiManager.showSnackbar(videoWarning); + } + }, 1000); + }); + + video.addEventListener('error', function() { + that._map.uiManager.showSnackbar(videoWarning); + }); + + source.addEventListener('error', function() { + that._map.uiManager.showSnackbar(videoWarning); + }); }, addEmbeddedSVG: function (svgString) { diff --git a/browser/src/map/handler/Map.SlideShow.js b/browser/src/map/handler/Map.SlideShow.js index 44b1bbf7108b8..1c4f35c497815 100644 --- a/browser/src/map/handler/Map.SlideShow.js +++ b/browser/src/map/handler/Map.SlideShow.js @@ -115,6 +115,22 @@ L.Map.SlideShow = L.Handler.extend({ var separator = (this._slideURL.indexOf('?') === -1) ? '?' : '&'; this._slideShow.src = this._slideURL + separator + 'StartSlideNumber=' + this._startSlideNumber; this._slideShow.contentWindow.focus(); + + var that = this; + this._slideShow.addEventListener('load', function() { + var videos = that._slideShow.contentWindow.document.getElementsByTagName('video'); + var videoWarning = _('Document contains uncompatible video'); + for (var i = 0; i < videos.length; i++) { + if (videos[i].networkState === 3) { + that._map.uiManager.showSnackbar(videoWarning); + break; + } + var source = videos[i].getElementsByTagName('source')[0]; + source.addEventListener('error', function() { + that._map.uiManager.showSnackbar(videoWarning); + }); + } + }); }, _processSlideshowLinks: function() {