<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>I tried under Safari on iOS.  I guess sound is turned off there.</p>
    <p>Looks like the example below, which includes similar code to the
      standards example, further below, works OK on Kubuntu 21.10.,
      Firefox.  YMMV.</p>
    <p>I have iOS, iPadOS, Linux, and maybe others here, if you want me
      to try a different combination.  I don't really want to mess with
      sound drivers on a virtual machine though.</p>
    <p>I think the best thing to do to get X3D scripting working on the
      web is to use X_ITE.  I've been advocating it over X3DOM for a
      long time now.  You'll have to have an inclusive HTML or XHTML
      page to get it to work, I don't know how to get an external X_ITE
      to work with an .x3d file--AFAIK, it works with HTML, then X3D,
      JSON and VRML web addresses embedded in attributes.   X3DJSONLD
      has many examples. in src/main/html getting this kind of thing
      working.</p>
    <p>If you want to get X3DOM Scripting working, with the
      understanding that at least Protos are working, that's not really
      my baliwick.  I might advise stuff, like stick with simple
      ECMAScript scripts at first.</p>
    <p>My code for scripting only works for JSON and had a very strange,
      non-standard event model.  Here it is:</p>
    <p><a class="moz-txt-link-freetext" href="https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/Script.js">https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/Script.js</a></p>
    <p>I believe one enters the code with loadScripts().  Note that the
      script code doesn't work with a DOM tree, just with parsed JSON.<br>
    </p>
    <p>One should probably focus on getting existing Scripts working,
      instead of totally rewriting the JavaScript as I have done.  I've
      relied on DOM to get any routing working.  I did develop a
      strawman JS object event router, if anyone is interested.<br>
    </p>
    <p>Note; with X3DOM, routes including script fields do not work,
      AFAIK.   Getting the routing working between script fields and
      routes should be first priority.  A field element is not a legal
      script element child in HTML, AFAIK.  That's where you need to
      address the W3C, or do your own event routing.</p>
    <p>I'm not saying it's impossible.  I just have larger fish to fry,
      like getting Ajv8 working in the browser add dealing with JSON
      schema issues.</p>
    <p>If someone wants to help fix up @geoSystem in the JSON schema, so
      that Java schema validation will not be broken, that would be
      cool.</p>
    <p>I believe that Andreas Plesch was able to add an attribute to the
      Script so that it would not be parsed as HTML JavaScript.  That's
      been posted to this list, but may need to be revisited.  X_ITE
      avoids it by not putting Scripts in the HTML page (but there are
      extensions).<br>
    </p>
    <p>John<br>
    </p>
    <div class="moz-cite-prefix">On 11/9/21 13:03, John Carlson wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAGC3UE=GRZJR0gqXcwdNndVVudwwo=od+ak4iHkgqRL-sKuuXA@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="auto">For example, take a look at this:</div>
      <div dir="auto"><br>
      </div>
      <div dir="auto">
        <div><a
            href="https://coderextreme.net/X3DJSONLD/src/main/html/x_itejoe.html"
            moz-do-not-send="true" class="moz-txt-link-freetext">https://coderextreme.net/X3DJSONLD/src/main/html/x_itejoe.html</a></div>
        <br>
      </div>
      <div dir="auto">No sound…any idea why?</div>
      <div dir="auto"><br>
      </div>
      <div dir="auto">John </div>
      <div><br>
        <div class="gmail_quote">
          <div dir="ltr" class="gmail_attr">On Tue, Nov 9, 2021 at 11:42
            AM John Carlson <<a href="mailto:yottzumm@gmail.com"
              moz-do-not-send="true" class="moz-txt-link-freetext">yottzumm@gmail.com</a>>
            wrote:<br>
          </div>
          <blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)">
            <div dir="auto">Joe, if you have not done so already,  save
              off the html below, save in a folder with click.wav.   If
              the html is in index.html, and you have previously saved
              off the standard example as JoeExample.x3d in the same
              folder then there should be click.wav, index.html and
              JoeExample.x3d in the same folder.   Open index.html in
              the browser.</div>
            <div dir="auto"><br>
            </div>
            <div dir="auto">I think that’s the best way to get the
              example to work.   I’m not even sure what the x3d is
              supposed to do by reading it.   Do you need to attach the
              TouchSensor to a shape?  Idk</div>
            <div><br>
              <div class="gmail_quote">
                <div dir="ltr" class="gmail_attr">On Sun, Oct 31, 2021
                  at 11:14 PM John Carlson <<a
                    href="mailto:yottzumm@gmail.com" target="_blank"
                    moz-do-not-send="true" class="moz-txt-link-freetext">yottzumm@gmail.com</a>>
                  wrote:<br>
                </div>
                <blockquote class="gmail_quote" style="margin:0px 0px
                  0px
