How to custom video player of UIWebView - ios

I want to make a customized video player for UIWebView.
I have 2 ideas about it:
1. hook the notifications of UIMoviePlayer***, but I can't get any information about the current player from the notification, so I can't replace it with my custom video player
2. replace video.play in js, use my js to tell objective c to launch my video player. But it only works for some website, not for all.
Is there any solution for launch custom video player for UIWebView?

Related

Remove the AVPlayerViewController from the wkwebview after it plays an inline video

So I have wkwebview which displays an html text that includes video urls as well. On tapping the video thumbnail, the wkwebview launches the AVPlayer to play the video just fine. But after viewing the video, I need to remove the player so that other information on the wkWebview is visible.But the player makes the wkwebview go blank. I am attaching the screenshots
1. normal article with text and video thumbnail(calendar icon)
2. Video being played normally
3. After video being played, the rest of the wkwebview going blank.
I want to get back to state 1 from 3.

Display banner over AVPlayer from a WKWebView

I'm creating an app to watch live streams from the internet using a table view that opens AVPlayer when a cell is tapped. There are some cases that I can't open streams directly and so I have to use a WKWebView and then the video is opened by this one. I have to put a banner as overlay in AVPlayer and I managed to do it when the player is opened directly; the question is: how can I access to the AVPlayer properties when this is called by a WKWebView?
I tried to add an extension to the AVPlayerViewController class to manage the banner and it works well with the videos I open directly, but my solution seems to be useless with WKWebView-based videos...
Is AVPlayerViewController that manages videos opened by a WKWebView or another class?

how to play video with native player instead of web player for a <video> tag?

We have a UIWebView that load html page including video tag. When the user tap the video element, a fullscreen movie player is presented.
As there is some logic in the web page that handle events and need to stop and close the movie player. Is there any API to do so (stop the web movie player and exit fullscreen)?
Any one know how to do this?
Further more, even we want to detect tapping on the video element, then we'll have to provide our own custom player, instead of the system web player. Any way to do it?
Thank you!
This might be helping, if you want to controll the HTML5 video with js: http://www.w3.org/2010/05/video/mediaevents.html
I am not shure if - on a mobile device - javascript will be running while the video is in fullscreen mode.

Playing Vimeo Videos with Custom Video Player in iOS

I have to play Vimeo videos in my iOS application using a video player. I need to log events like play, pause, seek etc. Its not possible to play using MPMoviePlayerController or AVPlayer as Vimeo videos have flash content. I am able to play using UIWebView. But, it is showing default Vimeo player controls. I need to have my own controls to play, pause etc as I need to log those events.
I have tried for lot of solutions. Nothing worked. If anyone knows how to play Vimeo videos using custom player. Please Let me know.
I am able to find out solution for this problem. I have used YTVimeoExtractor present here.
Its README.md file says following :
YTVimeoExtractor helps you get mp4 urls which can be use in iOS's native player. You can even choose between mobile, standard and high definition quality.
YTVimeoExtractor doesn't use UIWebView which makes it fast and clean.
I have used MKMoivePlayerViewController and its notifications - MPMoviePlayerPlaybackStateDidChangeNotification and ˚ notifications to get stop, pause events.
The only official way to use a player besides the Vimeo player to play Vimeo videos is to use third-party player urls provided to PRO members: https://vimeo.com/s/adg

Play a list of media (video/audio) items on iOS

I'm developing an iPhone App and I need to implement a player to play a list of media (video/audio) items.
Following is a screenshot of player I have captured from an another iPhone app, I found many apps playing video/audio using a player has similar UI like this.
Can this player (including UI) can be implement by official API? Or just implement manually?
How can I implement a same player like this?
To Play audio follow this blog
And to play video, either you can use CustomMovieplayer or go with UIWebView with embedded html.
Movie Player sample code from here
To play video as embedded html in UIWebView, check this..
https://stackoverflow.com/a/7551375/790794
As per the file type, you can modify the source type.

Resources