Added option to automatically play media upon embed.
This commit is contained in:
parent
f4b43290bb
commit
5b35595fea
3 changed files with 18 additions and 3 deletions
|
@ -94,6 +94,7 @@ window.Umi = { UI: {} };
|
|||
settings.define('expandTextBox').default(false).create();
|
||||
settings.define('eepromAutoInsert').default(true).create();
|
||||
settings.define('autoEmbedV1').default(false).create();
|
||||
settings.define('autoEmbedPlay').default(false).create();
|
||||
settings.define('soundEnable').default(true).critical().create();
|
||||
settings.define('soundPack').default('').create();
|
||||
settings.define('soundVolume').default(80).min(0).max(100).create();
|
||||
|
|
|
@ -262,7 +262,8 @@ Umi.Parsing = (function() {
|
|||
element.dataset.embed = '1';
|
||||
element.textContent = 'Remove';
|
||||
container.textContent = '';
|
||||
container.appendChild($e({
|
||||
|
||||
let media = $e({
|
||||
tag: 'audio',
|
||||
attrs: {
|
||||
src: url,
|
||||
|
@ -270,9 +271,13 @@ Umi.Parsing = (function() {
|
|||
onloadedmetadata: () => {
|
||||
if(mami.settings.get('autoScroll'))
|
||||
container.scrollIntoView({ inline: 'end' });
|
||||
if(mami.settings.get('autoEmbedPlay'))
|
||||
media.play();
|
||||
},
|
||||
},
|
||||
}));
|
||||
});
|
||||
|
||||
container.appendChild(media);
|
||||
}
|
||||
};
|
||||
const toggleVideo = function(element) {
|
||||
|
@ -300,7 +305,7 @@ Umi.Parsing = (function() {
|
|||
element.dataset.embed = '1';
|
||||
element.textContent = 'Remove';
|
||||
|
||||
let html = $e({
|
||||
let media = $e({
|
||||
tag: 'video',
|
||||
attrs: {
|
||||
src: url,
|
||||
|
@ -312,10 +317,14 @@ Umi.Parsing = (function() {
|
|||
onloadedmetadata: () => {
|
||||
if(mami.settings.get('autoScroll'))
|
||||
container.scrollIntoView({ inline: 'end' });
|
||||
if(mami.settings.get('autoEmbedPlay'))
|
||||
media.play();
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
let html = media;
|
||||
|
||||
if(mami.settings.get('motivationalVideos'))
|
||||
html = motivFrame(
|
||||
extractMotiv(element),
|
||||
|
|
|
@ -74,6 +74,11 @@ Umi.UI.Settings = (function() {
|
|||
title: 'Auto-embed media',
|
||||
type: 'checkbox',
|
||||
},
|
||||
{
|
||||
name: 'autoEmbedPlay',
|
||||
title: 'Auto-play media',
|
||||
type: 'checkbox',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue