• Register
Welcome to the in5 Answer Exchange! This a place to get answers about in5 (InDesign to HTML5) and make requests.

Add tags/parameters to <video> html tag

0 votes

Hi. I'm working on a magazine with a lot of videos in. Is there a way to add the tags "playsinline autoplay loop muted" to all <video>-elements in the exported hpub html code? 

Right now I manually delete the controls="controls"-tag and add "playsinline autoplay loop muted" to the element on all pages and it gets very annoying when you have the edit the exported html-pages every time.

Example code for reference - I've made the text bold where I usually edit and add my own:

Exported code: 

<video width="375" height="667" controls="controls" data-id="4771" poster="assets/images/item_4771.png" data-autoplay="1" data-autodelay="0" data-nopause="1" class="mejs-none">
<source src="assets/media/ThorCover2.mp4" type="video/mp4"/>
<object>      </object>
</video>

 
 
Edited code:
<video width="375" height="667" data-id="4771" poster="assets/images/item_4771.png" data-autoplay="1" data-autodelay="0" data-nopause="1" class="mejs-none" autoplay loop muted playsinline>
      <source ...."/>
      <object>      </object>
    </video>
 
 
Any help is greatly appreciated. Thanks
asked Nov 10, 2017 in how_to by froessell (220 points)
edited Nov 13, 2017 by froessell
    
Did the answer below resolve this for you?
Yes, it worked perfectly. Sorry for not responding sooner. It's been a few hectic weeks and I thought I answered you.
Glad to hear it. :-)

1 Answer

0 votes
 
Best answer

You can remove the controller using the Media Panel in InDesign (select None).

You can also set loop there.

Autoplay can be set in the Overlays panel.

You can try setting several properties at once in the output by attaching the following as a .js file in the Resources section of the in5 dialog:

$('video').each(function(index,elem){ 
  $(this).attr('autoplay','autoplay').attr('loop','loop').attr('muted','muted').attr('playsinline','playsinline');

});

The success of that code may depend on whether or not it executes before the media player elements are initialized (I haven't tested it).

 

 

answered Nov 14, 2017 by justin (135,050 points)
selected Dec 13, 2017 by justin
P.S. I added playsinline by default to the current version.
...