For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub
- This topic has 16 replies, 4 voices, and was last updated 12 years, 1 month ago by
Uplink1001.
-
AuthorPosts
-
Uplink1001MemberHi.
Am i missing something somewhere.
applied the folowing code in app, and it all works in Chrome, click on the image button and the relevent sound applied to that image button plays.
so built native iOS app and downloaded to my phone, problem is everything display fine but when you click on the image button, nothing plays,,,,nada
Has anyone any idea where i am going wrong…….. example code has two examples, i have a total of sixteen, but none work…??? is there something i need to add or delete from the custom.js
Using iPhone 4 iOS7
Mobione 2.6.1I have tried the following Custom audio demo that is on the forum and it is the same when downloaded to my phone, display fine but no sound playing?
http://www.genuitec.com/support-genuitec/download/file.php?id=1733
where do i go from here?/** * Notification that the UI is about to transition to a new page. * Perform custom prepage-transition logic here. * @param {String} currentPageId * @param {String} targetPageId * @returns {boolean} true to continue transtion; false to halt transition */ phoneui.prePageTransition = function(currentPageId,targetPageId) { // add custom pre-transition code here // return false to terminate transition return true; } /** * Notification that the UI has transition to a new page. * * @param {String} newPageId */ phoneui.postPageTransition = function(newPageId) { } /** * Notification that device orientation has changed. * * @param {String} newOrientation */ phoneui.postOrientationChange = function(newOrientation) { } //----------------------------------------------------------- /** * Called when document is loaded. */ phoneui.documentReadyHandler = function() { initAudio(); } //create a hidden <audio> element to play the src mp3 file; //configure button click handler to toggle play on/off function initAudio() { audio = new Audio(); audio.src = 'audio/A10warthogpass.mp3'; isPlaying = false; buttonId = '#m1-screen9-Playstopbutton0'; $(buttonId).click(toggleAudio); //stop audio when changing browser page or click home btn $(window).bind('pagehide',stopAudio); } function toggleAudio() { if (isPlaying) { stopAudio(); } else { playAudio(); } } //start playing, update button label to STOP function playAudio() { if (!audio || isPlaying) return; $(buttonId).text(''); audio.play(); isPlaying = true; } /** * Notification that the page's HTML/CSS/JS is about to be loaded. * Perform custom logic here, f.e. you can cancel request to the server. * @param {String} targetScreenId * @returns {boolean} true to continue loading; false to halt loading */ phoneui.prePageLoad = function(targetScreenId) { // add custom pre-load code here // return false to terminate page loading, this cancels transition to page as well return true; } /** * Notification that the UI has transition to a new page. * * @param {String} newPageId */ phoneui.postPageTransition = function(newPageId) { } /** * Notification that device orientation has changed. * * @param {String} newOrientation */ phoneui.postOrientationChange = function(newOrientation) { } //create a hidden <audio> element to play the src mp3 file; //configure button click handler to toggle play on/off function initAudio1() { audio = new Audio(); audio.src = 'audio/Awaclanding.mp3'; isPlaying = false; buttonId = '#m1-screen9-Playstopbutton1'; $(buttonId).click(toggleAudio); //stop audio when changing browser page or click home btn $(window).bind('pagehide',stopAudio); } /** * Notification that the page's HTML/CSS/JS is about to be loaded. * Perform custom logic here, f.e. you can cancel request to the server. * @param {String} targetScreenId * @returns {boolean} true to continue loading; false to halt loading */ phoneui.prePageLoad = function(targetScreenId) { // add custom pre-load code here // return false to terminate page loading, this cancels transition to page as well return true; }HELP………….
January 16, 2014 at 12:16 pm #346106
BrandonMemberTry starting smaller.
Add a audio widget to a new project. Add your audio file to the project (not in the audio widget). Add a single button. In the button chose run javascript and try this code:
var audioWidget1 = AudioPlayerWidget.fromWidget('m1-formname-audio1-container');//change formname to your form audioWidget1.setMedia('yourfile.mp3'); audioWidget1.play();Run the project and see if it plays the audio. This code is from a project of mine that has been built with 2.6 and is on the Apple app store.
January 16, 2014 at 12:24 pm #346108
Uplink1001MemberHI.
Sorry to be a pain Cincyplanet, but
i am fairly new to this, can you explain in simpler terms?
Also i just did the build process a second time just to see what would happen.
the .ipa file had changed in size, less that before from 39MB down to 36MB????
also the screen where i had the sound and image to click on do not show now even though i have changed nothing?awaiting your reply.
Thanks Uplink1001: and thanks for the quick response
just downloaded 3 of your apps, pretty cool, only one thing the app SNAP Dragons, it crashes on load, im running iPhone 4 iOS7January 16, 2014 at 12:56 pm #346110
BrandonMemberNo problem. Here some detailed outline:
1. Create a new form (File, New, etc)
1a. Save this as audiotest.
2. Add an audio widget to the layout.
3. Add your audio file to the PROJECT, use Additional Project files on the right hand side under the properties. For this sample let us say your file is called soundfile1.mp3
4. Add a button to the layout
5. Click on the button and under properties, On Click, select Run Javascript
6. In the code area (clicking on the little … that comes up after you select Run Javascript) add this:var audioWidget1 = AudioPlayerWidget.fromWidget('m1-audiotest-audio1-container'); audioWidget1.setMedia('soundfile1.mp3');// change to your sound file name audioWidget1.play();7. Save and run the layout in the web simulator and see if it works.
Try that and let me know.
January 16, 2014 at 2:51 pm #346117
Uplink1001MemberHi
Thanks for that. Too late to try now but will give it a try in the morning and will get back to you with the results…Thanks again
January 17, 2014 at 5:00 am #346147
Uplink1001MemberHI.
Thanks for that CincyPlanet:-)
Thant worked a treat, everything working now.
Thanks for your help, Great stuff…..Uplink1001
January 17, 2014 at 6:58 am #346151
Uplink1001MemberHI.
have run into a problem, thought everything was fine.
once build has been done, run in web sim, all of the sound files are being put into the parent dir:
instead of the audio dir:
this seems to create a lag when playing.
am i missing something in the code as to where the file’s should go.var audioWidget1 = AudioPlayerWidget.fromWidget('m1-audiotest-audio1-container'); audioWidget1.setMedia('soundfile1.mp3');// change to your sound file name audioWidget1.play();January 17, 2014 at 7:43 am #346152
BrandonMemberIm not at my dev system but it shouldn’t matter which directory the audio is in. I assume you already checked the audio to make sure the lag is not in the file?
Depending on how may audio files you have you may be able to pre-load them (note that I have not tried this so it may or may not work). Like on page load set your media. Or even use multiple hidden audio widgets already set with the sound file, then you can just tell them to play?
Hopefully support will chime in on the lag.January 17, 2014 at 8:55 am #346155
support-michaelKeymaster1) What is the duration of the lag (latency) you are observe?
– how are does your app use audio and what is an acceptable level of latency, e.g., is it game with zero latency requirement or something else like instructional info that can lag a sec or 2 if appropriate feedback is presented.2) The audio file details: size, format, … all that stuff?
Can you share the file with us? We can give it a go on a few devices. The iphone4 you mentioned is approaching its end of life.January 17, 2014 at 9:35 am #346157
Uplink1001MemberHi. again
Seems having to many on one screen causes the lag.
I have tried it with only 8 per page and it seems to work ok.
as for the audio files not being in the audio folder, does this not effect the app?
It’s just when building it comes up with the errors
Problems were detected while exporting the design (See Details)
screen10.mobi: Widget(audio13) has no file specified
screen10.mobi: Widget(audio11) has no file specified
screen10.mobi: Widget(audio9) has no file specified
screen10.mobi: Widget(audio15) has no file specified
screen10.mobi: Widget(audio14) has no file specified
screen10.mobi: Widget(audio10) has no file specified
screen10.mobi: Widget(audio12) has no file specified
screen10.mobi: Widget(audio16) has no file specified
screen9.mobi: Widget(audio8) has no file specified
screen9.mobi: Widget(audio7) has no file specified
screen9.mobi: Widget(audio3) has no file specified
screen9.mobi: Widget(audio5) has no file specified
screen9.mobi: Widget(audio1) has no file specified
screen9.mobi: Widget(audio2) has no file specified
screen9.mobi: Widget(audio6) has no file specified
screen9.mobi: Widget(audio4) has no file specified
Can I just ignore this? as it all seems to work?
Thanks again for your helpJanuary 17, 2014 at 10:00 am #346159
Uplink1001MemberIt’s only a sound and video and info app
if I give you the latest build number would that be any good?
thanksJanuary 17, 2014 at 10:28 am #346162
support-octavioMemberHi Uplink1001,
>if I give you the latest build number would that be any good?
Yes, the build ID will work.January 17, 2014 at 11:03 am #346168
Uplink1001MemberHI.
The build id is: #51432073
awaiting your reply.
building for iOS only, would need to change almost all files names for android.THanks
January 17, 2014 at 2:15 pm #346174
Uplink1001MemberHI.
have done another build to sort out some other probs.
build number is #51022116Thanks
January 20, 2014 at 5:48 am #346216
Uplink1001MemberHi. Octavio
Anything to reply yet????Uplink1001
-
AuthorPosts
