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

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.

Related

Youtube video embedding thumbnail

I have a youtube video playlist of 15 videos.
On my website when someone clicks a link, I am displaying a specific video within the playlist (example: video 5 of 15). My issue is that since YouTube no longer allows autoplay if you have the audio on, the video will display properly on the page, but it always shows the thumbnail of the first video in the playlist (not the thumbnail of video 5 in this example) which confuses the viewer because they think they are looking at the wrong video and therefore don't press the play button.
Does anyone know what I can do to make the correct thumbnail to show?
Note: I don't want to embed only video 5 (in this example) because I want video 6 to start playing automatically once video 5 completes.

Controlling/Handling embedded youtube video in long UIWebview content iOS 9

I have UIWebviews that contains different styled texts, images, youtube videos etc. If UIWebview has Youtube video, it has Picture-In-Picture button as default (I have PiP feature in app for my video gallery with AVPictureInPictureController, means PiP enabled in app).
1) How can I opt-out for PiP for those embedded youtube videos
Another case is my UIWebviews are in UICollectionViewCells, that is in horizontal mode, 1 cell per page, paging enabled, I can't pause the youtube video when change page to another, because I have no variable or something that assigned to that player to control player. This case arises in iPad, because in iPhone when you try to play embedded youtube video it goes for full screen, to change another cell you have to press Done(that pauses video) so video handles itself to stop, but in iPad it plays in UIWebview autmatically, doesn't goes for fullscreen
2) How can I get controll on embedded youtube video in my UIWebview
Found solution for #1:
myWebiew.allowsPictureInPictureMediaPlayback = false

Can't Play iFrame embedded YouTube video on iPad

I'm developing an iOS iPad app with an embedded YouTube video.
I'm having issues when the user tries to play the video touching the red square play image from YouTube, it seems that pressing that image won't trigger the play action. However, touching anywhere outside the red square play button works.
I've tested it with the iPad user agent with same results.
When embedding with controls:0 it seems that the action triggers perfectly, but I need the default controls.
Is there anyway to keep controls:1 and detect that touch to successfully play the video?
Try playing the video itself when it is loaded. If hitting the big red button is not a compulsion add "event.target.playVideo();" to the onReady function in the embeded HTML body. I have done so and the player in my application shows the big red button and starts the video itself immediately. I have used the following YouTube iFrame library youtube-ios-player-helper

How to play video from stream link or youtube link on webview android?

I searched for it a lot but don't have a reasonable answer.How to play video from stream link or youtube link on webview android.i used tag video or iframe but occur some bugs:
-when click full screen video 'll stop and can't play again.
-when click back button for finish fragment,that contain webview,video still playing
Please see the "HTML5 Video support" section at http://developer.android.com/reference/android/webkit/WebView.html for some methods that you must implement.
When the video continues playing after finishing the fragment, are you destroying the WebView?

How to custom video player of UIWebView

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?

Resources