I am trying to develop a radio application for iOS. I want to play the .pls files. I tried using AVPlayer but to no success. I retreived the URL from .pls. That also does not run. The stream however runs if I open the .pls file using the UIWebView.
Is there anything I can do to play it natively rather than using webview?
PLS link : http://66.23.234.242:8012/listen.pls
Check out this link https://discussions.apple.com/thread/1924391?start=0&tstart=0
PLS is a computer file format that stores multimedia playlists. It is a more expressive format than basic M3U, as it can store (cache) information on the song title and length — extended M3U supports this, too. With PLS version 2, playlists also include a PLS version declaration.
To play these files you need a media player on your operating system that is able to play these files. One of these media players is iTunes.
"Copied from the above mentioned link"
using MPMoviePlayer we can play .pls file and you have to hide that MPMoviePlayer, it look like a audio player and add subview to your view.
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString: #"your .pls link"]];
[moviePlayer.moviePlayer prepareToPlay];
moviePlayer.view.hidden = YES;
[self.view addSubview:moviePlayer.view];
//for play:
[moviePlayer.moviePlayer play];
//for pause:
[moviePlayer.moviePlayer stop];
Related
I want to know if there is a possible way of playing a LOCAL video file which does not have an extension (eg. ".mp4") using the MPMoviePlayerViewController API.
If I try to play a video file without an extension using that API, it won't play it.
Can I possibly use the file mime-type to notify the MPMoviePlayerViewController of the file type ?
Changing the player API is not an option at the moment.
I am trying to stream the video on IOS devices using amazon cloudfront web distribution(RTMP streaming is not supported by apple devices) and video is stored in s3 .Moreover the link is accessible to everyone.When I try to paste the video link in browser the video starts to download instead of streaming.
After inspecting on instagram's websites I came to know that instagram does the same thing(maybe) but the difference is it uses akamai CDN and I am using amazon's cloudfront
My link:
http://d16jy53srxox6v.cloudfront.net/brown.mp4
Instagram video streaming link:
https://igcdn-videos-b-2-a.akamaihd.net/hphotos-ak-xfa1/t50.2886-16/11773361_692383954227382_242786346_n.mp4
Where instagram video streams perfectly and my video gets download rather than streaming.After hitting google I found HLS is one of the solution yet I am looking for easy streaming alternative as my video max length would be 1 minute and HLS is good for larger files.Can anyone suggest me what should I do to make my video streamable without HLS?
Morover I tried to stream it in ios device but it tries to download and then plays it.Heres my code:
-(IBAction)click:(id)sender
{
// Make a URL
NSURL *url = [NSURL URLWithString:
#"http://d16jy53srxox6v.cloudfront.net/brown.mp4"];
// Initialize the MPMoviePlayerController object using url
_videoPlayer = [[MPMoviePlayerController alloc]
initWithContentURL:url];
// Set control style to default
_videoPlayer.controlStyle = MPMovieControlStyleDefault;
// Set shouldAutoplay to YES
_videoPlayer.shouldAutoplay = YES;
_videoPlayer.movieSourceType=MPMovieSourceTypeStreaming;
// Add _videoPlayer's view as subview to current view.
[self.view addSubview:_videoPlayer.view];
// Set the screen to full.
[_videoPlayer setFullscreen:YES animated:YES];
}
Problem Might be the content type of the uploaded video
You can go to the s3 bucket and check the metadata field under properties tab
I faced the same issue with one of my videos on s3 it used to get downloaded instead of playing it.
I resolved this issue by adding metadata to the video as
Content-Type = video/mp4
hope this helps
MY Real URL => "http://125.209.70.43:1500/"
As my title said that I want to play music from my live streaming URL. I tried with following code. (following URL is for testing not real)
[self playSelectedSong:#"http://media-ice.musicradio.com/HeartPlymouthV1"]; // custom method with testing URL
Code of method.
-(void)playSelectedSong:(NSString *) urlString
{
self.songPlayer = [[AVPlayer alloc]initWithURL:[NSURL URLWithString:urlString]];;
[self.songPlayer play];
}
I have Question like.
1) What should proper URL Pattern? is streaming URL has any rules about its pattern or not ?
For example above code is woking for streaming URL (NOT mine url) such like,
1) http://108.178.57.196:11112/los40principales
2) http://media-ice.musicradio.com/HeartPlymouthV1
BUT in my URL it is not working (for iOS Devices), my URL pattern is
http://125.209.70.43:1500/
My streaming URL pattern looking like above.
Then how can I play music by using above URL ? My above code is not working for http://125.209.70.43:1500/. Anybody have issue related as a mine ?
Please help me on this issue.
NOTE: My URL is correct and its working, I checked with vlc media player network streaming. by
=> VLC Medial Player
-> File Menu
-> Open Network
-> URL set as "http://125.209.70.43:1500/"
-> click on "Open" button.
Try with above step it's working very well.
Your stream is Windows Media Audio, that's not going to work with AVPlayer. If you want to support streaming to iOS devices, check out https://developer.apple.com/streaming/
I'm currently making an iOS application where you can search a song. You will then be given a list of songs which you can choose from and then stream from the app. It uses a combination of the tinysong API and I'm attempting to use a URL from Grooveshark combined with the songID given to me to play the song... E.g.
https://grooveshark.com/facebookWidget.swf?songID=13963
I've already had a quick look at this post: How can i share a grooveshark music url to facebook with the music widget?
but I was wondering if I could get more information.
What I want to do is play the audio from that link with a changing songID...
My Objective C code for this is:
//Opens the link of Url from first song and plays it
NSString *SongID = [[jsonArray objectAtIndex:0] objectForKey:#"SongID"];
NSString *playString = [#"https://grooveshark.com/facebookWidget.swf?songID=" stringByAppendingString:SongID];
//Converts songURL into a playable NSURL
NSURL *playURL = [NSURL URLWithString:playString];
AVAudioPlayer *backgroundMusicPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:playURL error:&error];
[backgroundMusicPlayer prepareToPlay];
[backgroundMusicPlayer play];
But it isn't playing. What should I do to make it play? I know iOS can't play Adobe flash player and considering it is in a swf format, that's why I figured it can't play but I don't know much about flash and/or it in conjunction with iOS. So any help or ideas would be much appreciated.
If there is another way to access and play songs from a massive database of songs with their artists and albums too from objective C (like spotify API, but free), please comment as that may be another solution!
Thanks!
I am trying to play a video file with the .mov extension. It is not playing the video in my MPMoviePlayerController. I need to play this type of file in my application. Is it possible to play a video file without using MPMoviePlayerController or UIWebView?
Please anyone suggest me in this issue.
Thanks in Advance
I've never used it directly before, but take a look at the AVPlayer Class Reference.
Under the "Overview", you'll see:
You use an AVPlayer object to implement controllers and user
interfaces for single- or multiple-item playback. The multiple-item
case supports advanced behaviors.
If you look at the AV Foundation Programming guide (linked here), you'll see Apple builds the Media Player upon AV foundation.