0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)">
                  <div>
                    <p>Try this:</p>
                    <p><span style="font-family:monospace"><span
style="font-family:monospace;background-color:rgb(255,255,255);color:rgb(0,0,0)"><!DOCTYPE
                          html> </span><br>
                        <html> <br>
                        <html> <br>
                         <head> <br>
                          <meta charset="utf-8"/> <br>
                        <link rel="stylesheet" type="text/css"
                        href=<a
                          href="https://create3000.github.io/code/x_ite/latest/dist/x_ite.css"
                          style="font-family:monospace" target="_blank"
                          moz-do-not-send="true">"https://create3000.github.io/code/x_ite/latest/dist/x_ite.css"</a>/><br>
                        <script type="text/javascript"
                        src=<a
                          href="https://create3000.github.io/code/x_ite/latest/dist/x_ite.min.js"
                          style="font-family:monospace" target="_blank"
                          moz-do-not-send="true">"https://create3000.github.io/code/x_ite/latest/dist/x_ite.min.js"</a>></scrip<br>
                        t> <br>
                        <script type="text/javascript"
                        src="<a
href="https://raw.githack.com/andreasplesch/x_ite_dom/master/release/x_ite_dom"
                          style="font-family:monospace" target="_blank"
                          moz-do-not-send="true"
                          class="moz-txt-link-freetext">https://raw.githack.com/andreasplesch/x_ite_dom/master/release/x_ite_dom</a>.<br>
                        1.3.js"></script> <br>
                          <style> <br>
                        X3DCanvas { <br>
                          width: 300px; <br>
                          height:150px; <br>
                        } <br>
                        <br>
                        body { <br>
                               margin:0px; <br>
                               padding:0px; <br>
                        } <br>
                          </style> <br>
                          </head> <br>
                         <body> <br>
                           <X3DCanvas cache='false'
                        url='"JoeExample.x3d"'> <br>
                                  <p>Your browser may not support
                        all features required by X_ITE!</p> <br>
                                  <Scene> <br>
                                  </Scene> <br>
                           </X3DCanvas> <br>
                         </body> <br>
                        </html><br>
                      </span></p>
                  </div>
                  <div>
                    <div>On 10/31/21 18:55, Joseph D Williams wrote:<br>
                    </div>
                    <blockquote type="cite">
                      <div>
                        <p class="MsoNormal"> </p>
                        <p class="MsoNormal">Looks like great stuff if I
                          as a simple user of the x3d ecmascript SAI
                          ever needed to know about it in order to
                          create and use x3d Script node. </p>
                        <p class="MsoNormal">All I want to know is will
                          this example work. </p>
                        <p class="MsoNormal"> </p>
                        <p class="MsoNormal"> </p>
                        <p class="MsoNormal"><a
href="https://www.web3d.org/documents/specifications/19775-2/V3.3/index.html"
                            target="_blank" moz-do-not-send="true">ISO/IEC
                            19775-2 Index page (web3d.org)</a></p>
                        <p class="MsoNormal"> </p>
                        <p class="MsoNormal"><a
