I am using TinyMCE's Media plugin and unable to get an alternate media source (using the Advanced > 'Alternative source URL' field) to appear in the embedded video code. When I select a 'Source' or 'Media poster (Image URL)' file, these items appear in the embed code as expected. However, the alt source file does not. Additionally, when I close and reopen the Insert Media dialog, my alt media source selection is gone.
I've tried using this template from the TinyMce media plugin docs, but with the same result:
video_template_callback: function(data) {
return '<video width="' + data.width + '" height="' + data.height + '"' + (data.poster ? ' poster="' + data.poster + '"' : '') + ' controls="controls">
' + '<source src="' + data.source + '"' + (data.sourcemime ? ' type="' + data.sourcemime + '"' : '') + ' />
' + (data.altsource ? '<source src="' + data.altsource + '"' + (data.altsourcemime ? ' type="' + data.altsourcemime + '"' : '') + ' />
' : '') + '</video>';
}
The only solution I found was to use a modified template that always includes a second <source>
tag, even if there is no alt source specified. With this second source tag present, any altsource values are added to the tag when I add an alt source through the dialog:
return '<video width="' + data.width + '" height="' + data.height + '"' +
(data.poster ? ' poster="' + data.poster + '"' : '') + ' controls="controls">
' +
'<source src="' + data.source + '"' + (data.sourcemime ? ' type="' + data.sourcemime + '"' : '') + ' />
' +
'<source ' + (data.altsource ? 'src="' + data.altsource + '"' : '') + (data.altsourcemime ? ' type="' + data.altsourcemime + '"' : '') + ' />
' +
'</video>';
}
This seems like a possible TinyMCE bug. However, in testing their site demo, I could not get the odd behavior to reproduce.
Has anyone else run into this issue?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…