Commit b7443022 authored by Juergen Enge's avatar Juergen Enge
Browse files

a/v player integrated

parent a32b62f2
Pipeline #16008 passed with stages
in 3 minutes and 38 seconds
......@@ -2,3 +2,5 @@
bin/
*.jp2
*.toml
01 Captain Future.mp3
poster.png
......@@ -126,6 +126,7 @@ func main() {
// add some helpful actions
srv.AddAction(memostream.NewActionImageIIIF(srv))
srv.AddAction(memostream.NewActionVideo(srv))
srv.AddAction(memostream.NewActionAudio(srv))
srv.AddAction(memostream.NewActionMaster(srv))
go func() {
......
......@@ -4,7 +4,7 @@ accesslog = "" # http access log file
addr = "localhost:88"
certpem = "" # tls client certificate file in PEM format
keypem = "" # tls client key file in PEM format
staticdir = "C:/daten/go/dev/memobase/streaming-server/web/static/"
staticdir = "C:/daten/go/src/gitlab.switch.ch/memoriav/memobase-2020/services/streaming-server/web/static/"
staticprefix = "/static/"
urlprefix = "/memo/" # prefix for accessing signature based content
# http://localhost:81/command/clearcache?auth=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJjbWQ6Y2xlYXJjYWNoZSIsImV4cCI6MTgxNjIzOTAyMn0.M_Y6R4yMAFEyo534-SXAffPwdHv929WcuSgQUcjiz10
......@@ -13,8 +13,8 @@ jwtkey = "swordfish"
jwtalg = ["HS256", "HS384", "HS512"] # "hs256" "hs384" "hs512" "es256" "es384" "es512" "ps256" "ps384" "ps512"
resolverCacheSize = 1000
errorTemplate = "C:/daten/go/src/gitlab.switch.ch/memoriav/memobase-2020/services/streaming-server/web/template/error.gohtml" # error message for memoHandler
videoviewertemplate = "C:/daten/go/src/gitlab.switch.ch/memoriav/memobase-2020/services/streaming-server/web/template/videojs.gohtml"
audioviewertemplate = "C:/daten/go/src/gitlab.switch.ch/memoriav/memobase-2020/services/streaming-server/web/template/audiohowler.gohtml"
videoviewertemplate = "C:/daten/go/src/gitlab.switch.ch/memoriav/memobase-2020/services/streaming-server/web/template/video.gohtml"
audioviewertemplate = "C:/daten/go/src/gitlab.switch.ch/memoriav/memobase-2020/services/streaming-server/web/template/audio.gohtml"
baseurl = "http://localhost:88"
[[filemap]]
......@@ -34,53 +34,16 @@ folder = "C:/daten/go/src/gitlab.switch.ch/memoriav/memobase-2020/services/strea
base = "C:/daten/go/src/gitlab.switch.ch/memoriav/memobase-2020/services/streaming-server/web/static/"
url = "http://localhost:8182/iiif/2/"
jwtsubprefix = "iiif:"
viewertemplate = "C:/daten/go/dev/memobase/streaming-server/web/template/openseadragon.gohtml"
viewertemplate = "C:/daten/go/src/gitlab.switch.ch/memoriav/memobase-2020/services/streaming-server/web/template/openseadragon.gohtml"
[resolverDBMySQL]
#if dsn is empty, the static resolver will be used
#[username[:password]@][protocol[(address)]]/dbname[?param1=value1&...&paramN=valueN]
#dsn = "test:HDNQiaqNqu4IjmUPATJr@tcp(localhost:3306)/test"
dsn = "urlchecker:siex5ieNguuQuei@tcp(localhost:4306)/medienserver"
dsn = "test:HDNQiaqNqu4IjmUPATJr@tcp(localhost:3306)/test"
#dsn = "urlchecker:siex5ieNguuQuei@tcp(localhost:4306)/medienserver"
# should be smaller than server connection timeout to allow controlled reconnect
connMaxTimeout = "4h"
# query has to return the fields uri, access and protocol. One parameter
#query = "SELECT uri, access, proto AS protocol, `status` FROM mediaserver.entities WHERE sig = ?"
query = "SELECT `uri`, `access`, `proto` AS protocol, `status`, `type`, `mimetype`, `width`, `height`, `duration` FROM entities_metadata WHERE sig = ?"
schema = "test"
[signatures]
[signatures.sig-01]
type = "file"
uri = "file:///C:/daten/Persoenlich/bilder/MobilePhotos/16-09-03 13-41-58 0634.mp4"
access = "public"
# http://localhost:81/memo/sig-01
[signatures.sig-02]
type = "redirect"
uri = "https://ba14ns21403.fhnw.ch/video/open/performance/2002_B_B_Yours_Sincerly.mov.mp4"
access = "public"
# http://localhost:81/memo/sig-02
[signatures.sig-03]
type = "file"
uri = "file:///C:/daten/Persoenlich/bilder/MobilePhotos/16-09-03 13-41-58 0634.mp4"
access = "closed"
# http://localhost:81/memo/sig-03?auth=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJzaWctMDMiLCJleHAiOjE4MTYyMzkwMjJ9.bHrv5_5-dtI9EvxeoxZTw2DWi7HKNpFZ-S8Vb_F2Ps4
[signatures.sig-04]
type = "proxy"
uri = "https://ba14ns21403.fhnw.ch/video/open/performance/2002_B_B_Yours_Sincerly.mov.mp4"
access = "public"
# http://localhost:81/memo/sig-04
[signatures.sig-05]
type = "file"
uri = "file:///C:/Users/juergen.enge/Downloads/cantaloupe-4.1.5/data/milkyway.jpg"
access = "public"
# http://localhost:81/memo/sig-05/iiif/view
[signatures.sig-06]
type = "file"
uri = "file:///C:/Users/juergen.enge/Downloads/cantaloupe-4.1.5/data/milkyway.jpg"
access = "closed"
# http://localhost:81/memo/sig-06/iiif/view?auth=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJzaWctMDYiLCJleHAiOjE4MTYyMzkwMjJ9.jBTTT5cGKXoP7zJO1CXviAxJm2j49fxfZHH7BEi9lzI
......@@ -16,7 +16,7 @@ func NewActionAudio(ms *memoServer) *ActionAudio {
return aa
}
func (aa *ActionAudio) GetType() []string { return []string{"video"} }
func (aa *ActionAudio) GetType() []string { return []string{"audio"} }
func (aa *ActionAudio) Do(w http.ResponseWriter, req *http.Request, me *MediaEntry, action string, params ...string) (bool, error) {
switch action {
......@@ -30,9 +30,18 @@ func (aa *ActionAudio) Do(w http.ResponseWriter, req *http.Request, me *MediaEnt
func (aa *ActionAudio) viewer(w http.ResponseWriter, req *http.Request, me *MediaEntry, action string, params ...string) (bool, error) {
type vData struct {
AudioSource string
AudioTitle string
PosterSource string
AudioType string
BackgroundColor string
BaseUrl string
StaticPrefix string
}
scheme := "http"
if req.TLS != nil {
scheme = "https"
}
var err error
newtoken := ""
if me.Access != Media_Public {
......@@ -42,10 +51,25 @@ func (aa *ActionAudio) viewer(w http.ResponseWriter, req *http.Request, me *Medi
}
}
scheme := "http"
if req.TLS != nil {
scheme = "https"
posterurl := ""
poster, err := aa.ms.resolver.resolve(me.Signature + "-poster")
if err == nil {
posterurl = fmt.Sprintf("%s://%s/%s/%s/resize/size%vx%v/formatJPEG",
scheme,
req.Host,
strings.Trim(aa.ms.urlPrefix, "/"),
poster.Signature,
poster.Width,
poster.Height)
if poster.Access != Media_Public {
postertoken, err := NewJWT(aa.ms.jwtSecret, poster.Signature, aa.ms.jwtAlg[0], 7200, "", "")
if err != nil {
return false, fmt.Errorf("Cannot create token: %v", err)
}
posterurl += fmt.Sprintf("?auth=%v", postertoken)
}
}
data := vData{
AudioSource: fmt.Sprintf("%s://%s/%s/%s?auth=%s",
scheme,
......@@ -53,8 +77,10 @@ func (aa *ActionAudio) viewer(w http.ResponseWriter, req *http.Request, me *Medi
strings.Trim(aa.ms.urlPrefix, "/"),
me.Signature,
newtoken),
AudioTitle: "Audio",
AudioType: me.Mimetype,
BackgroundColor: "#000000",
BaseUrl: aa.ms.baseUrl,
StaticPrefix: aa.ms.staticPrefix,
}
aa.ms.audioViewerTemplate.Execute(w, data)
return true, nil
......
......@@ -33,6 +33,8 @@ func (av *ActionVideo) viewer(w http.ResponseWriter, req *http.Request, me *Medi
VideoSource string
PosterSource string
VideoType string
BaseUrl string
StaticPrefix string
}
scheme := "http"
......@@ -56,8 +58,8 @@ func (av *ActionVideo) viewer(w http.ResponseWriter, req *http.Request, me *Medi
req.Host,
strings.Trim(av.ms.urlPrefix, "/"),
poster.Signature,
poster.Width,
poster.Height)
me.Width,
me.Height)
if poster.Access != Media_Public {
postertoken, err := NewJWT(av.ms.jwtSecret, poster.Signature, av.ms.jwtAlg[0], 7200, "", "")
if err != nil {
......@@ -76,7 +78,9 @@ func (av *ActionVideo) viewer(w http.ResponseWriter, req *http.Request, me *Medi
me.Signature,
newtoken),
PosterSource: posterurl,
VideoType: "video/mp4",
VideoType: me.Mimetype,
BaseUrl: av.ms.baseUrl,
StaticPrefix: av.ms.staticPrefix,
}
av.ms.videoViewerTemplate.Execute(w, data)
return true, nil
......
This diff is collapsed.
body {
margin: 0;
}
.container {
max-width: 1100px;
}
.container--audio {
padding-top: 20px;
}
.plyr--full-ui input[type=range] {
color: #d22d40;
}
.plyr__control--overlaid {
background: rgba(210, 45, 64, .8);
}
.plyr--video .plyr__control.plyr__tab-focus,
.plyr--video .plyr__control:hover,
.plyr--video .plyr__control[aria-expanded=true] {
background: #d22d40;
}
.plyr__control.plyr__tab-focus {
box-shadow: 0 0 0 5px rgba(210, 45, 64, .5);
}
.plyr__menu__container .plyr__control[role=menuitemradio][aria-checked=true]::before {
background: #d22d40;
}
.plyr--audio .plyr__control.plyr__tab-focus,
.plyr--audio .plyr__control:hover,
.plyr--audio .plyr__control[aria-expanded=true] {
background: #d22d40;
}
/*SRG Player*/
.player--srg {
width: 100%;
position: absolute;
top: 0;
left: 0;
height: 100%;
overflow: hidden;
}
This diff is collapsed.
$(document).ready(function () {
$('.player').each(function () {
let playerSrg = SRG.PlayerManager.createPlayer('srg-player','embed',$(this).attr('data-urn-src'));
});
});
$(document).ready(function () {
//Audio, Videos (Youtube, Vimeo, Local)
$('.player').each(function () {
let controls = [
'play-large', // The large play button in the center
'play', // Play/pause playback
'progress', // The progress bar and scrubber for playback and buffering
'current-time', // The current time of playback
'duration', // The full duration of the media
'mute', // Toggle mute
'volume', // Volume control
'fullscreen', // Toggle fullscreen
];
const player = new Plyr($(this), {controls});
player.on('loadeddata', function () {
let url_string = window.location.href;
let url = new URL(url_string);
let time = parseInt(url.searchParams.get("time"));
if (time <= player.duration) {
player.currentTime = time;
}
});
});
});
This diff is collapsed.
!function(e,t,n){e.Utils={getCurrentScript:function(){if(document.currentScript)return document.currentScript;var e=document.getElementsByName("script");return e[e.length-1]},uuid:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0,n="x"===e?t:3&t|8;return n.toString(16)})},addEvent:function(e,t,n){t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent&&t.attachEvent("on"+e,n)},removeEvent:function(e,t,n){t.removeEventListener?t.removeEventListener(e,n,!1):t.detachEvent&&t.detachEvent("on"+e,n)},extend:function(e){var t=Array.prototype.slice.call(arguments,1),n,i;for(n=0;n<t.length;n++){var r=t[n];for(i in r)r.hasOwnProperty(i)&&(e[i]=r[i])}return e},addUrlParam:function(e,t,n){return e+(~e.indexOf("?")?"&":"?")+t+(n||"number"==typeof n?"="+encodeURIComponent(n.toString()):"")},hasFlash:function(){var e;if(navigator.mimeTypes&&navigator.mimeTypes.length&&navigator.mimeTypes["application/x-shockwave-flash"])return e=navigator.mimeTypes["application/x-shockwave-flash"],!!e.enabledPlugin;if(navigator.plugins&&navigator.plugins.length&&navigator.plugins["Shockwave Flash"])return e=navigator.plugins["Shockwave Flash"][0],!!e.enabledPlugin;try{return new ActiveXObject("ShockwaveFlash.ShockwaveFlash"),!0}catch(t){}return!1},getHTMLlElement:function(e){return"string"==typeof e?e=document.getElementById(e):e.constructor.prototype.jquery&&(e=e[0]),e},serialize:function(e,t){var n=[];for(var i in e)if(e.hasOwnProperty(i)){var r=t?t+"."+i:i,a=e[i];n.push("object"==typeof a?this.serialize(a,r):encodeURIComponent(r)+"="+encodeURIComponent(a))}return n.join("&")},abbreviate:function(e,t){return(e||"").length<=t?e:e.substr(0,t-3)+"..."},sprintf:function(){var e=/%%|%(\d+\$)?([-+\'#0 ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([scboxXuideEfFgG])/g,t=arguments,i=0,r=t[i++],a=function(e,t,n,i){n||(n=" ");var r=e.length>=t?"":new Array(1+t-e.length>>>0).join(n);return i?e+r:r+e},o=function(e,t,n,i,r,o){var s=i-e.length;return s>0&&(e=n||!r?a(e,i,o,n):e.slice(0,t.length)+a("",s,"0",!0)+e.slice(t.length)),e},s=function(e,t,n,i,r,s,l){var c=e>>>0;return n=n&&c&&{2:"0b",8:"0",16:"0x"}[t]||"",e=n+a(c.toString(t),s||0,"0",!1),o(e,n,i,r,l)},l=function(e,t,n,i,r,a){return i&&(e=e.slice(0,i)),o(e,"",t,n,r,a)},c=function(e,r,c,h,d,u,p){var f,v,g,E,m;if("%%"===e)return"%";for(var _=!1,y="",b=!1,S=!1,k=" ",L=c.length,R=0;c&&L>R;R++)switch(c.charAt(R)){case" ":y=" ";break;case"+":y="+";break;case"-":_=!0;break;case"'":k=c.charAt(R+1);break;case"0":b=!0,k="0";break;case"#":S=!0}if(h=h?"*"===h?+t[i++]:"*"===h.charAt(0)?+t[h.slice(1,-1)]:+h:0,0>h&&(h=-h,_=!0),!isFinite(h))throw new Error("sprintf: (minimum-)width must be finite");switch(u=u?"*"===u?+t[i++]:"*"===u.charAt(0)?+t[u.slice(1,-1)]:+u:"fFeE".indexOf(p)>-1?6:"d"===p?0:n,m=r?t[r.slice(0,-1)]:t[i++],p){case"s":return l(String(m),_,h,u,b,k);case"c":return l(String.fromCharCode(+m),_,h,u,b);case"b":return s(m,2,S,_,h,u,b);case"o":return s(m,8,S,_,h,u,b);case"x":return s(m,16,S,_,h,u,b);case"X":return s(m,16,S,_,h,u,b).toUpperCase();case"u":return s(m,10,S,_,h,u,b);case"i":case"d":return f=+m||0,f=Math.round(f-f%1),v=0>f?"-":y,m=v+a(String(Math.abs(f)),u,"0",!1),o(m,v,_,h,b);case"e":case"E":case"f":case"F":case"g":case"G":return f=+m,v=0>f?"-":y,g=["toExponential","toFixed","toPrecision"]["efg".indexOf(p.toLowerCase())],E=["toString","toUpperCase"]["eEfFgG".indexOf(p)%2],m=v+Math.abs(f)[g](u),o(m,v,_,h,b)[E]();default:return e}};return r.replace(e,c)}},"function"!=typeof Object.create&&!function(){var e=function(){};Object.create=function(t){if(arguments.length>1)throw Error("Second argument not supported");if(null===t)throw Error("Cannot set a null [[Prototype]]");if("object"!=typeof t)throw new TypeError("Argument must be an object");return e.prototype=t,new e}}(),e.SrgPlayerEvent=function(e){this.type=e},e.SrgPlayerEvent.prototype={type:null,target:null,data:null,_propagationStopped:!1,constructor:e.SrgPlayerEvent,stopPropagation:function(){this._propagationStopped=!0},isPropagationStopped:function(){return this._propagationStopped}},e.Utils.extend(e.SrgPlayerEvent,{EVT_READY:"ready",EVT_LOADING:"loading",EVT_LOADED:"loaded",EVT_MEDIA_SEEKABLE:"media_seekable",EVT_SEEKING_CHANGE:"seeking_change",EVT_PLAYING:"playing",EVT_PAUSED:"paused",EVT_STOPPED:"stopped",EVT_ENDED:"ended",EVT_TIME_UPDATE:"time_update",EVT_HAS_SEGMENTS:"has_segments",EVT_TIMESHIFT_CHANGED:"timeshift_changed",EVT_SEGMENT_CHANGE:"segment_change",EVT_POPOUT:"popout",EVT_ERROR:"error",EVT_EXIT_FULLSCREEN:"exit_fullscreen",EVT_ORIENTATION_CHANGED:"orientationchange"}),e.EventDispatcher=function(e){this._globalDispatcher=e,this._listeners={}},e.EventDispatcher.prototype={constructor:e.EventDispatcher,addEventListener:function(e,t){return"undefined"==typeof this._listeners[e]&&(this._listeners[e]=[]),this._listeners[e].push(t),t},dispatchEvent:function(t,i){if("string"==typeof t&&(t=new e.SrgPlayerEvent(t)),!(t instanceof e.SrgPlayerEvent))throw new Error("SrgPlayerEvent object must be an instance of SRG.SrgPlayerEvent");if(t.target||(t.target=this),i!==n&&(t.data=i),this.hasEventListener(t.type))for(var r=this._listeners[t.type].slice(0),a=0;a<r.length&&(r[a].call(this,t),!t.isPropagationStopped());a++);return this._globalDispatcher&&this._globalDispatcher.dispatchEvent(t),t},hasEventListener:function(e){return this._listeners[e]instanceof Array},removeEventListener:function(e,t){if(this.hasEventListener(e)){var n,i=this._listeners[e];for(n=0;n<i.length;n++)i[n]===t&&i.splice(n,1)}},removeEventListeners:function(e){if(e)delete this._listeners[e];else for(var t=Object.keys(this._listeners),n=0;n<t.length;n++)delete this._listeners[t[n]]}},e.URN=function(e){var t=/^urn:(srf|rts|rsi|rtr|swi):(?:[^:]+:)?(video|audio):([^:]+)$/.exec(e);if(/^.+(?=swisstxt).+(?=clip).+$/.test(e)){var n=e.split(":");n&&(this._urn=e,this._assetType=n[2],this._bu=n[4],this._id=n[5])}else if(t)this._urn=t[0],this._bu=t[1],this._assetType=t[2],this._id=t[3];else{if(t=/^urn:swisstxt:(?:[^:]+:)?(video|audio):(srf|rts|rsi|rtr|swi):([^:]+)$/.exec(e),!t)throw new Error("Invalid URN format");this._urn=t[0],this._assetType=t[1],this._bu=t[2],this._id=t[3]}},e.URN.prototype={_urn:null,_bu:null,_assetType:null,_id:null,constructor:e.URN,getBu:function(){return this._bu},getAssetType:function(){return this._assetType},getId:function(){return this._id},toString:function(){return this._urn},toShort:function(){return this._urn},toJsonValue:function(){return this._urn}},e.constants={NS:"srg.player"}}(window.SRG=window.SRG||{},window),function(e,t,n){var i=document.getElementsByTagName("script"),r=t.location.hostname,a="tp.srgssr.ch";-1!==r.indexOf("rts.ch")?a="player.rts.ch":-1!==r.indexOf("srf.ch")&&(a="player.srf.ch");for(var o=0;o<i.length;o++){var s=/(?:\/\/)(.*)(?:\.tp\.srgssr\.ch\/assets\/javascripts\/player\-api)/g,l=s.exec(i[o].src);l&&l.length>1&&(a=l[1]+".tp.srgssr.ch")}var c=new e.EventDispatcher,h=function(t){this._iframe=t,e.EventDispatcher.call(this,c),this._init()};h.prototype=Object.create(e.EventDispatcher.prototype),e.Utils.extend(h.prototype,{_apiCallbacks:{},_isBridgeReady:!1,_isReady:!1,_isLoaded:!1,_isSeekable:!1,_init:function(){this.addEventListener(e.SrgPlayerEvent.EVT_LOADED,function(){this._isLoaded=!0}.bind(this)),this.addEventListener(e.SrgPlayerEvent.EVT_MEDIA_SEEKABLE,function(){this._isSeekable=!0}.bind(this)),this.addEventListener(e.SrgPlayerEvent.EVT_LOADING,function(){this._isLoaded=!1,this._isSeekable=!1}.bind(this));var t=setInterval(function(){this.isBridgeReady()||!this._iframe.parentNode?clearInterval(t):this._invokeRemoteMethod("bridge.init")}.bind(this),500)},_handleRemoteInvocation:function(t,n){switch(t){case"api.result":this._handleApiResult(n.method,n.result);break;case"360.status":this._handle360Status(n.result);break;case"cookie":this._getCookie(n);break;case"localstorage":this._getLocalstorageItemValue(n);break;case"bridge.ready":this._isBridgeReady=!0;var i=setInterval(function(){this.isLoaded()?clearInterval(i):this._invokeRemoteMethod("player.isLoaded",function(t){!this.isLoaded()&&t&&this._invokeRemoteMethod("player.getMetadata",function(t){this.dispatchEvent(e.SrgPlayerEvent.EVT_LOADED,t)}.bind(this))}.bind(this))}.bind(this),300),r=setInterval(function(){this.isLoaded()?clearInterval(r):this._invokeRemoteMethod("player.isSeekable",function(t){!this.isSeekable()&&t&&this.dispatchEvent(e.SrgPlayerEvent.EVT_MEDIA_SEEKABLE)}.bind(this))}.bind(this),300);break;case e.SrgPlayerEvent.EVT_READY:this._isReady||(this._isReady=!0,this.dispatchEvent(t,n),this.focus());break;default:this.dispatchEvent(t,n)}},_invokeRemoteMethod:function(t,i){var r=e.constants.NS+"."+t;if(i!==n){if(i=Array.prototype.slice.call(arguments,1),"function"==typeof i[0]){if(t in this._apiCallbacks)return void this._apiCallbacks[t].push(i.shift());this._apiCallbacks[t]=[i.shift()]}r+=":"+JSON.stringify(i)}this._iframe.contentWindow&&this._iframe.contentWindow.postMessage(r,"*")},_handleApiResult:function(e,t){if(e in this._apiCallbacks){var n=this._apiCallbacks[e];delete this._apiCallbacks[e];for(var i=0;i<n.length;i++)n[i](t)}else console.warn("No callback found for api result: "+e)},_deviceMotionHandler:function(e){if("undefined"!=typeof e.rotationRate)try{var n={rotationRate:{alpha:e.rotationRate.alpha,beta:e.rotationRate.beta,gamma:e.rotationRate.gamma},portrait:t.matchMedia("(orientation: portrait)").matches,landscape:t.matchMedia("(orientation: landscape)").matches,orientation:t.orientation};this._invokeRemoteMethod("devicemotionIframe",n)}catch(i){console.warn("ERROR _deviceMotionHandler -->",i)}},_handle360Status:function(n){n?e.Utils.addEvent("devicemotion",t,this._deviceMotionHandler.bind(this)):e.Utils.removeEvent("devicemotion",t,this._deviceMotionHandler.bind(this))},_getCookie:function(e){for(var t=e+"=",n=decodeURIComponent(document.cookie),i=n.split(";"),r=0;r<i.length;r++){for(var a=i[r];" "===a.charAt(0);)a=a.substring(1);if(0===a.indexOf(t)){this._invokeRemoteMethod("setCookie",{cookieLabel:e,cookieValue:a.substring(t.length,a.length)});break}}},_getLocalstorageItemValue:function(e){var t="-1";"undefined"!=typeof localStorage&&(t=null===localStorage.getItem(e)?"-1":localStorage.getItem(e)),this._invokeRemoteMethod("setLocalstorageValue",{itemLabel:e,itemValue:t})},getIframe:function(){return this._iframe},isBridgeReady:function(){return this._isBridgeReady},isReady:function(){return this._isReady},isLoaded:function(){return this._isLoaded},isSeekable:function(){return this._isSeekable},load:function(e,t,i){t=t!==n?t:!0,this._invokeRemoteMethod("player.load",e,n,t,i)},play:function(){this.isSeekable()?this._invokeRemoteMethod("player.play"):this.addEventListener(e.SrgPlayerEvent.EVT_MEDIA_SEEKABLE,function(e){e.target.removeEventListener(e.type,arguments.callee),this._invokeRemoteMethod("player.play")}.bind(this))},stop:function(){this._invokeRemoteMethod("player.stop")},pause:function(){this._invokeRemoteMethod("player.pause")},mute:function(e){this._invokeRemoteMethod("player.mute",e)},seek:function(e){this._invokeRemoteMethod("player.seek",e)},seekToAbsoluteTime:function(e,t){this._invokeRemoteMethod("player.seekToAbsoluteTime",e,t)},volume:function(e){this._invokeRemoteMethod("player.volume",e)},volumeUp:function(){this._invokeRemoteMethod("player.volumeUp")},volumeDown:function(){this._invokeRemoteMethod("player.volumeDown")},getUrn:function(t){this.isLoaded()?this._invokeRemoteMethod("player.getUrn",t):this.addEventListener(e.SrgPlayerEvent.EVT_LOADED,function(e){e.target.removeEventListener(e.type,arguments.callee),t(e.data.urn)})},getCurrentTime:function(e){this.isLoaded()?this._invokeRemoteMethod("player.getCurrentTime",e):e(0)},getVolume:function(e){this.isLoaded()?this._invokeRemoteMethod("player.getVolume",e):e(0)},getMetadata:function(t){this.isLoaded()?this._invokeRemoteMethod("player.getMetadata",t):this.addEventListener(e.SrgPlayerEvent.EVT_LOADED,function(e){e.target.removeEventListener(e.type,arguments.callee),t(e.data)})},hasSegments:function(t){this.isLoaded()?this._invokeRemoteMethod("player.hasSegments",t):this.addEventListener(e.SrgPlayerEvent.EVT_LOADED,function(){this._invokeRemoteMethod("player.hasSegments",t)}.bind(this))},isCurrentlyLive:function(t){this.isLoaded()?this._invokeRemoteMethod("player.isCurrentlyLive",t):this.addEventListener(e.SrgPlayerEvent.EVT_LOADED,function(){this._invokeRemoteMethod("player.isCurrentlyLive",t)}.bind(this))},focus:function(){this._invokeRemoteMethod("player.focus")},setSocialDataPayload:function(e){this._invokeRemoteMethod("player.setSocialDataPayload",e)},destroy:function(){this._apiCallbacks={},this._isBridgeReady=!1,this._isReady=!1,this._isLoaded=!1,this._isSeekable=!1,this.removeEventListeners(),this._iframe.parentNode.removeChild(this._iframe)}}),e.PlayerManager={getPlayer:function(t){if(t=e.Utils.getHTMLlElement(t),!(t&&t instanceof HTMLIFrameElement))throw new Error("Invalid parameter 'iframe'");return t.srgPlayerInstance||(t.srgPlayerInstance=new h(t)),t.srgPlayerInstance},createPlayer:function(t,n,i,r,o){if(t=e.Utils.getHTMLlElement(t),!t)throw new Error("Invalid parameter 'wrapper'");var s=t.getElementsByTagName("iframe");if(s.length&&-1!==s[0].src.indexOf("//"+a+"/p/")){var l=this.getPlayer(s[0]);return l.load(i,r),l}var c=new e.URN(i),h="/p/:bu/:mode?urn=:urn".replace(":mode",n).replace(":bu",c.getBu()).replace(":urn",c.toString());h+=(r?"&autoplay":"")+(o?"&"+o:"");var d=document.createElement("iframe");return d.referrerPolicy="no-referrer-when-downgrade",d.setAttribute("allowFullScreen",""),d.setAttribute("allow","geolocation *; autoplay; encrypted-media"),d.width=d.height="100%",d.frameBorder=0,d.src="//"+a+h,t.innerHTML="",t.appendChild(d),this.getPlayer(d)},addGlobalEventListener:function(e,t){c.addEventListener(e,t)},hasGlobalEventListener:function(e){return c.hasEventListener(e)},removeGlobalEventListener:function(e,t){c.removeEventListener(e,t)},removeGlobalEventListeners:function(e){c.removeEventListeners(e)}};var d={};e.Utils.addEvent("message",t,function(t){var n=/^srg\.player\.([^:]+):([^:]+):?(.*)/.exec(t.data);if(n){var i=n[1],r=n[2],a=n[3]||null;if(a)try{a=JSON.parse(a)}catch(o){}var s=d[r]||document.querySelector("iframe[srg-player-id='"+r+"']");if(!s&&"bridge.ready"===i)for(var l=document.querySelectorAll("iframe:not([srg-player-id])"),c=0;c<l.length;c++)if(decodeURIComponent(l[c].src)===a.src){s=l[c],s.setAttribute("srg-player-id",r),d[r]=s;break}s&&e.PlayerManager.getPlayer(s)._handleRemoteInvocation(i,a)}})}(window.SRG=window.SRG||{},window);
//# sourceMappingURL=player-api.min.js.map
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Media Player</title>
<link rel="stylesheet" type="text/css" href="{{.BaseUrl}}{{.StaticPrefix}}css/plyr.css">
<link rel="stylesheet" type="text/css" href="{{.BaseUrl}}{{.StaticPrefix}}css/style.css">
<script src="{{.BaseUrl}}{{.StaticPrefix}}js/plyr.js"></script>
<script src="{{.BaseUrl}}{{.StaticPrefix}}js/jquery.min.js"></script>
<script src="{{.BaseUrl}}{{.StaticPrefix}}js/player.js"></script>
</head>
<body>
<!--AUDIO-->
<div class="container container--audio">
<audio controls class="player">
<source
src="{{.AudioSource}}"
type="{{.AudioType}}">
</audio>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Media Player</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
<script src="js/jquery.min.js"></script>
<script src="js/srg-player-api.min.js"></script>
<script src="js/player--srg.js"></script>
</head>
<body>
<!-- SRG -->
<div id="srg-player" class="player player--srg" data-urn-src="urn:srf:video:3832c22e-7a7a-4b21-be19-9916e3a9bda7"></div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Media Player</title>
<link rel="stylesheet" type="text/css" href="css/plyr.css">
<link rel="stylesheet" type="text/css" href="css/style.css">
<script src="js/plyr.js"></script>
<script src="js/jquery.min.js"></script>
<script src="js/player.js"></script>
</head>
<body>
<!-- VIMEO -->
<div class="player" data-plyr-provider="vimeo" data-plyr-embed-id="259411563"></div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Media Player</title>
<link rel="stylesheet" type="text/css" href="css/plyr.css">
<link rel="stylesheet" type="text/css" href="css/style.css">
<script src="js/plyr.js"></script>
<script src="js/jquery.min.js"></script>
<script src="js/player.js"></script>
</head>
<body>
<!-- YOUTUBE -->
<div class="player" data-plyr-provider="youtube" data-plyr-embed-id="kY1F_Y0GniQ"></div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Media Player</title>
<link rel="stylesheet" type="text/css" href="{{.BaseUrl}}{{.StaticPrefix}}css/plyr.css">
<link rel="stylesheet" type="text/css" href="{{.BaseUrl}}{{.StaticPrefix}}css/style.css">
<script src="{{.BaseUrl}}{{.StaticPrefix}}js/plyr.js"></script>
<script src="{{.BaseUrl}}{{.StaticPrefix}}js/jquery.min.js"></script>
<script src="{{.BaseUrl}}{{.StaticPrefix}}js/player.js"></script>
</head>
<body>
<!-- SOURCE VIDEOS -->
<div class="container">
<video controls preload
{{if ne .PosterSource ""}}poster="{{.PosterSource}}"{{end}}
class="player">
<source
src="{{.VideoSource}}"
type="{{.VideoType}}">
</video>
</div>
<!--&lt;!&ndash; YOUTUBE &ndash;&gt;-->
<!--<div class="player" data-plyr-provider="youtube" data-plyr-embed-id="kY1F_Y0GniQ"></div>-->
<!--&lt;!&ndash; VIMEO &ndash;&gt;-->
<!--<div class="player" data-plyr-provider="vimeo" data-plyr-embed-id="259411563"></div>-->
</body>
</html>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment