Custom audio control for ios apps - swift

We are creating an app using Swift on IOS that needs to use custom audio controls: a play button, a stop button, a current time/pos indicator, the duration and perhaps even a seek bar to play 1 audio file that is built into the application. My friend has worked hard on this project but so far was unable to find a solution. Is it possible using mediaplayer or is another api easier, possibly something similar to exoplayer for android apps.
Thanks.

In my opinion I would say that using AVFoundation would probably be easiest since it is built into swift you just have to do import AVFoundation and you would probably want to create an AVAudioPlayer to listen to the music. Also the API is pretty simple. If you need any help getting started I found this article on Mashable that shows how to play audio and how to control it with a custom play and pause button. https://medium.com/yay-its-erica/creating-a-music-player-app-in-swift-3-53809471f663. Also I found on Apple's documentation how to get the current time of the audio playing https://developer.apple.com/documentation/avfoundation/avaudioplayer/1387297-currenttime. I hope I was able to help and if you have anymore questions don't hesitate to ask!

Related

Apple watch video playback

Can apple watch capable of video playback? I want to develop an app similar to vine for apple watch. So, user can consume video conveniently from the watch. Is it possible?
I have played with animating multiple images to create a video but it really is a bad approach. Anyone else comes up with any idea?
Update after WWDC 2015:
Good news! Now it's possible!
Link to sample code:
https://developer.apple.com/library/prerelease/watchos/samplecode/WatchKitMoviePlayer/Introduction/Intro.html
Summary:
Now there is a class (WKInterfaceMovie) that allows you to play videos on the watch :)
From the docs:
A WKInterfaceMovie object lets you play back video and audio content
directly from your interface. A movie object displays a poster image
with a play button on top of it. When the user taps the play button,
WatchKit plays the movie in a modal interface.
Class Reference:
https://developer.apple.com/library/prerelease/watchos/documentation/WatchKit/Reference/WKInterfaceMovie_class/index.html
Using the current APIs it might be difficult/impossible.
Still, the camera application on the apple watch is receiving a live stream coming from the camera of the iPhone at a quite good rate.
Most of the apple watch apps are not using only the publicly available APis but it shows that it should be feasible (not talking about the sound here...)
update:
I had missed one feature, there IS an embedded video player with sound on the apple watch... have someone send you a short video has an iMessage and you are able to play it on the watch...

How to Build Audio File Stream iPhone App?

I need some guidance on how to make a audio stream app for multiple audio files, so the app user can choose from the list and listen to the item.Do you know any good tutorials, or place from where i can learn how to do this by my self. I'm familiar with the concept on how it wood look like, i need something on how to pause and resume, how to go to next and previous are there some classes that can help me do this. Can someon help me?
Look into AVQueuePlayer if you can require your users to run iOS 4.1+. It can help you stream a sequential playlist of items. AVPlayer is another option, which only requires iOS 4.0+, but it can only handle one item at a time, so you'd have to write your own code to manage the playlist.
The AV Foundation Programming Guide does a pretty good job of explaining how to use these classes.

Recording sounds created within an iPhone app

I'm new to programming in Objective-c and the iPhone but I am working on an app to teach myself. I have been trying to figure out how to record sounds on the iPhone. Apple provides excellent documentation for recording from the microphone with AVAudioRecorder but I want to record sounds made by my app, or even just record sounds when buttons are pressed (button is pressed, certain audio gets recorded).
I have no clue how to do this and can't seem to find anything that would help me along this path, only microphone stuff.
Can anyone share ideas or code that would make this possible?
Thanks
Once you move beyond the convenience classes like AVAudioRecorder, you've got a lot of studying to do.
I would start with:
Getting Started with Audio and Video
Multimedia Programming Guide:Audio
Core Audio Overview
Audio programming is a very large and complex subject. If you want to customize, be prepared to spend some time learning it.
I've made a sample app that records sounds/audio and has a playback. Hope this helps! https://github.com/casspangell/AudioMic

Getting duration of video taken by camera iphone sdk

I am trying to get the duration of a video taken with the camera using UIImagePickerController on the iphone, has anyone found a solution to this?
Thanks
Daniel
You can now do this using AVFoundation you can make your movie into an AVAsset and then check the duration property
Oh, why, hello hopelessly obsolete answer. I'm afraid you're only left here as historical evidence that yes, before iOS 4 if you wanted to do anything remotely interesting on a recorded video (besides playing it) you had to implement the processing yourself.
I don't know of any framework function to do so, so I'm afraid you'll have to parse the video container yourself (which by the way, is QuickTime/.mov) to extract this info. It's not like it's not documented. Luckily since the provider is known, you can trust all info to be truthful, which you can't assume of random videos found on the web.

iPhone external video playback from an app

I know the iPhone can play video on an external screen if you have the Apple component output cable. I also know you can write an app that plays video. Is there a way to put those two things together and write an app that will play video specifically on an external screen?
This is currently not possible with the iPhone API. I have heard of apps that have done it on jail-broken phones, but there is not Apple-approved way of doing it at this time.
This can be done using private private APIs, but it won't get in the store. This guy wrote a class to do it here: http://dragonforged.com/DFVideoOut.shtml Haven't used it myself, but it looks very simple.