facebook

Questions about *_custom.js file

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #327623 Reply

    californiadeveloper
    Participant

    I also would like to have some audio play once a certain button is clicked. However, I would like it to be a different sound file for each of the many different screens I have in my app. I have reviewed the various sound demos on this site and I still have a few questions:

    1) Where do I store the sound files so that I can test them and also have them be built as part of the app?

    2) If I put the audio playing code in my *_custom.js file, how does that control the audio I want for the other screens in the app?

    3) What do I do after the code has been put in the *_custom.js file? Do I need to re-generate any files?

    4) If I make design changes later, will I need to re-add in the programming edits to my *_custom.js file again?

    #327624 Reply

    californiadeveloper
    Participant

    I also would like to attach a sound effect to a change screen button. However, I would like it to be a different sound file for each of the many different screens I have in my app. I have reviewed the various sound demos on this site and I still have a few questions:

    1) Where do I store the sound files so that I can test them and also have them be built as part of the app?

    2) If I put the audio playing code in my *_custom.js file, how does that control the audio I want for the other screens in the app?

    3) What do I do after the code has been put in the *_custom.js file? Do I need to re-generate any files?

    4) If I make design changes later, will I need to re-add in the programming edits to my *_custom.js file again?

    #327646 Reply

    Hi californiadeveloper,

    1) Where do I store the sound files so that I can test them and also have them be built as part of the app?
    You should copy your aditional resources to your *-www project directory after you generated the files for it.

    2) If I put the audio playing code in my *_custom.js file, how does that control the audio I want for the other screens in the app?
    I’m not exactly sure about this question, can you give me more details?

    3) What do I do after the code has been put in the *_custom.js file? Do I need to re-generate any files?
    Your *_custom.js file is not overwritten after generation of files, thus if you didn’t changes to your design, you don’t need to re-generate the files.

    4) If I make design changes later, will I need to re-add in the programming edits to my *_custom.js file again?
    No, you don’t. The reason is the same that answer in #3.

    #327648 Reply

    californiadeveloper
    Participant

    Thank you very much for your speedy reply. To clarify my question of #2 below. I understand that I need to create (or copy from your audio player sample) some code and that I will include it in my *_custom.js file.

    Looking at your sample, I’m assuming the code will be or look something like:

    $(‘#audio_1’).attr(‘src’,audioUrl);

    My question has to do with the fact that I want a different audio file to play when the user advances from screen to screen. So when the user advances from the home page to the first page, I want audio_1 to play. When the user advances from the first page to the second page, I want audio_2 to play. And so on. I need help understanding how to get the different files to play for each of the different screens given that the processing all occurs in one *_custom.js file and not in separate files (one for each screen).

    #327938 Reply

    Hi

    As you can see in the audio_play function in the Multi-Source Audio Player Demo UPDATED it first change the audio source and then go to other screen.

    function audio_play(audioUrl, posterUrl) {
      audio_init(); //nop if already inited
    
      //load audio stream
      $('#audio_1').attr('src',audioUrl);
      // ...
      //show the player page
      phoneui.gotoPage('m1-player',null);
    }

    You should program a similar function that change the audio source with this line:

    $('#audio_1').attr('src',audioUrl);

    And then go to the screen with:

    phoneui.gotoPage('m1-player',null);

    You can use various functions and assign them to the action of every button or call the same function that receives parameters and use the conditional statements if .. else, else if to control what audio source load and what will be the target screen.

    #328355 Reply

    californiadeveloper
    Participant

    Thank you very much.

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: Questions about *_custom.js file

You must be logged in to post in the forum log in