Giter Club home page Giter Club logo

audiostreaming's People

Contributors

dimitris-c avatar junyaninflection avatar mushthak avatar newbdez33 avatar rex4539 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

audiostreaming's Issues

player buffer

When internet connection is unstable, the sound of the stream isn’t available. Looks like this player hasn’t a buffer. For example, the avplayer plays stream for 10 seconds if the internet connection has been lost

AudioStreaming not on Cocoapod

Adding pod 'AudioStreaming' to the Podfile does not work because AudioStreaming does not exist on Cocoapod.
Am I missing something?

No forwarding while streaming

Hi,

I'm just exploring this great framework for some audio streaming and noticed that the audio does not play after I have manually scrolled the progress handle to skip half the audio. It stays paused in the example app.

Hope there's a fix for this :)

Thanks,
Usman

Buffering

how can get downloaded buffer to display on slider

Playing local music from library

Is there any way to play local music from libray? this audio file's url looks like:
ipod-library://item/item.mp3?id=626678501701109259\

But it shows this error:

Error Domain=NSURLErrorDomain Code=-1002 "unsupported URL" UserInfo={NSLocalizedDescription=unsupported URL, NSErrorFailingURLStringKey=ipod-library://item/item.mp3?id=626678501701109259, NSErrorFailingURLKey=ipod-library://item/item.mp3?id=626678501701109259, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDataTask .<45>"

Can anyone help?

Playing an url and then queueing others will remove some of the queued urls

let player = AudioPlayer()
player.play(url: URL(string: "https://your-remote-url/to/audio-file.mp3")!)
player.queue(urls: [
    URL(string: "https://your-remote-url/to/audio-file.mp3")!,
    URL(string: "https://your-remote-url/to/audio-file.mp3")!
])

the

sourceQueue.async { [weak self] in
            guard let self = self else { return }
            self.processSource()
        }

from the play() method will call the processSource() which will clear the queue after it was populated.
My assumption being that the first lines of code are correct and the queueing of the URLs should be called after the play method which starts the audio engine if needed.

Playing USB device audio stream

Hello and thank you for your great job.
I was wandering if your library can be used to play a constant audio stream coming from a connected USB device, an FM Radio with 2 channels.
I' trying to "update" an old application I made more than 10 years ago, ie developed on Mac which I know it is not supported (hoping yet) by your lib, but I'm stack in the old way of playback the stream coming from the device which after sometimes get corrupted or crashes the app. Even if it is compiling OK in Xcode 15.
I did use the tools and frameworks available at that time (but mostly swift code beside just the streaming written in C++...)

Thanx

[Feature Request] Streaming M3U links support

I'm using this library for a radio streaming app and a lot of links are m3u audio streams that I can open no problem in Safari on iOS, but aren't compatible with this library.

Any chance for this feature being added?

Here's an example m3u link that works in Safari on iOS: link

Frame filter buffer size

Hi,

May I ask you why the size of the buffer received in the call back of FilterEntry is so large (mDataByteSyze)? (17640 instead of 2048 for StreamingKit). This decreases the performance (speed) of the frequency analyzer I am using.

So the refresh of my VU-Meter view is too slow.

Maybe I'm missing something?

Thanks.

Audio Progress Update

HI, how much work would it take to add an @published value to update the progress as the track plays on.
Or does this currently exist?

seek failed

Hello!
seek function is unstable
crashes very often

2023-04-16 14:09:40.989409+0300 uPlayer[33449:10807909] [audio.streaming.generic] seek failed (
"The amount of data provided to the parser was insufficient to produce any result."
)
2023-04-16 14:09:40.989562+0300 uPlayer[33449:10807909] [SwiftUI] Invalid frame dimension (negative or non-finite).

Latest version on Cocoapods?

Hello!

It looks like the last tagged version on Cocoapods is 0.9.0, given we're now on 1.2.x would it be possible to update it?

Thank you!

Seeking to 0 on local mp3s begins playback from ~4 seconds into the audio

Hi there, there seems to be an issue with local audio playback when attempting to seek to 0 seconds. When doing this the audio starts playing from ~4 seconds into the track. This does not affect streamed audio in the same way for some reason.

You can recreate this by:

  • Launching the AudioExample app
  • Playing Jazzy Frenchy
  • Wait some amount of time
  • Drag the progress thumb back to the start
  • Note the audio does not play from the start of the track

Paused audio plays for a short time before starts playing new audio

First of all, thank you for this library. It really did help me starting playing audios faster than using Apple's out-of-the-box solution.

But, I've just noticed an issue, not sure if that's something on my side. When an audio is paused, then another audio is set to be played, the previous audio starts playing for a faction of a second then the new audio starts playing.

I was in a hurry, so after some trial and error, I figured that stopping the player and changing the play(url: URL, headers: [String: String]) method in AudioPlayer to the following did the trick , but that's not a perfect solution for sure.

    public func play(url: URL, headers: [String: String]) {
        let audioEntry = entryProvider.provideAudioEntry(url: url, headers: headers)
        audioEntry.delegate = self
        
        checkRenderWaitingAndNotifyIfNeeded()
        sourceQueue.async { [weak self] in
            guard let self = self else { return }
            
            clearQueue()
            entriesQueue.enqueue(item: audioEntry, type: .upcoming)
            playerContext.setInternalState(to: .pendingNext)
            do {
                try self.startEngineIfNeeded()
            } catch {
                self.raiseUnexpected(error: .audioSystemError(.engineFailure))
            }
            self.processSource()
        }
    }

Thank you again and I'd appreciate your feedback to this issue.

No sound

Hi! I-m trying this lib, using swift 5, xcode 12.5.1

@IBAction func onPlay(_ sender: Any) {
        do {
            try AVAudioSession.sharedInstance().setCategory(.playback, mode: .default, options: [])
            try AVAudioSession.sharedInstance().setActive(true)
        } catch {
            print("Setting category to AVAudioSessionCategoryPlayback failed.")
        }
        let player = AudioPlayer()
        player.play(url: URL(string: "https://www.kozco.com/tech/piano2-CoolEdit.mp3")!)
    }

this not works. I can't hear anything.

Do I need some permission. or something like that?

Also I have this in my info.plist

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>
<key>UIBackgroundModes</key>
<array>
    <string>audio</string>
</array>

I received this in the log

[audio.streaming.generic] audio file stream not opened

[Help] Gapless Playback

Hi, I am currently evaluating different audio libraries to add gapless playback to my Ampache/Subsonic App: Amperfy
I integrated AudioStream and I am able to play songs with it.
I am still noticing a small gap between songs.
The engine is used with default configuration. The first song is played via player.play(url: url). 10 seconds before the currently playing song is finished I queue the next song via player.queue(url: url).
Do I need to adjust/configure something get a true gapless playback?

Audio Plot Request

Hi,

What about an audio plot graph?

Is it possible? It would be extra!

Cheers,

We want to play m4a file but from two different button with different audio file having m4a format.

let filePath1 =     "/var....myFile1.m4a"  // local audio file URL with m4a extension
let filePath2 =     "/var....myFile2.m4a" // local audio file URL with m4a extension

let player = AudioPlayer()  // Player initialisation
 
@IBAction func buttonOneClick(_ sender: Any) {
            player.play(url: URL(fileURLWithPath: filePath1))      
    }

 @IBAction func buttonTwoClick(_ sender: Any) {
            player.play(url: URL(fileURLWithPath: filePath2))      
    }

Scenario : When I played on buttonOneClick then player working fine and after completing first audio then click on buttonTwoClick then getting below error.

Xcode console throwing this error while playing second music :
Error: (
"Couldn't parse the bytes from the stream. Status: It is not possible to produce output packets because the\nstreamed audio file's packet table or other defining information is not present or appears after the audio data."
)

We want to play m4a file but from two different button with different audio file having m4a format.
Could you please assist here?

Originally posted by @appDeveloper7 in #41 (comment)

Allow playing back from a specific TimeInterval

First of all - thank you so much for this library! It's really helpful in the project I'm working at right now.

I noticed that the API for AudioPlayer has separate play(url:) and seek(to:) methods. I would love to be able to merge these two and ask the AudioPlayer to start playing back the item at a specific location. (i.e. play(url:at:))

When I tried to simulate this behavior by calling play and seek in a sequential order, the seek command seemed to be ignored, unless I delay it slightly via DispatchQueue. I assume it's due to the time it takes for the item to enter audioPlayingEntry.

How would you go about implementing playback at a specific time interval? Happy to look into this and try to make a PR out of it, but would appreciate some guidance! :)

