Giter VIP home page Giter VIP logo

aplay's Introduction

APlay

A Better(Maybe) iOS Audio Stream & Play Swift Framework

Usage

import APlay
...
let url = URL(string: "path/to/audio/resource")!
let player = APlay()
player.eventPipeline.delegate(to: self, with: { (target, event) in
    //  event handling
})
player.play(url)
...

⚠️⚠️⚠️ Known issue

This project can only run in DEBUG mode,cause optimization mode will pause the decode loop.

if install with CocoaPods, add this block of code in your podfile

post_install do |installer|
 installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            swiftPods = ['APlay']
            if swiftPods.include?(target.name)
                config.build_settings['SWIFT_OPTIMIZATION_LEVEL'] =  '-Onone'
            end
        end
    end
end

Docs

Run ./generate_docs.sh

Features

  • CPU-friendly design to avoid excessive peaks

  • Support seek on WAVE, and FLAC(with seektable)

  • Support all type of audio format(MP3, WAVE, FLAC, etc...) that iOS already support(Not fully tested)

  • Digest(Tested), Basic(not tested) proxy support

  • Multiple protocols supported: ShoutCast, standard HTTP, local files

  • Prepared for tough network conditions: restart on failures,restart on not full content streamed when end of stream

  • Metadata support: ShoutCast metadata, ID3V1, ID3v1.1, ID3v2.2, ID3v2.3, ID3v2.4, FLAC metadata

  • Local disk storing: user can add folders for local resource loading

  • Playback can start immediately without needing to wait for buffering

  • Support cached the stream contents to a file

  • Custom logging module and logging into file supported

  • Open protocols to support customizing. AudioDecoderCompatible, ConfigurationCompatible, LoggerCompatible...

Installation

Carthage github "CodeEagle/APlay"

CocoaPods pod 'APlay'

Todo

  • Airplay2 support(Maybe not)
  • AudioEffectUint support

License

License

Contact

Github, Twitter

aplay's People

Contributors

codeeagle 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

aplay's Issues

Try to avoid assumingMemoryBound.

It looks like you meant to delete this line since the memory is allocated above:
baseAddress = malloc(Int(count))?.assumingMemoryBound(to: Byte.self)

Also, you can just use p =UnsafePointer<UInt8>.allocate; p.initialize(repeating:count:) if you want to initialize the memory with UInt8.

Can't play music

Music cannot be played after the project is packaged, so it can be played through direct debugging with the mobile phone

EXC_BAD_INSTRUCTION ( seeking )

var dataOffset = percentage * Float(_streamer.contentLength - _decoder.info.metadataSize)

It happens a lot, when trying to seek to position.

eg. Seek to position (199.35248) while the duration is (233)

Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)

Screen Shot 2019-04-22 at 3 15 15 PM

BR.

wrong list when (random mode)

I expect the list of urls will update when set loop mode to (random), if i tried to get current playing url by using playingIndex at list array it will returns the original one.

can't play opus file

it's playing m4a, mp3 file but not opus and flac even though I have seen cases of opus and flac in this lib

Preloading - Feature Request

Hi, we're really keen to use this library after having run into crash issues with another one we're using.

The big feature that's missing for us is pre-loading... We take users to a "track" screen (at which point we'd love to be able to start pre-loading the track ahead of the user actually pressing the "play" button).

Any chance this could be added / it would make a fantastic addition to what is already a great library.

play audio as soon as data available

hi is this library supports playing audio while the file not yet downloaded completely? I want to play audio file as soon as user taps on audio and the player screen starts - usually avplayer waits for audio file to download completely then starts playing is this fixed here?

Can't play m4a

https://rongcloud-file.cn.ronghub.com/application_octet-stream__RC-2019-03-20_1628_1553058559816?attname=2019.03.19-%E5%BE%AE%E8%84%89%E5%AE%98%E6%96%B9%E4%BD%93%E9%AA%8C%E7%BE%A4.m4a&e=2147483647&token=CddrKW5AbOMQaDRwc3ReDNvo3-sL_SO1fSUBKV3H:LBx576B-7bhU3b-MesGIlPfHQbw=
this url can't play, always print 🐛 [Debug] reading empty data back, try to reopen

Not able to get full metadata

Hello,

I want full metadata for FLAC file for that I have used this but when I get metadata response at that time only 3 parameters received in response not fully metadata received using this.

Only TITLE, YEARS AND TRACK received.

Can you please help me out for this?

(random mode) always plays first track

Hi, sorry i'm bothering you with these issues 😅

when set loop mode to random and call player.play(urls: [URL]), it always play the first one in original array, then call next and it will play shuffled tracks

APlay.State.buffering - Feature Request

It appears the APlay.State's available currently are: idle, playing, paused, error and unknown.

It would be great if we could get a "buffering" and/or "retrying to connect" state so as to allow the UI feedback to the user when loading is occurring / still being attempted.

Failed to get flac artwork

Thanks for this amazing lib !

I am trying to load image from the in app document flac music,
but i get nothing from it, however i am not sure if i am using it correctly:

let a = APlay()
a.play("local_document_path/lullaby set.flac")
print(a.metadatas)

// output 
[APlay.MetadataParser.Item.year("2009"), APlay.MetadataParser.Item.album("Music From Braid"), APlay.MetadataParser.Item.track("03"), APlay.MetadataParser.Item.title("Lullaby Set"), APlay.MetadataParser.Item.artist("Kammen & Swan"), APlay.MetadataParser.Item.genre("Folk, World, & Country/Stage & Screen/Soundtrack")]

or in this case i need to implement my own configuration with flac parser ?

Shuffle & Repeat behavior

Let's say i want to play tracks in shuffle mode with repeat once for specific track, so if i set on random mode, i can't repeat track.

It's there any solution to avoid this situation?

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.