D
Deleted member 103
Guest
Hi,
how can I create a list of all default ringtones?
how can I create a list of all default ringtones?
Tap on the blank page and the mediapicker will appear.
I think that you can pass the URL received from the class to https://www.b4x.com/android/forum/t...playback-rate-pitch-change.78004/#post-494451) and play.
not tested but it should work
narek
try to add thisTap on the blank page and the mediapicker will appear.
I think that you can pass the URL received from the class to https://www.b4x.com/android/forum/t...playback-rate-pitch-change.78004/#post-494451) and play.
not tested but it should work
narek
#PlistExtra:<key>NSMediaLibraryUsageDescription</key><string>description here...</string>
try to add this
B4X:#PlistExtra:<key>NSMediaLibraryUsageDescription</key><string>description here...</string>
did you try to play the file directly?
No because I'm using Erel's inline obj c code and I know nothing about obj c, so I'm not able change it
It would be great if you or anyone can help me on it !
Sub mm_loaded(URL As String)
PlaySound(URL, "", 1000, 0.5)
End Sub
try this
B4X:Sub mm_loaded(URL As String) PlaySound(URL, "", 1000, 0.5) End Sub
Application_Start
Application_Active
Canceled
ipod-library://item/item.mp3?id=137345610065094538
Error occurred on line: 54 (Main)
required condition is false: file != nil
Stack Trace: (
CoreFoundation <redacted> + 154
libobjc.A.dylib objc_exception_throw + 38
CoreFoundation <redacted> + 0
AVFAudio <redacted> + 64
AVFAudio <redacted> + 178
SoundPitch -[b4i_main playSound::::] + 842
CoreFoundation <redacted> + 68
CoreFoundation <redacted> + 294
SoundPitch +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1784
SoundPitch -[B4INativeObject RunMethod::] + 158
SoundPitch -[b4i_main _playsound::::] + 1908
SoundPitch -[b4i_main _mm_loaded:] + 1086
CoreFoundation <redacted> + 68
CoreFoundation <redacted> + 294
SoundPitch +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1784
SoundPitch -[B4IShell runMethod:] + 574
SoundPitch -[B4IShell raiseEventImpl:method:args::] + 2212
SoundPitch -[B4IShellBI raiseEvent:event:params:] + 1442
SoundPitch -[B4ICommon CallSub4::::] + 332
SoundPitch -[B4ICommon CallSub2::::] + 250
SoundPitch -[b4i_mediapicker _audio_loaded::] + 1058
CoreFoundation <redacted> + 68
CoreFoundation <redacted> + 294
SoundPitch +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1784
SoundPitch -[B4IShell runMethod:] + 574
SoundPitch -[B4IShell raiseEventImpl:method:args::] + 2212
SoundPitch -[B4IShellBI raiseEvent:event:params:] + 1442
SoundPitch -[b4i_mediapicker mediaPicker:didPickMediaItems:] + 552
MediaPlayer <redacted> + 142
MediaPlayer <redacted> + 52
CoreFoundation <redacted> + 68
CoreFoundation <redacted> + 294
FrontBoardServices <redacted> + 18
FrontBoardServices <redacted> + 220
FrontBoardServices <redacted> + 44
CoreFoundation <redacted> + 12
CoreFoundation <redacted> + 438
CoreFoundation <redacted> + 762
CoreFoundation CFRunLoopRunSpecific + 486
CoreFoundation CFRunLoopRunInMode + 104
GraphicsServices GSEventRunModal + 156
UIKit <redacted> + 574
UIKit UIApplicationMain + 150
SoundPitch main + 106
libdyld.dylib <redacted> + 2
)
This?
PlaySound("", URL, 1000, 0.5)
Sub PlaySound(Dir As String, FileName As String, Pitch As Int, rate As Double)
Dim no As NativeObject = Me
no.RunMethod("playSound::::", Array(File.Combine(Dir, FileName), Pitch, rate, engine))
End Sub
#if OBJC
#import <AVFoundation/AVFoundation.h>
- (void) playSound: (NSString*) Path :(int)Pitch :(double)Rate :(AVAudioEngine*) engine{
AVAudioFile* File = [[AVAudioFile alloc] initForReading: [NSURL fileURLWithPath: Path] error: nil];
AVAudioPlayerNode* node = [AVAudioPlayerNode new];
[node stop];
[engine stop];
[engine reset];
[engine attachNode: node];
AVAudioUnitTimePitch* changeAudioUnitTime = [AVAudioUnitTimePitch new];
changeAudioUnitTime.rate = Rate;
changeAudioUnitTime.pitch = Pitch;
[engine attachNode: changeAudioUnitTime];
[engine connect:node to: changeAudioUnitTime format: nil];
[engine connect:changeAudioUnitTime to: engine.outputNode format:nil];
[node scheduleFile:File atTime: nil completionHandler: nil];
[engine startAndReturnError: nil];
[node play];
}
#End If