A-Frame's video and video sphere functionalities do not function properly on mobile and tablet devices

When using A-Frame, I've encountered issues with video and video sphere not auto playing. This is because mobile browsers typically require a user action to initiate video playback. I've tried implementing a click event to play the video, but it doesn't seem to be functioning within the A-Frame code. Here is the code snippet:


Answer №1

Take out the autoplay attribute if you prefer your video not to start playing automatically.

var myPlayBtn = document.querySelector('#playButton')
myPlayBtn.addEventListener('click', function() {
  document.querySelector('#scen01-video').play()
})
<video width="320" height="240" id="scen01-video" loop="true" src="https://cdn.glitch.com/237f9e5e-9593-4123-a05c-eff4a2b38f99%2FCaliper_logo_video.ogg?1499957478610"></video>
<img  width="320" height="240" id="playButton" src="https://cdn.glitch.com/237f9e5e-9593-4123-a05c-eff4a2b38f99%2Fyoutube-button-web-click.png?1499343364878">

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Check the jQuery if statement for the width of the window

I am perplexed as to why my final else if statement is not being executed. This is the code I have in place: $(document).ready(function() { function checkWidth() { var windowSize = $(window).width(); if (windowSize <= 479) { ...

What is the best way to prevent the dropdown function in a selectpicker (Bootstrap-Select)?

Is there a way to completely disable a selectpicker when a radio button is set to "No"? The current code I have only partially disables the selectpicker: $("#mySelect").prop("disabled", true); $(".selectpicker[data-id='mySelect']").addClas ...

After the table finishes loading, my goal is to display an export to Excel button

I am currently working on generating an HTML table using JSON data received from the backend Java application. My objective is to display an "Export to Excel" button after populating the table. The process involves users entering dates and selecting option ...

CSS or Coding? Learn how to display items side by side instead of on top of each other

Hey there! I manage a music website that is currently in beta. I'm running into an issue with the way the music results are appearing in the bottom player - they're all stacked on top of each other instead of being listed side by side. I've ...

Change the color of a c3js chart when it loads

I have been searching for a way to customize the color of a scatter chart's plot, and I came across an example that uses d3 code within the chart http://jsfiddle.net/ot19Lyt8/9/ onmouseover: function (d) { d3.select(d3.selectAll("circle ...

Guide to seamlessly integrating form data into MySQL using JavaScript and HTML without redirecting the user from the current page

Having trouble inserting a new user into MySQL database? I've attempted using both jQuery and pure JavaScript, but it doesn't seem to be working. There's no response when I click on the submit button. Any ideas on what might be causing this ...

Toggle the visibility of images with input radio buttons

Explanation I am attempting to display an image and hide the others based on a radio input selection. It works without using label, but when I add label, it does not work properly. The issue may be with eq($(this).index()) as it ends up selecting a differ ...

Monitoring the inclusion of a new item within the database

I am utilizing a Firebase Realtime Database where users have the ability to perform the following actions: add an item to the database update an item in the database Currently, I have a function that monitors a specific location within the database. ...

Press the vertical navigation bar

My website is currently undergoing a major overhaul. I am looking to enhance its functionality, but I may have taken on more than I can handle. You can find the link related to my query here: On my top menu, there is a button located on the left side. It ...

calculating the duration between successive PHP form submissions

I am trying to calculate the duration between when a user submits a PHP form and when they submit it again. The form reloads on the same page, essentially refreshing it. Additionally, the user may enter the same data again. I want the timer to start runnin ...

Setting a default currency value (either in dollars or euros) in an input field

Is there a way to automatically insert a currency symbol (€, $) in a text field by default when entering a number? Are there any default values for this feature? Thank you Here is an example ...

Decide on the javascript/jquery libraries you want to include

My app is experiencing slow loading times on the home screen and students using it from school district computers are running into ERR_CONNECTION_RESET errors due to strict firewalls. The excessive loading of javascript and jquery libraries in the head of ...

Retrieve data using Ajax querying from a specific data source

Currently, I am attempting to construct a custom query using Ajax to interact with PHP/MySQL. Here is what I have so far: Javascript code: var i=2; fetchFromDBPHP("name", "tblperson", "id="+i); function fetchFromDBPHP(column, table, condition) { ...

Tips for passing a variable containing an image source from Node.js to a Jade file

Below is the code snippet from my index.js file, where I'm using express for routing: var express = require('express'); var router = express.Router(); /* GET home page. */ router.get('/', function(req, res){ var db = req.db; ...

Modifying the hue of Material UI tab label

I attempted to modify the label color of a tab to black, but it seems to be stuck as white. Is this color hard-coded in material-ui? If not, how can I change it? Here's what I've tried: const customStyles = { tab: { padding: '2p ...

Navigate to a new page on button click using Row with Tanstack / React-Table and Typescript (2339)

Encountering a linting error when attempting to navigate to a new route by clicking on a table row. The functionality is working but how can I resolve this issue? It's showing an error message stating "The property "id" for type TData does not exist." ...

Domain Error Crossed

My issue is that I am working with cross-domains and making an ajax request to the same domain, let's say Domain A. However, I keep encountering an error saying 'No Access-Control-Allow-Origin'. $.ajax({ type: 'get', url: ...

CSS:Tips for removing borders with border-radius in CSS

I have a div that has been styled with a left-hand border, and it's causing me some trouble. You can view the styling here on Jsfiddle. Is there a way to remove just the left hand side border without affecting the rest of the design or creating an un ...

Is there a way to assign the chosen option from a dropdown list to an input field in Vue 3?

I am working with a list that is returned from an API request. I have a text input field where I can search for items in the list, and the results are displayed dynamically as I type. My goal is to be able to select an option from the list and display the ...

Sorting elements in an array using jQuery is a common task that can be easily accomplished

Query: I am faced with a challenge in handling a table where rows are dynamically added upon button clicks. To allow users to rearrange the rows, I have incorporated the jquery-ui sortable() function for sorting purposes. Consider the following scenario: ...