facebook

Demo – Background Audio (web & native apps)

  1. MobiOne Archive
  2.  > 
  3. Examples, HOW-TOs
Viewing 15 posts - 1 through 15 (of 21 total)
  • Author
    Posts
  • #320175 Reply

    support-michael
    Keymaster

    This message has not been recovered.

    Attachments:
    You must be logged in to view attached files.
    #320222 Reply

    nivar
    Member

    This message has not been recovered.

    #320464 Reply

    Ichbins3000
    Member

    This message has not been recovered.

    #321812 Reply

    julietfu
    Member

    This message has not been recovered.

    #322877 Reply

    support-michael
    Keymaster

    This message has not been recovered.

    #329990 Reply

    Hi, I stucked at the very beginnig : )
    audio = new Audio();
    This line throws an exception for me:
    Result of expression ‘Audio'[undefined] is not a constructor.
    What do I miss or what do I need?
    Thanks a lot.

    #330016 Reply

    Hi miklos,

    Probably your custom.js file is goofed up for a little mistake. Could you share it with us? If you can’t attach your file, please send it via support at genuitec dot com, use title: mobione data from miklos

    Also, what MobiOne version are you using? Since 2.1 it includes an audio widget that make easier to implement audio in your apps.

    #336614 Reply

    fordca
    Member

    Hi Wayne or Octavio,

    I have been able to successfully have one of my clicked buttons play audio when pushed on the ipad2 but when I transition onto another page the clicked button does not work even though the code is the same but I just change the mp3 file name.

    Is it only possible to have one button play audio or can each button play audio if correct codes are written. I am following the codes provided earlier from this post but I don’t understand why only one clicked button works.

    If you could provide an example of having two different pages that will play audio when clicked that would be great.

    Also is there a new release of version 2.3.2 or 2.4 in the future sometime soon relating to the audio bug issues that I have expressed earlier on.

    Thanks.

    #336687 Reply

    ghaurigee
    Member

    Hi support-octavio,
    i just buy mobione 2.3.1. i am trying to make mp3 book or list. i want to click on one of list item and play it in audio widget. but i dont know how to create the list. could you please help me. thanks in advance

    #341515 Reply

    please can you tell me how to do to include the mp3 file in the local url?
    not get it to work, I tried to create a folder and put audio/myfile.mp3 src:

    audio.src = ‘audio/myfile.mp3’; not work

    audio.src = ‘../audio/myfile.mp3’; not work

    however, on a remote server url if it works, what am I doing wrong?

    audio.src = http://www.xxxxxx.com//audio/myfile.mp3 ‘; work fine

    A help would be very grateful

    #341517 Reply

    Hi francishift,

    Question: did you create your audio folder in the same folder that your .mobi file is located or did you create it in the <project>-www folder? If did it on first one, please try adding your audio(with the audio file) folder into the <project>-www folder. Let us know how it goes.

    #341621 Reply

    Sorry, had bad routes

    #345691 Reply

    hichnaj
    Member

    I used this script, is nice, but I have 2 problems:

    1. the audiostream doesn’t load immediately and sometimes won’t even work.

    2. Is there a way to use 2 images for the button. One button image and one active image

    Can you reply fast, because I need to finish the project fast

    #345705 Reply

    support-michael
    Keymaster

    @hichnaj

    Please share what device(s) and os version(s) you are testing on? Also for streaming audio can you provide a url in case we dig into the stream format and delivery performance?

    >1. the audiostream doesn’t load immediately and sometimes won’t even work.

    Our experience with intermittent streaming issues such as not loading/playing immediately is frequently a result of network latency or stream is not available. There could be other issues such as the api/device level functionality issue but in the majority of cases we have investigated it was a garbage-in situation where either no audio was streamed or it was totally corrupted.

    >2. Is there a way to use 2 images for the button. One button image and one active image

    Have you looked at the ImageButton widget? It includes properties for the normal mode image and an active mode image.

    #345706 Reply

    hichnaj
    Member

    hi,

    thanx for the reply.

    the device is Samsung galaxy s4 and os is android. We had also tried on a htc one. Same problem. Can you check the code I use.

    here is the code I use:

    /**
     * Notification that the UI is about to transition to a new screen.
     * Perform custom prescreen-transition logic here.
     * @param {String} currentScreenId 
     * @param {String} targetScreenId 
     * @returns {boolean} true to continue transtion; false to halt transition
     */
    phoneui.prePageTransition = function(currentScreenId, targetScreenId) {
      // add custom pre-transition code here
      // return false to terminate transition
      return true;
    }
    
    /**
     * Notification that the UI has transitioned to a new screen.
     * 
     * @param {String} newScreenId 
     */
    phoneui.postPageTransition = function(newScreenId) {
      
    }
    
    /**
     * 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 device orientation has changed. 
     * 
     * @param {String} newOrientation 
     */
    phoneui.postOrientationChange = function(newOrientation) {
      
    }
    
    
    
    
    
    /**
     * Called when document is loaded.
     */
    phoneui.documentReadyHandler = function() {
    }
    
    //-----------------------------------------------------------
    
    /**
    * 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 = 'http://s1.voscast.com:8324/;stream.mp3';
    
    isPlaying = false;
    
    buttonId = '#m1-front-playstop-btn';
    $(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('Stop');
    audio.play();
    isPlaying = true;
    }
    
    //start playing, update button label to PLAY
    function stopAudio() {
    if (!audio || !isPlaying) return;
    
    $(buttonId).text('Play');
    audio.pause();
    isPlaying = false;
    }
    
    
Viewing 15 posts - 1 through 15 (of 21 total)
Reply To: Demo – Background Audio (web & native apps)

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