2015-06-30 01:32:18 +00:00
|
|
|
DEFAULT_ERROR = 'You are currently connected via HTTPS but the embedded content
|
|
|
|
uses non-secure plain HTTP. Your browser therefore blocks it from
|
|
|
|
loading due to mixed content policy. To fix this, embed the video using a
|
2017-01-10 07:47:11 +00:00
|
|
|
secure link if available (https://...), or find another source for the content.'
|
2015-06-30 01:32:18 +00:00
|
|
|
|
|
|
|
genParam = (name, value) ->
|
|
|
|
$('<param/>').attr(
|
|
|
|
name: name
|
|
|
|
value: value
|
|
|
|
)
|
|
|
|
|
|
|
|
window.EmbedPlayer = class EmbedPlayer extends Player
|
|
|
|
constructor: (data) ->
|
|
|
|
if not (this instanceof EmbedPlayer)
|
|
|
|
return new EmbedPlayer(data)
|
|
|
|
|
|
|
|
@load(data)
|
|
|
|
|
|
|
|
load: (data) ->
|
|
|
|
@setMediaProperties(data)
|
|
|
|
|
|
|
|
embed = data.meta.embed
|
|
|
|
if not embed?
|
|
|
|
console.error('EmbedPlayer::load(): missing meta.embed')
|
|
|
|
return
|
|
|
|
|
2021-08-20 03:44:57 +00:00
|
|
|
@player = @loadIframe(embed)
|
2015-06-30 01:32:18 +00:00
|
|
|
|
|
|
|
removeOld(@player)
|
|
|
|
|
|
|
|
loadIframe: (embed) ->
|
|
|
|
if embed.src.indexOf('http:') == 0 and location.protocol == 'https:'
|
|
|
|
if @__proto__.mixedContentError?
|
|
|
|
error = @__proto__.mixedContentError
|
|
|
|
else
|
|
|
|
error = DEFAULT_ERROR
|
|
|
|
alert = makeAlert('Mixed Content Error', error, 'alert-danger')
|
|
|
|
.removeClass('col-md-12')
|
|
|
|
alert.find('.close').remove()
|
|
|
|
return alert
|
|
|
|
else
|
|
|
|
iframe = $('<iframe/>').attr(
|
|
|
|
src: embed.src
|
|
|
|
frameborder: '0'
|
2019-06-09 13:05:13 +00:00
|
|
|
allow: 'autoplay'
|
2016-02-22 05:04:35 +00:00
|
|
|
allowfullscreen: '1'
|
2015-06-30 01:32:18 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
return iframe
|