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
Related
I want to use video from some live streaming channel i.e. twitch, youtube in my iOS application without using their plugins. How can i do so?
I'm trying to get url of the video so that i can play it via moviePlayer or something else in my application. At the moment, i'm using OBS for uploading the live-stream on twitch.tv
I've found the following link, but again i'm unable to find the url of the video so can't use the solution mentioned How can I use Livestream player in iOS/Android app?
Thanks,
I have solved the issue using webView. For Youtube we've stream id and we put it in url as "https://www.youtube.com/watch?v=videoId".
For ustream i made url as "https://www.ustream.tv/embed/channelId".
If you don't want to use webView then you can use helper libraries for these platforms i.e. YTPlayer, twitch etc.
I am developing a video application which contains a lot of video from different sources. One of the options in the application has to be to play videos through airplay on a TV.
For displaying YouTube video in my application I am using YTPlayerView, which is an objective-C helper for the YouTube API.
My question is: is there an option or param I can pass so the YouTube video can also be played through Airplay? I couldn't find anything useful on Internet.
In - (BOOL)loadWithPlayerParams:(NSDictionary *)additionalPlayerParams in YTPlayerView.m (line 617), add:
self.webView.mediaPlaybackAllowsAirPlay = YES;
right before you return YES.
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 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];
I'm having a streaming URL which is something like "http://myserver.com/master.m3u8". (this is dummy URL)
This URL is playing fine in the safari browser on iPhone.
But when playing the same within the app using following code, i'm facing some issues:
NSURL* theURL = [NSURL URLWithString:#"http://myserver.com/master.m3u8"];
MPMoviePlayerViewController* moviePlayerViewController = [[MPMoviePlayerViewController alloc] initWithContentURL:theURL];
moviePlayerViewController.moviePlayer.movieSourceType = MPMovieSourceTypeStreaming;
[self presentMoviePlayerViewControllerAnimated:moviePlayerViewController];
The problem when playing within the app is that, after sometime the screen turns to black color. But i'm still able to hear the audio.
How can I debug where is the issue.
Can some one help me who faced similar issue please?
If you create a standard m3u8 file the lowest version of the video will include an audio only version of the stream. So if the bandwidth is to low the player may switch to this stream and play audio only.
I haven't found a solution yet to do something meaningful in the app when this happens(for example pause the video and wait until the bandwidth is sufficient to play the next higher version of the stream which has video again) but if you can tweak the m3u8 or the encoding process you could just remove the audio only version from your m3u8. Then the player would switch to the lowest video stream and pause if the bandwidth isn't enough to show it.
Please keep in mind that you have to provide this to the App Review team when submitting the app to the store. This is mentioned in this Technical QA from Apple: Resolving App Store Approval Issues for HTTP Live Streaming
Note: As the baseline 64 kbps maximum audio-only HTTP Live stream requirement is specifically for streaming over a cellular network, if your application is self-restricting to Wi-Fi only HTTP Live Streaming and you choose to not supply a baseline 64 kbps audio-only stream, you must provide this information to the App Review team. Developers can include this information in the Review Notes field for your application.