href="https://www.web3d.org/documents/specifications/19775-2/V3.3/index.html"
                            target="_blank" moz-do-not-send="true"
                            class="moz-txt-link-freetext">https://www.web3d.org/documents/specifications/19775-2/V3.3/index.html</a></p>
                        <p class="MsoNormal"> </p>
                        <p class="MsoNormal"><a
href="https://www.web3d.org/documents/specifications/19777-1/V3.3/index.html"
                            target="_blank" moz-do-not-send="true">ISO/IEC
                            19777-1 Edition 2 -- X3D ECMAScript binding
                            (web3d.org)</a></p>
                        <p class="MsoNormal"> </p>
                        <p class="MsoNormal"><a
href="https://www.web3d.org/documents/specifications/19777-1/V3.3/index.html"
                            target="_blank" moz-do-not-send="true"
                            class="moz-txt-link-freetext">https://www.web3d.org/documents/specifications/19777-1/V3.3/index.html</a></p>
                        <p><a
href="https://www.web3d.org/documents/specifications/19776-1/V3.3/index.html"
                            target="_blank" moz-do-not-send="true">ISO/IEC
                            19776-1:2015 — X3D XML encoding — Index
                            (web3d.org)</a></p>
                        <p><a
href="https://www.web3d.org/documents/specifications/19776-1/V3.3/Part01/examples.html#ScriptingExample"
                            target="_blank" moz-do-not-send="true"
                            class="moz-txt-link-freetext">https://www.web3d.org/documents/specifications/19776-1/V3.3/Part01/examples.html#ScriptingExample</a></p>
                        <p><span
                            style="font-size:12pt;font-family:Verdana,sans-serif;color:black">Here
                            is the example:</span></p>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black"><?xml version="1.0" encoding="utf-8"?></span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black"><!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN"</span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black">  <a href="http://www.web3d.org/specifications/x3d-3.0.dtd" style="font-family:monospace" target="_blank" moz-do-not-send="true">"http://www.web3d.org/specifications/x3d-3.0.dtd"</a>></span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black"> </span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black"><X3D version='3.0' profile='Immersive'></span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black">  <head></span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black">    <meta name='filename' content='Scripting.x3d'/></span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black">  </head></span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black">  <Scene></span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black">    <Script DEF='OpenVault'></span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black">      <field name='openVault' type='SFTime' </span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black">             accessType='inputOnly'/></span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black">      <field name='combinationEntered' type='SFBool' </span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black">             accessType='inputOnly'/></span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black">      <field name='vaultUnlocked' type='SFTime' </span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black">             accessType='outputOnly'/></span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black">      <field name='unlocked' type='SFBool' value='false' </span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black">             accessType='initializeOnly' /></span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black">      <![CDATA[</span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black">      ecmascript:</span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black">      function combinationEntered (value) {</span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black">        unlocked = value;</span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black">      }</span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black">      function openVault(value) {</span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black">      if (unlocked) vaultUnlocked = value;</span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black">      }</span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black">      ]]></span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black">    </Script></span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black">    <Shape></span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black">      <Appearance></span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black">        <Material diffuseColor='1 0 0'/></span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black">      </Appearance></span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black">      <Sphere/></span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black">    </Shape></span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black">    <Sound maxBack='1000' maxFront='1000' minBack='1000' minFront='1000'></span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black">      <AudioClip DEF='Click' stopTime='1' </span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black">        description='clicking sound' url='"click.wav"'/></span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black">    </Sound></span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black">    <TouchSensor DEF='TS'/></span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black">    <ROUTE fromNode='TS' fromField='isOver' </span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black">           toNode='OpenVault' toField='combinationEntered'/></span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black">    <ROUTE fromNode='TS' fromField='touchTime' </span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black">           toNode='OpenVault' toField='openVault'/></span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black">    <ROUTE fromNode='OpenVault' fromField='vaultUnlocked' </span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black">           toNode='Click' toField='startTime'/></span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black">  </Scene></span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black"></X3D></span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black"> </span></b></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><a href="https://www.web3d.org/documents/specifications/19776-1/V3.3/Part01/Examples/Scripting.x3d" style="font-family:monospace" target="_blank" moz-do-not-send="true"><span style="font-size:12pt;font-family:Verdana,sans-serif;background-color:white">Click here</span></a><span style="font-size:12pt;font-family:Verdana,sans-serif;background-color:white;color:black"> to view this example in a 3D scene window.</span></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><span style="font-size:12pt;font-family:Verdana,sans-serif;background-color:white;color:black"> </span></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><span style="font-size:12pt;font-family:Verdana,sans-serif;background-color:white;color:black">If already ok for some tools please tell me: </span></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><span style="font-size:12pt;font-family:Verdana,sans-serif;background-color:white;color:black">How can we best be sure that when that ‘Click here’ in the spec or in this note gets made, that it works as described using any competent html Dom webGL ecmascript browser, not in a sandbox (at least show the geometry and retrieve that .wav), free to interact with the rest of our WWW. </span></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><span style="font-size:12pt;font-family:Verdana,sans-serif;background-color:white;color:black"> </span></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><span style="font-size:12pt;font-family:Verdana,sans-serif;background-color:white;color:black">Thanks for all, </span></pre>
                        <pre style="margin-left:11.25pt;font-family:monospace"><span style="font-size:12pt;font-family:Verdana,sans-serif;background-color:white;color:black">Joe </span><b style="font-family:monospace"><span style="font-size:8.5pt;font-family:monospace;color:black"></span></b></pre>
                        <p class="MsoNormal"> </p>
                        <p class="MsoNormal"> </p>
                        <div style="border-style:solid none
                          none;border-top-width:1pt;padding:3pt 0in
                          0in;border-top-color:rgb(225,225,225)">
                          <p class="MsoNormal"
                            style="border:none;padding:0in"><b>From: </b><a
                              href="mailto:yottzumm@gmail.com"
                              target="_blank" moz-do-not-send="true">John
                              Carlson</a><br>
                            <b>Sent: </b>Sunday, October 31, 2021 1:16
                            PM<br>
                            <b>To: </b><a
                              href="mailto:x3d-public@web3d.org"
                              target="_blank" moz-do-not-send="true"
                              class="moz-txt-link-freetext">x3d-public@web3d.org</a><br>
                            <b>Subject: </b>[x3d-public] ECMAScript 6
                            X3D API</p>
                        </div>
                        <p class="MsoNormal"> </p>
                        <p class="MsoNormal">More work done on es6x3d:</p>
                        <p class="MsoNormal"> </p>
                        <p class="MsoNormal"><a
                            href="https://GitHub.com/coderextreme/es6x3d"
                            target="_blank" moz-do-not-send="true">https://GitHub.com/coderextreme/es6x3d</a></p>
                        <p class="MsoNormal"> </p>
                        <p class="MsoNormal">Changes for MFString, and
                          other MF work.</p>
                        <p class="MsoNormal"> </p>
                        <p class="MsoNormal">Still lots of work to do,
                          including possible export to three.js</p>
                        <p class="MsoNormal"> </p>
                        <p class="MsoNormal">John</p>
                        <p class="MsoNormal"> </p>
                        <p class="MsoNormal">_______________________________________________</p>
                        <p class="MsoNormal">x3d-public mailing list</p>
                        <p class="MsoNormal"><a
                            href="mailto:x3d-public@web3d.org"
                            target="_blank" moz-do-not-send="true"
                            class="moz-txt-link-freetext">x3d-public@web3d.org</a></p>
                        <p class="MsoNormal"><a
                            href="http://web3d.org/mailman/listinfo/x3d-public_web3d.org"
                            target="_blank" moz-do-not-send="true"
                            class="moz-txt-link-freetext">http://web3d.org/mailman/listinfo/x3d-public_web3d.org</a></p>
                        <p class="MsoNormal"> </p>
                      </div>
                    </blockquote>
                  </div>
                </blockquote>
              </div>
            </div>
          </blockquote>
        </div>
      </div>
    </blockquote>
  </body>
</html>