Community
VRED Forum
Welcome to Autodesk’s VRED Forums. Share your knowledge, ask questions, and explore popular VRED topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

VRED in Media Editor the html Autoplay doesn't work

12 REPLIES 12
SOLVED
Reply
Message 1 of 13
Anonymous
1128 Views, 12 Replies

VRED in Media Editor the html Autoplay doesn't work

Hi,

what I'm trying to do:
using a vset to activate a material switch
the material displays a html page
when i switch, i want a sound to be played that is integrated in the html file
the autoplay feature works in the browser
but not yet in vred
I hope you can help me with this issue

Tags (1)
12 REPLIES 12
Message 2 of 13
seiferp
in reply to: Anonymous

How did you get your audio autoplay working with the latest chrome browser? Google has changed their policies in April 2018 and blocked autoplay! You may have to build a function that allows you to trigger the play/pause html controls after the page was loaded via python in a 2nd step to simulate a user interaction.

Message 3 of 13
Anonymous
in reply to: seiferp

Thanks for the quick reply.
I've tried my .html file with the edge chromium browser. I didn't think there would be a difference that affects me.
I'll try to find another solution.
Is there a python command which finds out if a geometry is hidden or not. Or alternatively, which Geometry in a switch is currently selected.

Message 4 of 13
seiferp
in reply to: Anonymous

I´ve tried sth. with play and pause audio when toggling material switches. Hope this helps.

Message 5 of 13
Anonymous
in reply to: seiferp

Thanks a lot, I can work with this solution.
Anyway:

I found a way to use Autoplay in VRED 

Instead of using 

<audio src="..." autoplay> </audio>

You can use

<iframe src="..." allow="autoplay" style="display:none"></iframe> 
Message 6 of 13
Shawn_Collins-Lopez
in reply to: Anonymous

Hi Pascal,

I downloaded and tested your sample file from this Forum.  It works for audio.  I was unable to convert the index.html to a video format.

Do you have a sample running a video with sound not just sound? Video format MP4 or WMV or WEBM?

 

Thank you,

Shawn

 

<!DOCTYPE html>

<html>

<head>

    <meta content="text/html; charset=UTF-8">

    <meta name="author" content="Pascal Seifert">

    <title>Media Player - Movie</title>

    <link rel="stylesheet" type="text/css" href="main.css"/>

    <script type="text/javascript" src="script.js"></script>

</head>

<body>

    <button onclick="playAudio()" type="button">Play Audio</button>

    <button onclick="pauseAudio()" type="button">Pause Audio</button><br>

 

   

    <audio id="myAudio" src="assets/6-Sorfjorden_Chapel-Wild_Bullet.wav" type="audio/wav"></audio>

<script>

var audio = document.getElementById("myAudio");

 

function playAudio() {

  var i = audio.play();

}  

document.addEventListener("VRED_Play", playAudio);

   

function pauseAudio() {

  audio.pause();

}   

document.addEventListener("VRED_Pause", pauseAudio);  

</script>    

</body>

</html>

Message 7 of 13

Attached an example. The changed chrome policies are a bit annoying I agree 🙄 The attached example requires at least a one-time user input into the page. Single click on the canvas before the VSet script can start and pause the video.

Message 8 of 13

Hi Pascal, Thank you for the Video demo file.  The ZIP you posted is missing the index.html file.  VRED is looking here for it: file:///C:/Users/seiferp/Desktop/index.html.  It was not in the zip.  Let me know if you can add the index file to the zip?

Thank you, Shawn

Message 9 of 13

Oh yeah silly me! Attached the file again.

Message 10 of 13

Awesome! Thank you Pascal!  It's working and I was able to change the video and start image.  Wish it would auto play or have a Python script to activate it without clicking on the video but this is a step in the right direction. 

Thank you, Shawn

Message 11 of 13

Hey Pascal, I was able to get the Video to autoplay when loaded.  Chrome blocks autoplay if sound is on.  Found this info and code to do it.  Just cant get the sound turned back on after it autoplays...

 

The issue with this is Chrome would not play the video because it hasn’t been muted.  The sound would start to play and Chrome doesn’t want that.  So the solution is pretty simple, you have to mute the video and then, only then, will Chrome play it normally when the page loads.  To mute the video add a “muted” attribute like so:

<video controls autoplay loop muted>
<source src=”movie.mp4″ type=”video/mp4″>
</video>

Message 12 of 13

Interesting 🤔 good to know.

Message 13 of 13
Anonymous
in reply to: Shawn_Collins-Lopez

In my case autoplay worked if i dont use

 

<audio src=„Audiodatei.wav" type="audio/wav"  autoplay></audio>

 

but use 

 

<iframe src=„Audiodatei.wav" allow="autoplay" style="display:none"></iframe> 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report