Hi John,
Several months ago you kindly helped me create a js script that would play a sound file and change the background color in a smartphone app and it has worked fine. As a reminder a smartphone app typically has a single physical index.html file that contains multiple pages and in this environment the js script correctly plays a sound and changes the background color.
The app has grown quite large (over 1,100 lines with probably another 1,000+ to be added) and is having, I think, memory management problems causing it to sometimes not play sound files and occasionally to freeze. I have been advised that I should split the index.html file into multiple smaller html files to try and fix this problem. So I did this and now find that the original js script is not displaying the Spanish phrases correctly and is not playing the associated sound file.
I created a short demo app to show the problem. The menu page contains two entries, "Arrest" points to a page that is part of index.html and correctly displays the phrases and plays sounds, the "Age weight & height" points to a separate external html file and does not display the phrase correctly or play the sound. The web version of the app can be seen at http://www.lawenforcementspanish.com/mledemo2 .
I took a look at the Chrome element inspector for the Spanish phrases and it appears that the js additions shown below are not added to the tags in the separate file:
to the tags is not being done in the separate file.Code:<img id="jp_poster_0" style="width: 0px; height: 0px; display: none;"><audio id="jp_audio_0" preload="metadata" src="http://www.lawenforcementspanish.com/mledemo2/test.mp3"></audio>
Below is the source code for a phrase in the "arrest" page which works correctly
Below is the source code for a phrase in the "Age weight and height" page which doesn't display correctly or play sounds:HTML Code:<div class="wrapper"> <a class="formal spanish ui-link" data-trigger="arr1f" href="test.mp3" id="jp_jplayer_0" style="width: 0px; height: 0px;"><img id="jp_poster_0" style="width: 0px; height: 0px; display: none;"><audio id="jp_audio_0" preload="metadata" src="http://www.lawenforcementspanish.com/mledemo2/test.mp3"></audio></a> <a class="formal trigger ui-link" id="arr1f" href="#" data-playing="false" style="background-color: rgb(255, 255, 255);">F: Está bajo arresto</a> <div class="spacer"></div> <a class="informal spanish ui-link" data-trigger="arr1i" href="ringding.mp3" id="jp_jplayer_1" style="width: 0px; height: 0px;"><img id="jp_poster_1" style="width: 0px; height: 0px; display: none;"><audio id="jp_audio_1" preload="metadata" src="http://www.lawenforcementspanish.com/mledemo2/ringding.mp3"></audio></a> <a class="informal trigger ui-link" id="arr1i" href="#">I: Informal Spanish phrase</a> </div>
When I just look at the source code, not using the inspector I don't see the additional tags in either page so I'm assuming it's being done by js. I don't know what is creating the additional [img] and [Audio] tags but that is the only difference I can see between the two pages.HTML Code:<div class="wrapper"> <a class="formal spanish ui-link" data-trigger="howoldf" href="test.mp3">F: Cuántos años tiene?</a> <a class="formal trigger ui-link" id="howoldf" href="#">F: Cuántos años tiene?</a> <div class="spacer"></div> <a class="informal spanish ui-link" data-trigger="howoldi" href="ringding.mp3">I: Cuántos años tienes?</a> <a class="informal trigger ui-link" id="howoldi" href="#">I: Cuántos años tienes?</a> </div>
Also, if js is adding [Audio] tags does this mean it supports playing the [Audio] tag?
Thanks for any insight or direction you can provide.
Tony Babb



Reply With Quote

Bookmarks