Commit 4433cd38 by pidan

修复iOS15以下的设备mp4播放闪退的问题

parent 9d4b33cf
...@@ -204,7 +204,11 @@ ...@@ -204,7 +204,11 @@
self.mtkView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; self.mtkView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
self.mtkView.backgroundColor = UIColor.clearColor; self.mtkView.backgroundColor = UIColor.clearColor;
self.mtkView.device = MTLCreateSystemDefaultDevice(); self.mtkView.device = MTLCreateSystemDefaultDevice();
if (@available(iOS 15.0, *)) {
self.mtkView.colorPixelFormat = MTLPixelFormatRGBA8Unorm; self.mtkView.colorPixelFormat = MTLPixelFormatRGBA8Unorm;
} else {
self.mtkView.colorPixelFormat = MTLPixelFormatBGRA8Unorm;
}
[self addSubview:self.mtkView]; [self addSubview:self.mtkView];
self.metalRenderer = [[BDAlphaPlayerMetalRenderer alloc] initWithMetalKitView:self.mtkView]; self.metalRenderer = [[BDAlphaPlayerMetalRenderer alloc] initWithMetalKitView:self.mtkView];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment