hmharsh3
hmharsh3

Reputation: 355

How to mute video in aframe.js?

I am using

<a--assets>
 <video id="penguin-sledding" autoplay  loop="true" src="v.mp4"> 
</a-assets>

assets,Now how can i mute this video by code

<a-video src="#penguin-sledding" width="16" height="9" position="0 0 -20"></a-video> 

Upvotes: 0

Views: 1809

Answers (2)

Laurie Clark
Laurie Clark

Reputation: 630

You can use this to change it by code:

$("video").prop('muted', true);

Upvotes: 0

Naomi
Naomi

Reputation: 31

You can use some html5 video controls, though not all will work. Luckily "muted" easily does the trick. Also, you have an extra hyphen in <a-assets> you need to remove. The following code will play a muted video.

<a-assets>
    <video muted id="penguin-sledding" autoplay  loop="true" src="v.mp4"> 
</a-assets>

<a-video src="#penguin-sledding" width="16" height="9" position="0 0 -20"></a-video>

Upvotes: 3

Related Questions