Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

HTML5 Video Autoplay not Working

HumanSky
Mega Guru

I'm trying to add the following HTML5 <video> attribute as a Service Portal widget as a background div video:

<video autoplay muted loop controls>

  <source src="//sample.com/path/to/video.mp4"></source>

</video>

Everything works fine, except for autoplay. Has anyone else ran into a similar issue?

1 ACCEPTED SOLUTION

HumanSky
Mega Guru

I was able to figure it out. Apparently Angular was ignoring some of the <video> attributes. However, moving the video source from <source> element to "ng-source" attribute seemed to do the trick. Here's the sample code:



  1. <video autoplay muted loop controls ng-src="//sample.com/path/to/video.mp4"></video>

View solution in original post

2 REPLIES 2

Inactive_Us1474
Giga Guru

Try :


  1. <video muted loop controls>  
  2.   <source src="//sample.com/path/to/video.mp4?autoplay=1"></source>  
  3. </video>

I tried with Iframe it worked with the embed tag.


HumanSky
Mega Guru

I was able to figure it out. Apparently Angular was ignoring some of the <video> attributes. However, moving the video source from <source> element to "ng-source" attribute seemed to do the trick. Here's the sample code:



  1. <video autoplay muted loop controls ng-src="//sample.com/path/to/video.mp4"></video>