facebook

Reproduction of audio not work in iPhone: CLOSED

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

    BryanBudelon
    Member

    Hi guys.

    I’m developing app of radio. But he work only in Android.
    Problem: Clicked in button ‘Play’ e nothing happens, but in Android the audio starts.

    Code:

    
    phoneui.documentReadyHandler = function() {
        initAudio();
    }
    
    function initAudio(){
        audio = new Audio();
           audio.src = 'http://audio.tupa.am.br:9986/;';
    }
    
    
    function playAudio() {
        if($("#m1-Sobral-Play").attr("src") == "images/play.png"){
            $("#m1-Sobral-Play").attr("src","images/pause.png");
            audio.play();
        }
        else if($("#m1-Sobral-Play").attr("src") == "images/pause.png"){
            $("#m1-Sobral-Play").attr("src","images/play.png");
        audio.pause();
        }
    }
    

    On button of ‘Play’ have: playAudio();

    And yes, the streaming works.

    – thanks for listening! 😀

    #346005 Reply

    Brandon
    Member

    Which version of Mobione are you using?
    Is this with the new Audio API?

    #346012 Reply

    BryanBudelon
    Member

    > Which version of Mobione are you using?
    I’m using 2.6.1

    > Is this with the new Audio API?
    No got it exactly question.

    #346025 Reply

    Hi Bryan,

    Are you developing a native app or webapp? Can you share details about your iOS device? (model and OS)

    We tested your audio stream url in the audio player with no issues in a native ios app. You should use the new api that you can find here: http://www.genuitec.com/mobile/docs/audioWidgetAPI/audioWidgetAPI.html

    #346045 Reply

    BryanBudelon
    Member

    -> Are you developing a native app or webapp? Can you share details about your iOS device? (model and OS)
    Native.
    Model: iPhone 4
    OS: iOS 7.0.4

    I tried to different.

    Put widget of audio and changed the code,

    function playAudio() {
        var audio = AudioPlayerWidget.fromWidget( $('[id$=Player-container]') );
      if($("#m1-Sobral-Play").attr("src") == "images/play.png"){
            $("#m1-Sobral-Play").attr("src","images/pause.png");
        audio.play();
        audio.release();
        }
        else if($("#m1-Sobral-Play").attr("src") == "images/pause.png"){
            $("#m1-Sobral-Play").attr("src","images/play.png");
        audio.pause();
        }
    }
    

    But yet continues the problem.

    #346092 Reply

    BryanBudelon
    Member

    Someone?

    #346114 Reply

    Brandon
    Member

    Your original code:

    phoneui.documentReadyHandler = function() {
       initAudio();
    }
    
    function initAudio(){
       audio = new Audio();
          audio.src = 'http://audio.tupa.am.br:9986/;';
    }
    
    
    function playAudio() {
       if($("#m1-Sobral-Play").attr("src") == "images/play.png"){
          $("#m1-Sobral-Play").attr("src","images/pause.png");
          audio.play();
       }
       else if($("#m1-Sobral-Play").attr("src") == "images/pause.png"){
          $("#m1-Sobral-Play").attr("src","images/play.png");
        audio.pause();
       }
    }

    THis line: audio.src = ‘http://audio.tupa.am.br:9986/;’;
    the first ; should not be there: audio.src = ‘http://audio.tupa.am.br:9986/’;

    see if that helps.

    #346123 Reply

    Hi Bryan,

    Looks like you are mixing snippets from the Audio Widget API doc. audio.release(); destroys the player and won’t be possible to play audio. Also, This method is for case when user creates media object programmatically.

    I would suggest you to take a look closely at this section of previous doc, which should meet your requirement: http://www.genuitec.com/mobile/docs/audioWidgetAPI/audioWidgetAPI.html#player_with_no_ui

    Also, the example project should be helpful:
    http://www.genuitec.com/mobile/docs/audioWidgetAPI/audioWidgetAPI.html#example

    Let us know if you need further assistance.

    #346259 Reply

    BryanBudelon
    Member

    The problem has been solved. The problem was in configuration the audio of iPhone.

    Thanks all! 😀

Viewing 9 posts - 1 through 9 (of 9 total)
Reply To: Reproduction of audio not work in iPhone: CLOSED

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