Remove from queue

Thanks for this project it looks really promising! I want to use this for my audio playback application, but while it is possible to enqueue tracks it is not possible, at least using the public api, to dequeue them. Making this part of the public api would be great

Memory used is constantly increasing when playing podcasts

We noticed this issue on our application but also in the example in GitHub. Trying to play "Swift by Sundell" podcast and then again "Swift by Sundell" the memory used is constantly increasing. It seems that the allocated memory (200MB for this audio item) is not released. This behaviour does not affect live streaming audio like radio stations.

MPMediaItem witch assetURL

Hello!

how to play files MPMediaItem witch assetURL ?
for example:
assetURL = Optional(ipod-library://item/item.m4a?id=6247563662587856568)

the framework tries to look for something on the network.
the file is not played.

The Player keeps buffering forever when interrupted by a phone call

We noticed this behavior using the 0.5.0 version. The scenario is that the Player is playing a radio stream and the device is getting a phone call. Using the AVAudioSession.interruptionNotification we are able to pause the Player. When the call ends we resume the Player. When the call's duration exceeds 60 secs the Player resumes playing for a couple of seconds and then falls in a "buffering" state forever.
Calls with a duration of fewer than 60 secs are handled properly and the player resumes playing as expected.
Do you think this is normal behaviour or do we need to handle in a different way the above situation?

Queued playlist only play few items then stoped. hardly play to end.

It is almost 100% reproduced if there are many queued mp3 urls in queue.
I created a repo for this issue.

https://github.com/newbdez33/AudioStreamingBug

The basic code is queue all playlist items to player.queue()

for item in playlist {
            if let url = URL(string: item) {
                print("queue:\(url)")
                player.queue(url: url)
            }
}

Sometimes it plays 2 or 3 items then stoped.
Tested main branch in iOS 14.2 Simulator and iPhone 7. (Xcode 12.2 and Xcode 12.3)

audioPlayerDidFinishPlaying stopReason is none not eof

After the playback of the remote file ends, in

    func audioPlayerDidFinishPlaying(player: AudioStreaming.AudioPlayer,
                                     entryId: AudioStreaming.AudioEntryId,
                                     stopReason: AudioStreaming.AudioPlayerStopReason,
                                     progress: Double,
                                     duration: Double)

i get

stopReason == .none

not .eof

i drilled down why this happens and its because the atomic writing block for stopReason is executed after the delegate callback, despite the atomic operation is requested earlier

iOS16

I want to play from different local file from two different button using single player object.

let filePath1 =     "/var...."
let filePath2 =     "/var...."

@IBAction func buttonOneClick(_ sender: Any) {
            player.play(url: URL(fileURLWithPath: filePath1))      
    }

 @IBAction func buttonTwoClick(_ sender: Any) {
            player.play(url: URL(fileURLWithPath: filePath2))      
    }

Xcode console throwing this error while playing second music :
Error: (
"Couldn't parse the bytes from the stream. Status: It is not possible to produce output packets because the\nstreamed audio file's packet table or other defining information is not present or appears after the audio data."
)

AudioPlayerDelegate.audioPlayerDidStartPlaying entryId loss

Hello, I found a issue when using the framework.

When I want to use audioPlayerDidStartPlaying(player:with:) in AudioPlayerDelegate to get the currently playing audio, I can't get the correct entry.

Current playing entry is nextEntry,

image

I don't know whether it was deliberately done. If so, how can I operate it better?

Look forward to your reply.

Streaming podcast mp3 problem.

Thanks @dimitris-c for this great project.
When you start playing for a while(example project), it will suddenly speed up extremely fast.
Then it will loop a small piece of audio (a few seconds).
You may try to play a full podcast audio, It happens 100% chance.

I'm using iOS 14.2, Xcode 12.2

Volume setting

Hey!

First of all, thank you for this neat library. It drives my SwiftUI radio app. The audio streaming and ICY metadata parsing works perfectly well.

There is just one thing: Is it possible to have the player.volume setting of the AudioStreaming engine linked to the iOS volume?

Loading audio but not autoplaying

Hey, thanks for the great library!

I have a use case where I need to load the audio file, for example to get the duration displaying but not autoplay. I was digging around the code but couldn't see any obvious way to do this apart from play then instantly pause?

Do not deactivate the current audio session on instantiating

When instantiating AudioPlayer() , the currently activated AVAudioSession is deactivated. So, when starting the app, it stops the playback from other apps. This is not how apps like Apple Music or Podcasts behave.

Please have AudioPlayer() not close the current Audio-Sessions during initialization, so that one can instead activate it before calling the play() command.

Feature request: Audio Looping

Would love to see the feature where I can loop the given audio indefinitely. Most audio players offers this feature, including AVPlayer, AVAudioPlayer from Apple, and ExoPlayer from Google.

Feature request - Built-in equalizer

Hi, first off, I wanted to applaud you on this project ... this is a really awesome concept that would be useful to many !

One suggestion - I know that you have provided an easy hook to attach audio nodes, but it would be great if you could include a built-in equalizer that is easy for clients to manipulate, so that clients don't have to deal with the complexity of configuring an AVAudioUnitEQ node themselves.

You could provide an ISO standard 10-band EQ out of the box, which would be the most common type of EQ.

Ideally, clients would use it as follows:

let player = AudioPlayer()

// Activate the EQ.
player.eqBypass = false

// Set global gain to +5.0 dB
player.eqGlobalGain = 5.0

// Set the gain of the 3rd band to +7 dB.
player.setEQBand(2, to: 7.0)

// Get the gain of the 4th band.
let fourthBandGain = player.getEQBand(3)

// Set all EQ band gains.
player.eqBands = [0.0, 2.5, 5.5, 7.5, 5.0, ...]

// Get all EQ band gains.
print("EQ bands are currently set to: \(player.eqBands)")

Mixing Multiple Audios Simultaneously

Hello,

I want my app to be able to play multiple audio URLs simultaneously. Could you please provide guidance or hints on how I can achieve this? Any assistance would be greatly appreciated.

Thank you!

Can't play audio

I got this error while playing an audio. This audio recorded from samsung mobile.
"Couldn't parse the bytes from the stream. Status: The file is malformed, not a valid instance of an audio file of its type, or not recognized as an audio file."

Note: But this same audio is playing well in avplayer and safari browser also.

Feature Request | Ability to add frame filtering to allow recording, monitoring and observation of audio

Hello,

The project promises to be awesome! Bravo!

This is not an issue as I have not tested yet in one of my projects, but a question.

The main question is:

How to achieve this (from streamingKit), as your framework is not yet documented:

audioPlayer.appendFrameFilter(withName: "CustomEQFilter") { (channelsPerFrame, bytesPerFrame, frameCount, frames) in
// Here I update my VU-Meter class for display.
}

Thanks,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.