☑ No audio playing

This works thank you so much

Hey i developing a simple scene where there is a TV set and inside TV a video play on user interaction.
Everything works well but AUDIO is not playing along with the video. Can anyone let me know the solution to this ?

I’m using the same video texture script given in the Video Tutorial with some changes. Just for you reference i’m pasting it below as well.

var Videotexture = pc.createScript(‘videotexture’);

Videotexture.attributes.add(‘materials’, {
type: ‘asset’,
assetType: ‘material’,
array: true

Videotexture.attributes.add(‘video’, {
type: ‘asset’

// initialize code called once per entity
Videotexture.prototype.initialize = function() {
var app = this.app;

// Create a texture to hold the video frame data            
var videoTexture = new pc.Texture(app.graphicsDevice, {
    format: pc.PIXELFORMAT_R5_G6_B5,
    autoMipmap: false
videoTexture.minFilter = pc.FILTER_LINEAR;
videoTexture.magFilter = pc.FILTER_LINEAR;
videoTexture.addressU = pc.ADDRESS_CLAMP_TO_EDGE;
videoTexture.addressV = pc.ADDRESS_CLAMP_TO_EDGE;

// Create HTML Video Element to play the video
var video = document.createElement('video');
video.addEventListener('canplay', function (e) {
video.src = this.video.getFileUrl();
video.crossOrigin = 'anonymous';
video.loop = true;

// video.playsinline = true;
video.muted = true; // This line allows video to play without prior interaction from the user

// Get the material that we want to play the video on and assign the new video
// texture to it.
for (var i = 0; i < this.materials.length; i++) {
    var material = this.materials[i].resource;
    material.emissiveMap = videoTexture;

this.videoTexture = videoTexture;

this.upload = true;

this.app.on('start-demo', function () {


Web browsers now only play back video without user interaction if sound is muted which is done in the code your have used above

video.muted = true; // This line allows video to play 

To enable audio, you have to do so as part of a user interaction event (such as a mouse click)

Exclusive for iOS, it’s not at all working, anyway the code we tried mentioned below.

var startSound = function () {
document.removeEventListener(‘click’, startSound);
//var isIOS = /iPad|iPhone|iPod/.test(navigator.platform);
//if (isIOS)
document.addEventListener(‘click’, startSound);

Note: This code is working for Android and desktop.

You will have to check around play back of video/audio on iOS in the web development resources. I don’t have an iOS device to check.

From a quick Google, you may have to show video controls for sound to be allowed in a video: https://vsatips.com/2017/07/03/no-sound-on-videos-in-safari-ios-10-12/