Reputation: 165
With A-Frame I'm not able to get autoplay="false" or loop="false" to work. The video plays automatically and loops anyway. I also tried the 'repeat' attribute from documentation, but that did not seem to work either: https://aframe.io/docs/0.4.0/primitives/a-video.html#attributes_repeat
How to get a video to not autoplay or loop in A-Frame?
<a-video position="0 3 -5" autoplay="false" loop="false"
src="./assets2/video/Space-Cats-Magic-Fly.mp4"
material="shader:flat; side:double; transparent:true;"
geometry="mergeTo:null; primitive:circle; radius:3.0;">
</a-video>
Upvotes: 0
Views: 7673
Reputation: 121
Their is a turn-around way for this Just pause the video at start and set the current time to 0.1
const videoEl = document.querySelector('#vid');
videoEl.pause()
videoEl.currentTime = 0.1
Upvotes: 0
Reputation: 46
http://codepen.io/machenmusik/pen/pRbJYj
<script src="https://rawgit.com/aframevr/aframe/master/dist/aframe-master.js"></script>
<a-scene>
<a-assets>
<video id="myvideo" src="https://ucarecdn.com/bcece0a8-86ce-460e-856b-40dac4875f15/"></video>
</a-assets>
<a-sky src="#myvideo"></a-sky>
<!-- or a-videosphere or a-video -->
</a-scene>
Upvotes: 1
Reputation: 13233
https://aframe.io/docs/0.4.0/guides/#using-the-asset-management-system
Create a separate video element without autoplay/loop and reference it using an ID selector:
<a-scene>
<a-assets>
<video id="vid" src="a.mp4"></video>
</a-assets>
<a-video src="#vid"></a-video>
</a-scene>
Upvotes: 1