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
src/mami.js
|
@ -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),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue