Stream online music in Objective c .
Learn how to stream audio files online , similar to the one you will see in Saavn or SoundCloud. Online streaming is very popular these days as it saves a lot of data of your device(iPhones and iPads).
In this tutorial i will tell you about streaming audio over internet without downloading the content .
Step 1:
Open Xcode and create a new project.
Step 2:
Add AVFoundation Framework to your project.
For adding framework go to your Project >>> Selects Targets >>> Go to Build Settings >>> Click on + button and add AVFoundation Framework to your project.
Step 3:
Import the AVFoundation framework in your ViewController.m file by :
#import <AVFoundation/AVFoundation.h>
Step 4:
Create a UIButton so that we can play or pause the audio .
- Go to storyboard and drag the UIButton .
- Make its connection with the ViewController.
Step 5:
In ViewController.m add global elements by :
Step 6:
Add the following code to initialize AVPlayer and add online streaming in it.
Add url of any audio file you want to play.
Step 7:
Last step in this tutorial is to Add Transport Security Settings in your application.
If you are using Xcode 7 , then add the Add Transport Security Settings in info.plist
and under Add Transport Security Settings >> make Allow Arbitrary Loads to YES as shown below:
Thats all about the Live streaming in iOS applications .
Thank you :)
Step 6:
Add the following code to initialize AVPlayer and add online streaming in it.
Add url of any audio file you want to play.
Step 7:
Last step in this tutorial is to Add Transport Security Settings in your application.
If you are using Xcode 7 , then add the Add Transport Security Settings in info.plist
and under Add Transport Security Settings >> make Allow Arbitrary Loads to YES as shown below:
Add Transport Security Settings |
Thats all about the Live streaming in iOS applications .
Thank you :)
thnkz for the post :)
ReplyDeleteThank you for reading... :)
DeleteThis comment has been removed by the author.
ReplyDeletethe url link only works once how can i get it to play unlimited times
ReplyDeleteSet the Property numberOfLoops to -1 and it would go into infinite loop.
DeleteHello sir,
ReplyDeletehwo we implement seek bar.
It's Very nice , Thanks for sharing
ReplyDeleteiOS app development Online Training Hyderabad
can you upload about coredata in objective c
ReplyDelete