When playing a video in uiwebview, You can see figininview in view hierarchy. This class comes from QuickTime plugin. The plugin path is/applications/xcode. APP/contents/developer/platforms/iphonesimulator. platform/developer/sdks/iphonesimulator6.1.sdk/system/library/Internet Plug-ins/QuickTime plugin. webplugin
This is a folder with Link Libraries and file and image resources. The name of QuickTime plugin is very loud. In fact, there are not many codes. There are only nine objective-C classes, which are dominated by figpluginview. It is coupled with WebKit. framework, or used to encapsulate video playback controls for WebKit. framework. Class relationships such:
Uiwebdocumentview pairs figpluginview and uiwebpluginview with the member variable struct _ cfdictionary * _ pluginviews. The figpluginview is the key and uiwebpluginview is the value.
Uiwebpluginview has a member variable uiview * _ uiview pointing to figpluginview,
Figpluginview has the member variable wakview * _ wakview pointing to uiwebpluginview.
Of course, video is only one type of pluginview. uiwebpluginview also manages other types of plugin.
The rendering process has the following relationship:
When updating the layer tree, renderlayerbacking obtains the uiwebpluginview from the renderwidget through the layer relationship and calls its function attachpluginlayer to add the figpluginview to the uiwebdocumentview. Note that this "add" is indirectly implemented through multi-layer calayer. uiwebpluginview also creates a hostlayer as medialayer. The implementation code at the end of the call chain is as follows:
- (void)_connectPluginLayers{ WebThreadLock(); if (!_hostingLayer) { _hostingLayer = [[CALayer alloc] init]; } [_webView.layer insertSublayer:_hostingLayer atIndex:0]; if ([[_webView webView] _setMediaLayer:_hostingLayer forPluginView:self]) { self.parentedInLayer = YES; [_uiView retain]; [_hostingLayer addSublayer:_uiView.layer]; [_uiView release]; [_webView _setSubviewCachesNeedUpdate:YES]; [self _reshapeOnMainThread]; }}
Here, we only have a rough list of items, and the inter-class mesh dependency makes it difficult to draw pictures and use text instructions. In short, we can be more sure that wakview replaces nsview to share code with Mac webview. However, IOS application is a single-process program and can only be combined with the calayer tree instead of the nsview tree.