Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. [SOLVED] Play ios default ringtone
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Play ios default ringtone

Scheduled Pinned Locked Moved Mobile and Embedded
7 Posts 2 Posters 5.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hasti66
    wrote on last edited by
    #1

    hi, I want to play and stop ios default rongtone programmatically in my ios application. I use qt5.4 in mac. Is there a objective_c native code to do that?
    I do not want to use AudioServicesPlaySystemSound(1003) , because "undocumented enum values", that means i should not use it on AppStore apps.
    thanks

    Hasti Ranjkesh

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      I didn't test it but shouldn't you use AudioServicesCreateSystemSoundID with e.g. /System/Library/Audio/UISounds/dtmf-0.caf (see "here":https://theiphonewiki.com/wiki//System/Library/Audio/UISounds )to get the id and then play it ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • H Offline
        H Offline
        hasti66
        wrote on last edited by
        #3

        Hi, thank you for replying
        I used this codes but nothing happens.
        @
        -(void) playRingtone
        {
        SystemSoundID soundID;
        NSURL *fileURL = [NSURL URLWithString:@"/System/Library/Audio/UISounds/dtmf-0.caf"];

        AudioServicesCreateSystemSoundID((__bridge_retained CFURLRef)fileURL , &soundID);
        AudioServicesPlaySystemSound(soundID);
        

        }
        @

        Hasti Ranjkesh

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          You should check that AudioServicesCreateSystemSoundID doesn't return an error

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • H Offline
            H Offline
            hasti66
            wrote on last edited by
            #5

            I used AVAudioPlayer and now i can play iphone 4s default sounds. But how can i find default ringtone (user selected ringtone)? In my device, default ringtone is "Opening" but "/System/Library/Audio/UISounds/Opening.caf" play nothings.

            Hasti Ranjkesh

            1 Reply Last reply
            0
            • H Offline
              H Offline
              hasti66
              wrote on last edited by
              #6

              I used this url: "/Library/Ringtones/Opening.m4r " and then played the ringtone with AVAudioPlayer. It works nice, but i want to know is it acceptable by app store? Because i want to add my application on apple app store.
              thanks

              Hasti Ranjkesh

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                That I don't know, you should read their documentation and try submitting. Worst case you have to do some rewrites and try again.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved