Download the Media (mp3) presented by the UIWebView in fullscreen - ios

So I am working on a piece of code that helps the user in downloading mp3 files from the UIWebView. So far it has been working perfectly by detecting the last path component of the view's URL. (www.exampledownload.com/file.mp3). But in some cases the absolute URL doesn't finish in .mp3. However the UIWebView knows it is an mp3 and opens it on a MediaPlayer (As shown in the attached screenshots).
I've tested some mp3 download apps out there and they are able to detect the mp3 and download it. I want to know how to detect the file that the WebView is trying to open. The download protocol is already stablished. I just need the actual download URL of this files. I attach some screenshots to make myself more clear.
I've seen other apps in which they modify the default media player, and the webview shows the mediaplayer but with another button besides de normal playback buttons. (The download button) I would like to know also how can this be done. Thanks!

You can intercept the URL in webView:shouldStartLoadWithRequest:navigationType: and check if its an MP3 and return NO and then do whatever you want with the file.

Related

MPMoviePlayerController captions button

Using MPMoviePlayerController to stream an mp4 stored on a CDN, the file is actually an .m3u8
I've looked into this and there is no direct programmatic way of removing/disabling the bottom-right captions button unless the stream does not embed the subtitles in the first place.
I know for sure that the test video I'm working with does not contain subtitles which prompts the question: why is the captions button still visible then? Is there really no way of hiding it anyway? Tapping it will pause the video but not prompt the captions menu unlike streaming an .mpd file which does prompt the captions menu even without no available language option.
I'm doing the usual:
video = MPMoviePlayerController(contentURL: NSURL(string: url))
video.view.frame = UIScreen.mainScreen().bounds
video.controlStyle = MPMovieControlStyle.Fullscreen
For a locally stored mp4, the captions button won't appear which makes me think that the issue lies in either the m3u8 aspect of the file or that the CDN requires some additional setup like mentioned here: https://developer.apple.com/library/ios/qa/qa1801/_index.html

Adding Sound With UIPageViewController iOS Swift

I am new to iOS, and am using PageViewController to set up an app with books. I am having a hard time finding any information on setting up sound with each page. How do you add mp3 files into an array using AVFoundation?
You can play a audio file in background usinf AVAudioPlayer u can even play different audio for different page.... Change audio file inside page view controller delegate method, visit this link for more detail info

Launch video player in iOS from a link rather than an embedded video

Sorry if this has been asked before... in a mobile browser (eg iOS Safari) when a Vimeo video is embedded into a HTML page, clicking play on the video pops it open in the native player in Safari - I want to be able to launch a video in this exact way, but from an image link rather than having to embed the video... So that clicking the image pops open the video in the native Safari player.
I've searched around but think I'm lacking the correct terminology to know exactly what to search for.
Is this possible?
Thanks in advance...
Why don't you want to embed the vimeo code?
One work around can be going to your vimeo video settings, then Basic and at the bottom of that page upload your own Thumbnail image... You will still have to embed the vimeo code though, but now you will have the image you want as the first image before you click on the video.
This can be a partial solution in the mean time. Also I think a Pro vimeo account might allow a direct link to a video.

How to play videos in uiwebview ios?

I'm building an article reading app for iphone.I'm parsing JSON content of article in uiwebview.
Some of the articles contains videos,But it does not display in the uiwebview.
JSON format for video is
<iframe src=\"\/\/www.youtube.com\/embed\/hdstrm\" height=\"360\" width=\"640\" allowfullscreen=\"\" frameborder=\"0\">
The uiwebview display empty space at the place of video frame
here is screen shot of uiwebview:
Displaying YouTube videos on iOS requires special treatment and is much less straight forward than you would expect (or hope). You can either display the entire YouTube page and let the user take it from there (or try to programmatically simulate a press on the play button), or you can "steal" the MP4 and play it using the media player.
The second option is better because it allows you to control the UI around the video and doesn't force you to display the entire YouTube page. However, it's important to stress that it requires quite a bit of work and is frowned upon by YouTube. In fact, they change the HTML structure of their pages every 2-3 months so that these mechanisms will break, and you won't be able to access the MP4 file directly without changing your code.
For more information on how to access the media file directly and play it, check out https://github.com/larcus94/LBYouTubeView

Can iOS APP play downloaded MP4 files in custom window?

We have an iOS APP project which will play video in our custom window and would like to play the downloaded video files. According to such kind of demand, is that possible to do that?
This is possible. Please check the documents for MPMoviePlayerController . This allows you to play a video and managing your own view hierarchy/custom views. To play a video inline, you need to use the view property of your MPMoviePlayerController instance an put it into your view hierarchy. The features of MPMoviePlayerController have changed with iOS 3.2, so while using it, be sure to only use features for your deployment target.

Resources