Stream audio on Mac - macos

I have been using AVAudioPlayer on the iPhone and iPad. I can't find anything that comes close on the Mac. Does anyone know where to find a library like that ?
What I want is a library that can stream songs from the internet so the user does not need to download the whole song.
NSSound can play songs from the internet but it does not stream, it just downloads the song and starts to play.

I know ffmpeg works on the Mac and supports streaming. As an added bonus, it works on Linux and Windows too.

Matt Gallagher has a series of articles on his website regarding this, streaming audio on the iPhone and on the Mac as well. He has this project posted on github as well.
It's pretty popular and I've personally used it on an iPhone project and it worked well. It comes with an included Mac sample project which also works well.

Related

How do I play an MP3 file using Lazarus on macOS

I'd like to be able to play an MP3 file programmatically, using Lazarus on macOS.
Lazarus 2.0 (fpc 3.0.4) on macOS is working great for me, but one thing I cannot manage to do is to play an MP3 file programmatically.
I managed to compile and run the OALSoundManager demo project, but only WAV files can be played that way.
I spent several hours following various leads from the freepascal forum, but I still could not manage to do the basic play operations:
Load an MP3 file
Start playing it.
Get the current playing position (e.g. during OnTimer).
Be notified when it stops.
I'm OK with using any common library. Of course the less dependencies the better.
Once I can play the file I can figure out the rest, but it would be great if the example also showed:
Start playing from a given time position
Pause/Restart
Thank you very much for any help!
You might be able to use Castle Engine and OpenAL.
You can install Castle Engine from with-in Lazarus. In the main menu under "Package" -> "Online Package Manager" you will be able to filter and install "castle".
Then you should be able to open the example project:
https://github.com/castle-engine/castle-engine/blob/master/examples/audio/alplay.lpr
Goodluck,

How to write into a MP4 container with Cocoa?

I need to export an MP4 file containing several streams of audio. There is no video at all at this point in time, though this might be requested sometimes in the future.
All this is on the Mac running a decently recent version of Mac OS X. QT Kit is not an option. Portability to iOS would be a bonus.
Where should I look? A very casual look at AV Foundation suggests this might be a way, but doesn't look simple at all.
Or should I rather look for a third party library? ffmpeg? mp4v2?
Thanks for any suggestion.

Playing background live-streaming audio

Can anybody give me a link to a working example of playing background live-streaming audio in Window Phone 7 (or 7.1)? I saw a lot of examples (in microsoft.com too) and noone of them works correctly for playing a background live-streaming audio.
FYI, here's an url of live-streaming audio http://radiozetmp3-02.eurozet.pl:8400/
Background audio is not supported on 7.0, only 7.1 (and above).
If you want to play streaming audio in a format/codec which is not natively supported by the phone you must do it with an AudioStreamingAgent. If it is a supported codec, you can use an AudioPlayerAgent (see sample here).
Using an AudioStreamingAgent is a nontrivial task and requires a deep understanding of the codec you need to play so you can convert it to something the phone understands. I know of one person who did this, for a H.264 stream, and it took a long time and much hair pulling to get it working. And before anyone asks: No, they are not able to share code from that project.
If you really must go down this route, the ManagedMediaHelpers (previously here) are a good place to start, but yes, they don't cover all codecs and this is, potentially, very complicated and not something well documented on the web.

live Video streamming

Can any one tell me how to stream video using mac osX , i need to write an application in mac os for video conferencing please let me know any prerequisites for making this application and what shud i learn for this .
Thanks in advance .
Do you need to do streaming or two-way videoconferencing? The latter is orders of magnitude harder than the former. If you just need streaming (one server, many clients), then QuickTime Broadcaster will do what you want.
Some time ago I used libcurl to stream a video from youtube, libavcodec (from ffmpeg) to decode and parse the data into frames and finally SDL to display it on my Mac OS X.
If you are looking for ffmpeg/SDL code examples, you must check this out:
http://dranger.com/ffmpeg/tutorial02.html
Based on your comment to Josh Wolf, you might want to consider developing an Adobe AIR application (inherently flash, but via whichever OSes you choose), as it already has built-in components for capturing and streaming video.
There's a great alternative for using this kind of service: tinychat.com
You can create a private room there and tell the password only for the people you need to talk to. The best reason for using tinychat.com is that you don't need to install anything.. It does works very well and quickly, and suports 9 broadcasts at the same time, with webcam, audio and/or text chat.

User-friendly approach for network streaming, playing and seeking of audio files in Mac OS X 10.5

Please advise a combination of server and client technologies, tools and frameworks to implement a solution that meets the following requirements?
File server in the network has a huge library of mp3/aac/aiff/wav music files
Desktop cocoa application accesses audio files using URLs: rtmp, http, rtsp+rtp, ftp — how to make a choice?
Audio content should be streamed and played with seeking (it's crucial) without downloading the entire file: QuckTime, AudioQueue, AudioFile, AudioStream, CFHTTP, All of them? — how to develop a client?
After solid research I've ended up with myriads of options and articles. But it looks like a half of them is quite out-of-date (2001—2005), and the other half is about universal code (pure C) for Mac OS X and iPhone OS.
However the main goal here is to write a Desktop music player for Mac OS 10.5.
I cannot believe that all this raw C-coding is just required.
No wrappers? No handy libraries? No components?
P. S. Research has resulted in the following combination: qt_tools for hinting + DSS for RTSP streaming + QTMovie for playing back + setCurrentTime: for seeking. This selection requires double-space for storing hinted .MOV-versions of every music file but works anyway.
I am not sure, but I believe you can use [QTMovie movieWithURL:url error:err] to stream a movie from a URL, then pass it to a QTMovieView object. QuickTime treats audio like movies, so it may work. Or it may try to load the entire file.
Have a look at the QuickTime streaming Guide
Did you look at VLC as a streaming solution?

Resources