diff --git a/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/FileElementImpl.java b/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/FileElementImpl.java index 6085bc3eb523653198f3ce9de99c3756a087a0eb..b2994654f5e8eff99b6141c5796eaec05209532f 100644 --- a/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/FileElementImpl.java +++ b/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/FileElementImpl.java @@ -182,7 +182,8 @@ public class FileElementImpl extends FormItemImpl } if (previewEl != null && uploadMimeType != null - && (uploadMimeType.startsWith("image/") || uploadMimeType.startsWith("video/"))) { + && (uploadMimeType.startsWith("image/") || uploadMimeType.startsWith("video/")) + && (!checkForMimeTypes || (isMimeTypeAllowed(uploadMimeType)))) { VFSLeaf media = new LocalFileImpl(tempUploadFile); previewEl.setMedia(media, uploadMimeType); previewEl.setCropSelectionEnabled(cropSelectionEnabled); @@ -304,20 +305,7 @@ public class FileElementImpl extends FormItemImpl } else if (checkForMimeTypes && tempUploadFile != null && tempUploadFile.exists()) { boolean found = false; if (uploadMimeType != null) { - for (String validType : getMimeTypeLimitations()) { - if (validType.equals(uploadMimeType)) { - // exact match: image/jpg - found = true; - break; - } else if (validType.endsWith("/*")) { - // wildcard match: image/* - if (uploadMimeType != null - && uploadMimeType.startsWith(validType.substring(0, validType.length() - 2))) { - found = true; - break; - } - } - } + found =isMimeTypeAllowed(uploadMimeType); } if (!found) { setErrorKey(i18nErrMimeType, i18nErrMimeTypeArgs); @@ -328,6 +316,27 @@ public class FileElementImpl extends FormItemImpl // No error, clear errors from previous attempts clearError(); } + + private boolean isMimeTypeAllowed(String mimeType) { + boolean found = false; + + for (String validType : getMimeTypeLimitations()) { + if (validType.equals(mimeType)) { + // exact match: image/jpg + found = true; + break; + } else if (validType.endsWith("/*")) { + // wildcard match: image/* + if (mimeType != null + && mimeType.startsWith(validType.substring(0, validType.length() - 2))) { + found = true; + break; + } + } + } + + return found; + } @Override public String getExampleText() { diff --git a/src/main/java/org/olat/core/gui/components/image/ImageComponent.java b/src/main/java/org/olat/core/gui/components/image/ImageComponent.java index 3b7c33220e3d606bbdcef7d6402dcd9b704f0fd1..0a51e5de24f96704abe170bc9c109dfa27476803 100644 --- a/src/main/java/org/olat/core/gui/components/image/ImageComponent.java +++ b/src/main/java/org/olat/core/gui/components/image/ImageComponent.java @@ -324,6 +324,12 @@ public class ImageComponent extends AbstractComponent implements Disposable { if(contentType.indexOf("mp4") >= 0) { return "mp4"; } + if(contentType.indexOf("webm") >= 0) { + return "webm"; + } + if(contentType.indexOf("webp") >= 0) { + return "webp"; + } if(contentType.indexOf("flv") >= 0) { return "flv"; } diff --git a/src/main/java/org/olat/core/gui/components/image/ImageRenderer.java b/src/main/java/org/olat/core/gui/components/image/ImageRenderer.java index 1d2a9bb1fe222190e5221051cf825a3688cbf758..9298cfdac6d3f411c2c684048c1e598979a9d84f 100644 --- a/src/main/java/org/olat/core/gui/components/image/ImageRenderer.java +++ b/src/main/java/org/olat/core/gui/components/image/ImageRenderer.java @@ -60,12 +60,9 @@ public class ImageRenderer extends DefaultComponentRenderer { private void renderMovie(StringOutput sb, ImageComponent ic) { // Use configured calculated scaled size, fallback to default size / ratio - int width = 320; - int height = 240; Size size = ic.getScaledSize(); - if(size != null) { - width = size.getWidth(); - height = size.getHeight() + 20;//+20 because of toolbar + if(size == null) { + size = ic.getRealSize(); } // Add video name with mime type ending for better browser support String mapperUrl = ic.getMapperUrl(); @@ -86,20 +83,27 @@ public class ImageRenderer extends DefaultComponentRenderer { sb.append("<div id='").append(compId).append("' class='o_video'>"); // START component // The inner component String imgId = "mov_" + ic.getDispatchID(); - sb.append("<div id='").append(imgId).append("' name='").append(imgId).append("' style='width:"); + sb.append("<div id='").append(imgId).append("' style='width:"); if(size != null) { - sb.append(width).append("px; height:").append(height).append("px;"); + sb.append(size.getWidth()).append("px; height:").append(size.getHeight()).append("px;"); } else { - // if no size available, scale to full width - sb.append("100%;"); - + // if no size available, try to scale to full width + sb.append("100%; min-width:480px;"); } sb.append("' class='o_video_wrapper'></div>") .append("<script>") .append("BPlayer.insertPlayer('").append(Settings.createServerURI()).append(mapperUrl); - sb.append("','").append(imgId).append("',").append(width).append(",").append(height).append(",'video'"); + sb.append("','").append(imgId).append("',"); + if(size == null) { + sb.append("undefined").append(",").append("undefined"); + } else { + sb.append(size.getWidth()).append(",").append(size.getHeight()); + } + sb.append(",0,0,'video',undefined,false,false,true,"); if (poster != null) { - sb.append(",null,null,null,null,null,null,'").append(poster).append("'"); + sb.append("'").append(poster).append("'"); + } else { + sb.append("undefined"); } sb.append(");") .append("</script>") diff --git a/src/main/java/org/olat/modules/portfolio/ui/_i18n/LocalStrings_de.properties b/src/main/java/org/olat/modules/portfolio/ui/_i18n/LocalStrings_de.properties index 18856a9c211dd3ceb80476597649923d59bfb13b..ef524bacc5b43e309ae743cbcdfc7998d154b22a 100644 --- a/src/main/java/org/olat/modules/portfolio/ui/_i18n/LocalStrings_de.properties +++ b/src/main/java/org/olat/modules/portfolio/ui/_i18n/LocalStrings_de.properties @@ -214,6 +214,7 @@ error.mail.invalid=Bitte geben Sie eine g\u00FCltige E-Mailadresse an. error.mimetype=$org.olat.core.commons.modules.bc\:WrongMimeType error.missing.permissions=Sie m\u00FCssen mindestens eine Berechtigung w\u00E4hlen. error.score=Punkte m\u00FCssen zwischen {0} und {1} sein. Oder die maximale Punktzahl, welche im Kurs definiert worden ist, wurde bereits mit anderen Sektionen erreicht. Mehr Informationen finden Sie im Bewertungswerkzeug des Kurses "{2}". +error.video.mimetype=$org.olat.modules.video.ui\:video.mime.type.error existing.invitee.selection=Bestehende Benutzer export.binder=Mappe exportieren export.binder.cp=Mappe als CP exportieren diff --git a/src/main/java/org/olat/modules/portfolio/ui/_i18n/LocalStrings_en.properties b/src/main/java/org/olat/modules/portfolio/ui/_i18n/LocalStrings_en.properties index 8802b1c4b488e868696d11e054b54b99ac5a4d7b..a5f9d5b3b36b9e6f5b1ce17c8157d12d1dbfe750 100644 --- a/src/main/java/org/olat/modules/portfolio/ui/_i18n/LocalStrings_en.properties +++ b/src/main/java/org/olat/modules/portfolio/ui/_i18n/LocalStrings_en.properties @@ -218,6 +218,7 @@ error.mail.invalid=Please provide a valid e-mail address. error.mimetype=$org.olat.core.commons.modules.bc\:WrongMimeType error.missing.permissions=You must choose at least one permission. error.score=Score is not between {0} and {1}. Or the maximum score defined in the course has already been reached with other sections. For more details see the assessment tool of the course "{2}". +error.video.mimetype=$org.olat.modules.video.ui\:video.mime.type.error existing.invitee.selection=Existing user export.binder=Export binder export.binder.cp=Export binder as CP diff --git a/src/main/java/org/olat/modules/portfolio/ui/media/CollectVideoMediaController.java b/src/main/java/org/olat/modules/portfolio/ui/media/CollectVideoMediaController.java index abb6f5264ce93e8ae68435c6cd913381e3b4d5ca..7239b84c4814b1bd126ca7fa00a32dfe41a874e9 100644 --- a/src/main/java/org/olat/modules/portfolio/ui/media/CollectVideoMediaController.java +++ b/src/main/java/org/olat/modules/portfolio/ui/media/CollectVideoMediaController.java @@ -23,6 +23,7 @@ import java.io.File; import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.Set; import org.olat.core.gui.UserRequest; import org.olat.core.gui.components.form.flexible.FormItem; @@ -43,6 +44,7 @@ import org.olat.core.id.context.BusinessControlFactory; import org.olat.core.util.Formatter; import org.olat.core.util.StringHelper; import org.olat.core.util.Util; +import org.olat.core.util.ValidationStatus; import org.olat.core.util.vfs.JavaIOItem; import org.olat.core.util.vfs.VFSItem; import org.olat.modules.ceditor.PageElement; @@ -63,6 +65,8 @@ import org.springframework.beans.factory.annotation.Autowired; * */ public class CollectVideoMediaController extends FormBasicController implements PageElementAddController { + + private static final Set<String> videoMimeTypes = Set.of("video/quicktime", "video/mp4"); private FileElement fileEl; private TextElement titleEl; @@ -133,6 +137,7 @@ public class CollectVideoMediaController extends FormBasicController implements descriptionEl.getEditorConfiguration().setPathInStatusBar(false); fileEl = uifactory.addFileElement(getWindowControl(), getIdentity(), "artefact.file", "artefact.file", formLayout); + fileEl.limitToMimeType(videoMimeTypes, "error.video.mimetype", null); fileEl.addActionListener(FormEvent.ONCHANGE); fileEl.setMaxUploadSizeKB(250000, null, null); fileEl.setPreview(ureq.getUserSession(), true); @@ -179,6 +184,10 @@ public class CollectVideoMediaController extends FormBasicController implements if(fileEl.getInitialFile() == null && (fileEl.getUploadFile() == null || fileEl.getUploadSize() < 1)) { fileEl.setErrorKey("form.legende.mandatory", null); allOk &= false; + } else { + List<ValidationStatus> status = new ArrayList<>(); + fileEl.validate(status); + allOk &= status.isEmpty(); } titleEl.clearError(); @@ -193,9 +202,9 @@ public class CollectVideoMediaController extends FormBasicController implements @Override protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) { if(fileEl == source) { - if (this.titleEl.isEmpty()) { - this.titleEl.setValue(fileEl.getUploadFileName()); - this.titleEl.getComponent().setDirty(true); + if (titleEl.isEmpty()) { + titleEl.setValue(fileEl.getUploadFileName()); + titleEl.getComponent().setDirty(true); } } super.formInnerEvent(ureq, source, event); diff --git a/src/main/webapp/static/movie/player.js b/src/main/webapp/static/movie/player.js index 07b922c82938f1715052c11b1ba2f3375ec3ec33..471f68104622b2c2323b0e678171c8f775aaef1b 100644 --- a/src/main/webapp/static/movie/player.js +++ b/src/main/webapp/static/movie/player.js @@ -348,6 +348,8 @@ var BPlayer = { mimeType = "video/mp4"; } else if(config.file.indexOf('openmeetings/recording') > 0) { mimeType = "video/mp4"; + } else if(extension.indexOf('webm') == 0) { + mimeType = "video/webm"; } else { alert('Something go badly wrong!' + config.provider + " " + extension); } diff --git a/src/main/webapp/static/movie/player.min.js b/src/main/webapp/static/movie/player.min.js index 2aaf3295c9e988db27e4efdaa438ed7d4216853c..34baf2ae9e9163faee3a0933a457d6c8f2d7dd89 100644 --- a/src/main/webapp/static/movie/player.min.js +++ b/src/main/webapp/static/movie/player.min.js @@ -1 +1 @@ -var BPlayer={insertPlayer:function(l,d,c,m,b,e,j,h,n,a,g,k,f){BPlayer.insertHTML5Player(l,d,c,m,b,e,j,h,n,a,g,k,f)},insertHTML5Player:function(c,g,n,m,e,a,p,t,s,k,o,l,j){var f=c;if(c.indexOf("://")<0&&(c.indexOf("/raw/static/")==0||c.indexOf("/secstatic/qtieditor/")>=0||c.indexOf("/secstatic/qti/")>=0)){f=c}else{if(c.indexOf("://")<0&&((p!="rtmp"&&p!="http")||((p=="rtmp"||p=="http")&&(t==undefined||t.length==0)))){var d=document.location.href;f=d.substring(0,d.lastIndexOf("/"));if(c.indexOf("/")!=0){f+="/"}f+=c}}var b={file:f,width:n,height:m,controlbar:{position:"bottom"}};if(typeof p!="undefined"){b.provider=p}if(p=="rtmp"||p=="http"){b.streamer=t}if(typeof e!="undefined"){var h=BPlayer._convertInSeconds(e);if(h>0){b.start=h}}if(typeof a!="undefined"){var r=BPlayer._convertInSeconds(a);if(r>0){b.duration=r}}if(typeof s!="undefined"&&s){b.autostart=true}if(typeof k!="undefined"&&k){b.repeat="single"}if(typeof o!="undefined"&&!o){b.controlbar="none"}if(typeof l!="undefined"&&l){b.image=l}if(typeof j!="undefined"){b.errorCallback=j}else{b.errorCallback=function(u,w,v){}}if(BPlayer._needJWPlayerFallback(b)){b.flashplayer=BPlayer._jwPlayerBaseUrl()+"movieViewer.swf";var q=function(){jwplayer(g).setup(b)};BPlayer._loadJWPlayer(q)}else{if(p=="nanoo"||f.indexOf("nanoo.tv/")>=0){BPlayer._loadNanooTv(g,b)}else{var q=function(){BPlayer._insertHTML5MediaElementPlayerWorker(g,b)};BPlayer.loadMediaelementJsPlayer(q)}}},loadMediaelementJsPlayer:function(d){var a=BPlayer._mediaElementBaseUrl();var c=a+(BPlayer.debugEnabled?"mediaelementplayer.css":"mediaelementplayer.min.css");var b=a+(BPlayer.debugEnabled?"mediaelement-and-player.js":"mediaelement-and-player.min.js");if(jQuery("#mediaelementplayercss").length==0){jQuery("<link>").appendTo("head").attr({id:"mediaelementplayercss",type:"text/css",rel:"stylesheet"}).attr("href",c)}if(typeof jQuery("body").mediaelementplayer!="undefined"){if(d){d()}}else{jQuery.ajax({dataType:"script",cache:true,async:false,url:b}).done(function(){if(d){d()}})}},_loadNanooTv:function(c,b){var a=c+"_frame";for(i=jQuery("#"+a).length;i-->0;){jQuery("#"+a).remove()}if(b.image===undefined||b.image===null||b.image.length==0){BPlayer._loadNanooTvFrame(c,a,b)}else{BPlayer._loadNanooTvPoster(c,a,b)}},_loadNanooTvPoster:function(f,a,b){if(jQuery("#mediaelementplayercss").length==0){var d=BPlayer._mediaElementBaseUrl();var e=d+(BPlayer.debugEnabled?"mediaelementplayer.css":"mediaelementplayer.min.css");jQuery("<link>").appendTo("head").attr({id:"mediaelementplayercss",type:"text/css",rel:"stylesheet"}).attr("href",e)}BPlayer._loadNanooResize(f,a,b);var g="<div id='"+a+"' class='mejs__container' role='application' style='width:"+b.width+"px; height:"+b.height+"px; overflow:hidden; overflow-x:hidden; overflow-y:hidden;'><div class='mejs__layers'><div class='mejs__poster mejs__layer' style='background-image: url("+b.image+"); width: 100%; height: 100%;'><img src='"+b.image+"' width='0' height='0'></img></div><div class='mejs__overlay mejs__layer mejs__overlay-play' style='width: 100%; height: 100%; z-index:10;'><div class='mejs__overlay-button' style='z-index:10;' role='button' tabindex='0' aria-label='Play' aria-pressed='false'></div></div></div></div>";var c=jQuery("#"+f);c.append(jQuery(g));c.css("border","none");jQuery("#"+f+" div.mejs__overlay-button").on("click",function(k,j){var h={file:b.file,width:b.width,height:b.height,autostart:true};BPlayer._loadNanooTvFrame(f,a,h)})},_loadNanooTvFrame:function(h,b,d){for(i=jQuery("#"+b).length;i-->0;){jQuery("#"+b).remove()}BPlayer._loadNanooResize(h,b,d);var c=d.file;var g=c.split("?");var a=g[0].substring(c.lastIndexOf("/")+1);if(d.autostart){c="https://www.nanoo.tv/link/w/"+a}else{c="https://www.nanoo.tv/link/n/"+a}var f='<iframe name="'+b+'" id="'+b+'" src="'+c+'" style="width:'+d.width+"px; height:"+d.height+'px; overflow:hidden;" frameborder="0" allow="fullscreen" allowfullscreen="true"></iframe>';var e=jQuery("#"+h);e.append(jQuery(f));e.css("border","none")},_loadNanooResize:function(f,h,d){try{var m=jQuery("#"+f);var a=m.parent("p , div");if(a.length==1&&typeof d.width!=="undefined"&&typeof d.height!=="undefined"){var n=jQuery(a).width();var c=d.width;var g=d.height;if(n&&n<c){var l=g/c;var j=n;var b=((n*l)|0);d.width=j;d.height=b}jQuery(window).resize(function(){var e=jQuery("#"+f).parent("p , div");var p=jQuery(e).width();if(p&&p<c){var q=g/c;var o=p;var r=((p*q)|0);jQuery("#"+h).width(o+"px").height(r+"px")}}).trigger("resize")}}catch(k){if(window.console){console.log(k)}}},_loadJWPlayer:function(a){if(BPlayer._isIE8()&&domId!="prev_container"&&jQuery("#"+domId).is("span")){alert("This is video is not supported on Internet Explorer 8. Sorry for the inconvenience")}else{jQuery.getScript(BPlayer._jwPlayerBaseUrl()+"player.jw.js",function(){if(a){a()}})}},_needJWPlayerFallback:function(a){if(a.provider=="rtmp"){if(a.file.match(/(.*)\/((flv|mp4|mp3):.*)/)){return false}else{return true}}return false},_insertHTML5MediaElementPlayerWorker:function(e,d){var k=BPlayer._mediaElementBaseUrl();var l={loop:d.repeat,pluginPath:k,stretching:"responsive",hls:{path:k+"hls/hls.min.js"},flv:{path:k+"flv/flv.min.js",withCredentials:true},error:d.errorCallback,success:function(o,q,p){if(d.start){p.load();o.addEventListener("canplay",function(){try{o.removeEventListener("canplay");p.setCurrentTime(d.start);p.play();if(!d.autostart){setTimeout(function(){p.pause()},100)}}catch(s){if(window.console){console.log(s)}}})}else{if(d.autostart){try{p.load();p.play()}catch(r){if(window.console){console.log(r)}}}}}};var a=null;var n=d.file.split(".").pop().toLowerCase().split("&").shift();if(d.provider=="sound"){if(n=="mp3"){a="audio/mp3"}else{if(n=="aac"){a="audio/aac"}else{if(n=="m4a"){a="audio/mp4"}}}}else{if(d.provider=="youtube"){a="video/youtube"}else{if(d.provider=="vimeo"){a="video/vimeo"}else{if(d.provider=="rtmp"){l.flashStreamer=d.streamer;a="video/rtmp"}else{if(d.provider=="http"){d.enablePseudoStreaming=true;if(n=="flv"){a="video/flv";l.renderers=["flash_video","native_flv"]}else{a="video/mp4"}}else{if(n=="flv"){a="video/flv";l.renderers=["flash_video","native_flv"]}else{if(n=="f4v"){a="video/flv"}else{if(n=="mp4"){a="video/mp4"}else{if(n=="m4v"){a="video/mp4"}else{if(n=="m3u8"){a="application/x-mpegURL"}else{if(n=="aac"){a="audio/mp4";d.provider="sound"}else{if(n=="mp3"){a="audio/mp3";d.provider="sound"}else{if(n=="m4a"){a="audio/mp4";d.provider="sound"}else{if(d.file.indexOf("vimeo.com")>-1){a="video/vimeo"}else{if(d.file.indexOf("youtube.com")>-1||d.file.indexOf("youtu.be")>-1||d.file.indexOf("youtube.be")>-1){a="video/youtube"}else{if(n.indexOf("mp4?")==0){a="video/mp4"}else{if(d.file.indexOf("openmeetings/recording")>0){a="video/mp4"}else{alert("Something go badly wrong!"+d.provider+" "+n)}}}}}}}}}}}}}}}}}var j;var c=e+"_oo"+Math.floor(Math.random()*1000000)+"vid";var f=e+"_oo"+Math.floor(Math.random()*1000000)+"obj";if(d.provider=="sound"){if(d.height){l.audioHeight=d.height}if(d.width){l.audioWidth=d.width}j="<audio id='"+c+"' controls='controls' oncontextmenu='return false;'";if(typeof d.repeat!="undefined"&&d.repeat){j+=" loop='loop'"}var b="<object id='"+f+"' type='application/x-shockwave-flash'";if(typeof d.height!="undefined"){j+=" height='"+d.height+"'";b+=" height='"+d.height+"'";l.videoHeight=d.height}if(typeof d.width!="undefined"){j+=" width='"+d.width+"'";b+=" width='"+d.width+"'";l.videoWidth=d.width}if(typeof d.image!="undefined"){j+=" poster='"+d.image+"'"}j+="><source type='"+a+"' src='"+d.file+"'>";var g="mediaelement-flash-video.swf";if(a=="audio/mp3"){g="mediaelement-flash-audio.swf"}else{if(a=="audio/ogg"){g="mediaelement-flash-audio-ogg.swf"}}j+=b+" data='"+k+g+"'>";j+="<param name='movie' value='"+k+g+"' />";j+="<param name='flashvars' value='controls=true&";if(typeof d.streamer!="undefined"){j+="&streamer="+d.streamer}j+="&file="+d.file+"' /></object>";j+="</audio>"}else{j="<video id='"+c+"' controls='controls' preload='none' oncontextmenu='return false;'";if(typeof d.repeat!="undefined"&&d.repeat){j+=" loop='loop'"}var b="<object id='"+f+"' type='application/x-shockwave-flash'";if(typeof d.height!="undefined"){l.videoHeight=d.height}if(typeof d.width!="undefined"){l.videoWidth=d.width}if(typeof d.image!="undefined"){j+=" poster='"+d.image+"'"}j+="><source type='"+a+"' src='"+d.file+"' />";j+=b+" data='"+k+"mediaelement-flash-video.swf'>";j+="<param name='movie' value='"+k+"mediaelement-flash-video.swf' />";j+="<param name='flashvars' value='controls=true";if(typeof d.streamer!="undefined"){j+="&streamer="+d.streamer}j+="&file="+d.file+"' /></object></video>"}var h=jQuery("#"+e);h.css({height:""});h.css({border:"none"});if(jQuery(window).width()<=d.width){h.css({width:""})}h.html(j);if(a=="video/vimeo"){var k=BPlayer._mediaElementBaseUrl();var m=k+(BPlayer.debugEnabled?"renderers/vimeo.js":"renderers/vimeo.min.js");jQuery.ajax({dataType:"script",cache:true,async:false,url:m}).done(function(){jQuery("#"+c).mediaelementplayer(l)})}else{jQuery("#"+c).mediaelementplayer(l)}},_mediaElementBaseUrl:function(){var a=BPlayer._findBaseUrl(window);if(a==null){a="/olat/raw/_noversion_/"}a+="movie/mediaelementjs/";return a},_isIE8:function(){return(jQuery.support.opacity==false)},_jwPlayerBaseUrl:function(){var a=BPlayer._findBaseUrl(window);if(a==null){a="/olat/raw/_noversion_/"}a+="movie/jw/";return a},_findBaseUrl:function(a){if(a.o_info){return a.o_info.o_baseURI}else{if(a.opener){return BPlayer._findBaseUrl(a.opener)}else{if(a.parent){return BPlayer._findBaseUrl(a.parent)}else{return null}}}},_convertInSeconds:function(d){if(typeof d=="undefined"||d==null){return 0}if(!d.length){return d}if(d.length==0){return 0}if(d.indexOf(".")>0){d=d.substring(0,d.indexOf("."))}var e=d.lastIndexOf(":");if(e>0){var c=d.substring(e+1,d.length);var a=parseInt(c);d=d.substring(0,e);e=d.lastIndexOf(":");if(e>0){var b=d.substring(e+1,d.length);a+=60*parseInt(b)}d=d.substring(0,e);if(d.length>0){a+=60*60*parseInt(d)}return a}else{return d}},_isOODebug:function(a){if(a.o_info){return a.o_info.debug}else{if(a.opener){return BPlayer._isOODebug(a.opener)}else{if(a.parent){return BPlayer._isOODebug(a.parent)}else{return false}}}}};BPlayer.debugEnabled=BPlayer._isOODebug(window); \ No newline at end of file +var BPlayer={insertPlayer:function(l,d,c,m,b,e,j,h,n,a,g,k,f){BPlayer.insertHTML5Player(l,d,c,m,b,e,j,h,n,a,g,k,f)},insertHTML5Player:function(c,g,n,m,e,a,p,t,s,k,o,l,j){var f=c;if(c.indexOf("://")<0&&(c.indexOf("/raw/static/")==0||c.indexOf("/secstatic/qtieditor/")>=0||c.indexOf("/secstatic/qti/")>=0)){f=c}else{if(c.indexOf("://")<0&&((p!="rtmp"&&p!="http")||((p=="rtmp"||p=="http")&&(t==undefined||t.length==0)))){var d=document.location.href;f=d.substring(0,d.lastIndexOf("/"));if(c.indexOf("/")!=0){f+="/"}f+=c}}var b={file:f,width:n,height:m,controlbar:{position:"bottom"}};if(typeof p!="undefined"){b.provider=p}if(p=="rtmp"||p=="http"){b.streamer=t}if(typeof e!="undefined"){var h=BPlayer._convertInSeconds(e);if(h>0){b.start=h}}if(typeof a!="undefined"){var r=BPlayer._convertInSeconds(a);if(r>0){b.duration=r}}if(typeof s!="undefined"&&s){b.autostart=true}if(typeof k!="undefined"&&k){b.repeat="single"}if(typeof o!="undefined"&&!o){b.controlbar="none"}if(typeof l!="undefined"&&l){b.image=l}if(typeof j!="undefined"){b.errorCallback=j}else{b.errorCallback=function(u,w,v){}}if(BPlayer._needJWPlayerFallback(b)){b.flashplayer=BPlayer._jwPlayerBaseUrl()+"movieViewer.swf";var q=function(){jwplayer(g).setup(b)};BPlayer._loadJWPlayer(q)}else{if(p=="nanoo"||f.indexOf("nanoo.tv/")>=0){BPlayer._loadNanooTv(g,b)}else{var q=function(){BPlayer._insertHTML5MediaElementPlayerWorker(g,b)};BPlayer.loadMediaelementJsPlayer(q)}}},loadMediaelementJsPlayer:function(d){var a=BPlayer._mediaElementBaseUrl();var c=a+(BPlayer.debugEnabled?"mediaelementplayer.css":"mediaelementplayer.min.css");var b=a+(BPlayer.debugEnabled?"mediaelement-and-player.js":"mediaelement-and-player.min.js");if(jQuery("#mediaelementplayercss").length==0){jQuery("<link>").appendTo("head").attr({id:"mediaelementplayercss",type:"text/css",rel:"stylesheet"}).attr("href",c)}if(typeof jQuery("body").mediaelementplayer!="undefined"){if(d){d()}}else{jQuery.ajax({dataType:"script",cache:true,async:false,url:b}).done(function(){if(d){d()}})}},_loadNanooTv:function(c,b){var a=c+"_frame";for(i=jQuery("#"+a).length;i-->0;){jQuery("#"+a).remove()}if(b.image===undefined||b.image===null||b.image.length==0){BPlayer._loadNanooTvFrame(c,a,b)}else{BPlayer._loadNanooTvPoster(c,a,b)}},_loadNanooTvPoster:function(f,a,b){if(jQuery("#mediaelementplayercss").length==0){var d=BPlayer._mediaElementBaseUrl();var e=d+(BPlayer.debugEnabled?"mediaelementplayer.css":"mediaelementplayer.min.css");jQuery("<link>").appendTo("head").attr({id:"mediaelementplayercss",type:"text/css",rel:"stylesheet"}).attr("href",e)}BPlayer._loadNanooResize(f,a,b);var g="<div id='"+a+"' class='mejs__container' role='application' style='width:"+b.width+"px; height:"+b.height+"px; overflow:hidden; overflow-x:hidden; overflow-y:hidden;'><div class='mejs__layers'><div class='mejs__poster mejs__layer' style='background-image: url("+b.image+"); width: 100%; height: 100%;'><img src='"+b.image+"' width='0' height='0'></img></div><div class='mejs__overlay mejs__layer mejs__overlay-play' style='width: 100%; height: 100%; z-index:10;'><div class='mejs__overlay-button' style='z-index:10;' role='button' tabindex='0' aria-label='Play' aria-pressed='false'></div></div></div></div>";var c=jQuery("#"+f);c.append(jQuery(g));c.css("border","none");jQuery("#"+f+" div.mejs__overlay-button").on("click",function(k,j){var h={file:b.file,width:b.width,height:b.height,autostart:true};BPlayer._loadNanooTvFrame(f,a,h)})},_loadNanooTvFrame:function(h,b,d){for(i=jQuery("#"+b).length;i-->0;){jQuery("#"+b).remove()}BPlayer._loadNanooResize(h,b,d);var c=d.file;var g=c.split("?");var a=g[0].substring(c.lastIndexOf("/")+1);if(d.autostart){c="https://www.nanoo.tv/link/w/"+a}else{c="https://www.nanoo.tv/link/n/"+a}var f='<iframe name="'+b+'" id="'+b+'" src="'+c+'" style="width:'+d.width+"px; height:"+d.height+'px; overflow:hidden;" frameborder="0" allow="fullscreen" allowfullscreen="true"></iframe>';var e=jQuery("#"+h);e.append(jQuery(f));e.css("border","none")},_loadNanooResize:function(f,h,d){try{var m=jQuery("#"+f);var a=m.parent("p , div");if(a.length==1&&typeof d.width!=="undefined"&&typeof d.height!=="undefined"){var n=jQuery(a).width();var c=d.width;var g=d.height;if(n&&n<c){var l=g/c;var j=n;var b=((n*l)|0);d.width=j;d.height=b}jQuery(window).resize(function(){var e=jQuery("#"+f).parent("p , div");var p=jQuery(e).width();if(p&&p<c){var q=g/c;var o=p;var r=((p*q)|0);jQuery("#"+h).width(o+"px").height(r+"px")}}).trigger("resize")}}catch(k){if(window.console){console.log(k)}}},_loadJWPlayer:function(a){if(BPlayer._isIE8()&&domId!="prev_container"&&jQuery("#"+domId).is("span")){alert("This is video is not supported on Internet Explorer 8. Sorry for the inconvenience")}else{jQuery.getScript(BPlayer._jwPlayerBaseUrl()+"player.jw.js",function(){if(a){a()}})}},_needJWPlayerFallback:function(a){if(a.provider=="rtmp"){if(a.file.match(/(.*)\/((flv|mp4|mp3):.*)/)){return false}else{return true}}return false},_insertHTML5MediaElementPlayerWorker:function(e,d){var k=BPlayer._mediaElementBaseUrl();var l={loop:d.repeat,pluginPath:k,stretching:"responsive",hls:{path:k+"hls/hls.min.js"},flv:{path:k+"flv/flv.min.js",withCredentials:true},error:d.errorCallback,success:function(o,q,p){if(d.start){p.load();o.addEventListener("canplay",function(){try{o.removeEventListener("canplay");p.setCurrentTime(d.start);p.play();if(!d.autostart){setTimeout(function(){p.pause()},100)}}catch(s){if(window.console){console.log(s)}}})}else{if(d.autostart){try{p.load();p.play()}catch(r){if(window.console){console.log(r)}}}}}};var a=null;var n=d.file.split(".").pop().toLowerCase().split("&").shift();if(d.provider=="sound"){if(n=="mp3"){a="audio/mp3"}else{if(n=="aac"){a="audio/aac"}else{if(n=="m4a"){a="audio/mp4"}}}}else{if(d.provider=="youtube"){a="video/youtube"}else{if(d.provider=="vimeo"){a="video/vimeo"}else{if(d.provider=="rtmp"){l.flashStreamer=d.streamer;a="video/rtmp"}else{if(d.provider=="http"){d.enablePseudoStreaming=true;if(n=="flv"){a="video/flv";l.renderers=["flash_video","native_flv"]}else{a="video/mp4"}}else{if(n=="flv"){a="video/flv";l.renderers=["flash_video","native_flv"]}else{if(n=="f4v"){a="video/flv"}else{if(n=="mp4"){a="video/mp4"}else{if(n=="m4v"){a="video/mp4"}else{if(n=="m3u8"){a="application/x-mpegURL"}else{if(n=="aac"){a="audio/mp4";d.provider="sound"}else{if(n=="mp3"){a="audio/mp3";d.provider="sound"}else{if(n=="m4a"){a="audio/mp4";d.provider="sound"}else{if(d.file.indexOf("vimeo.com")>-1){a="video/vimeo"}else{if(d.file.indexOf("youtube.com")>-1||d.file.indexOf("youtu.be")>-1||d.file.indexOf("youtube.be")>-1){a="video/youtube"}else{if(n.indexOf("mp4?")==0){a="video/mp4"}else{if(d.file.indexOf("openmeetings/recording")>0){a="video/mp4"}else{if(n.indexOf("webm")==0){a="video/webm"}else{alert("Something go badly wrong!"+d.provider+" "+n)}}}}}}}}}}}}}}}}}}var j;var c=e+"_oo"+Math.floor(Math.random()*1000000)+"vid";var f=e+"_oo"+Math.floor(Math.random()*1000000)+"obj";if(d.provider=="sound"){if(d.height){l.audioHeight=d.height}if(d.width){l.audioWidth=d.width}j="<audio id='"+c+"' controls='controls' oncontextmenu='return false;'";if(typeof d.repeat!="undefined"&&d.repeat){j+=" loop='loop'"}var b="<object id='"+f+"' type='application/x-shockwave-flash'";if(typeof d.height!="undefined"){j+=" height='"+d.height+"'";b+=" height='"+d.height+"'";l.videoHeight=d.height}if(typeof d.width!="undefined"){j+=" width='"+d.width+"'";b+=" width='"+d.width+"'";l.videoWidth=d.width}if(typeof d.image!="undefined"){j+=" poster='"+d.image+"'"}j+="><source type='"+a+"' src='"+d.file+"'>";var g="mediaelement-flash-video.swf";if(a=="audio/mp3"){g="mediaelement-flash-audio.swf"}else{if(a=="audio/ogg"){g="mediaelement-flash-audio-ogg.swf"}}j+=b+" data='"+k+g+"'>";j+="<param name='movie' value='"+k+g+"' />";j+="<param name='flashvars' value='controls=true&";if(typeof d.streamer!="undefined"){j+="&streamer="+d.streamer}j+="&file="+d.file+"' /></object>";j+="</audio>"}else{j="<video id='"+c+"' controls='controls' preload='none' oncontextmenu='return false;'";if(typeof d.repeat!="undefined"&&d.repeat){j+=" loop='loop'"}var b="<object id='"+f+"' type='application/x-shockwave-flash'";if(typeof d.height!="undefined"){l.videoHeight=d.height}if(typeof d.width!="undefined"){l.videoWidth=d.width}if(typeof d.image!="undefined"){j+=" poster='"+d.image+"'"}j+="><source type='"+a+"' src='"+d.file+"' />";j+=b+" data='"+k+"mediaelement-flash-video.swf'>";j+="<param name='movie' value='"+k+"mediaelement-flash-video.swf' />";j+="<param name='flashvars' value='controls=true";if(typeof d.streamer!="undefined"){j+="&streamer="+d.streamer}j+="&file="+d.file+"' /></object></video>"}var h=jQuery("#"+e);h.css({height:""});h.css({border:"none"});if(jQuery(window).width()<=d.width){h.css({width:""})}h.html(j);if(a=="video/vimeo"){var k=BPlayer._mediaElementBaseUrl();var m=k+(BPlayer.debugEnabled?"renderers/vimeo.js":"renderers/vimeo.min.js");jQuery.ajax({dataType:"script",cache:true,async:false,url:m}).done(function(){jQuery("#"+c).mediaelementplayer(l)})}else{jQuery("#"+c).mediaelementplayer(l)}},_mediaElementBaseUrl:function(){var a=BPlayer._findBaseUrl(window);if(a==null){a="/olat/raw/_noversion_/"}a+="movie/mediaelementjs/";return a},_isIE8:function(){return(jQuery.support.opacity==false)},_jwPlayerBaseUrl:function(){var a=BPlayer._findBaseUrl(window);if(a==null){a="/olat/raw/_noversion_/"}a+="movie/jw/";return a},_findBaseUrl:function(a){if(a.o_info){return a.o_info.o_baseURI}else{if(a.opener){return BPlayer._findBaseUrl(a.opener)}else{if(a.parent){return BPlayer._findBaseUrl(a.parent)}else{return null}}}},_convertInSeconds:function(d){if(typeof d=="undefined"||d==null){return 0}if(!d.length){return d}if(d.length==0){return 0}if(d.indexOf(".")>0){d=d.substring(0,d.indexOf("."))}var e=d.lastIndexOf(":");if(e>0){var c=d.substring(e+1,d.length);var a=parseInt(c);d=d.substring(0,e);e=d.lastIndexOf(":");if(e>0){var b=d.substring(e+1,d.length);a+=60*parseInt(b)}d=d.substring(0,e);if(d.length>0){a+=60*60*parseInt(d)}return a}else{return d}},_isOODebug:function(a){if(a.o_info){return a.o_info.debug}else{if(a.opener){return BPlayer._isOODebug(a.opener)}else{if(a.parent){return BPlayer._isOODebug(a.parent)}else{return false}}}}};BPlayer.debugEnabled=BPlayer._isOODebug(window); \ No newline at end of file