ios - Using AVPlayer to view transparent video -
i trying view video witch has alpha channel (the background transparent). problem don't seem how make background of player transparent. know have use avplayer, can't access it's .view property. how can add subview , add layer?
nsstring *path = [nsstring stringwithformat:@"%@%@", [[nsbundle mainbundle] resourcepath], @"/new project 5.m4v"]; nsurl *filepath = [nsurl fileurlwithpath:path isdirectory:no]; movieplayer = [[avplayer alloc] initwithurl:filepath]; avplayerlayer* playerlayer = [avplayerlayer playerlayerwithplayer:movieplayer]; self.playerlayer.frame = self.view.bounds; movieplayer.view.alpha = 0.3; [movieplayer.layer addsublayer:playerlayer]; [movieplayer play];
the ios sdk not support alpha channel video playback. applies avframework mediaplayer framework. video material contains alpha channel not work expect when using apple's api.
and show within code, avplayer
not use uiview
surface playing videos subclass of calayer, avlayer
.
you need rethink application design or chose different playback sdk.
Comments
Post a Comment