youtube / youtube-ios-player-helper

Lightweight helper library that allows iOS developers to add inline playback of YouTube videos through a WebView
Other
1.65k stars 683 forks source link

Change UIWebView to WKWebView #139

Open rafaelpereznajera opened 9 years ago

rafaelpereznajera commented 9 years ago

Better performance, better memory management ...

mikerz commented 9 years ago

I'm not sure this is a good idea; WKWebview is iOS 8.0+ and has its own bugs to deal with.

I'd welcome a separate branch using WKWebview though.

ronakvora commented 9 years ago

@mikerz; while I agree that WKWebView still hasn't sorted itself out completely, it's required on iPad for PiP :.

ronakvora commented 9 years ago

You can also use UIWebView as a backup for < iOS 8. We do this often in our application.

the-civilian commented 9 years ago

+1

ashoemaker commented 8 years ago

👍

cdrx commented 8 years ago

The main problem with WKWebView (that makes this non-trivial to implement) is that stringByEvaluatingJavascriptFromString is now async, meaning that the external API for this module would need to change

cm-hugog commented 8 years ago

+1

hmhv commented 8 years ago

I tried to use WKWebView. and i found WKWebView version use only about 20% of memory to play a example video.

https://github.com/hmhv/YoutubePlayer-in-WKWebView

zsszatmari commented 8 years ago

How did you measure it? In case of WKWebView the actual heavy lifting is done in a separate process, not your app's process, so if you are looking at xcode's app metrics you are mistaken.

hmhv commented 8 years ago

@zsszatmari Thank you your comment. you are right. I used xcode's app metrics. but I think It is still good for app's memory address space.

cdrx commented 8 years ago

One thing to note with WKWebView: when your app is backgrounded, iOS can shutdown the WKWebView process to reclaim some memory but leave your app running.

There isn't any event to detect this happening so to be safe you should reset your web view whenever your app resumes.

mhuusko5 commented 7 years ago

If using WKWebView, could get Mac support as well..

light-bo commented 7 years ago

+1