Reputation: 2048
is it possible to have a QuickTime video with alpha layer (transparency) play on top of a static dynamic background UIView
(i.e. a view that changes occasionally) on the iPad?
Thanks!
Upvotes: 21
Views: 6176
Reputation: 4425
Just to clear up the misinformation, you can't use a video with an alpha channel using the built in video logic in iOS. You can create a Quicktime movie encoded with the Animation codec and load the video into a view or layer using AVAnimator. What you can't do is create a H264 video with an alpha channel, that is simply is not supported by iOS.
display movies with an alpha channel under iOS
Upvotes: 3
Reputation: 2150
You could have a normal video and reduce the alpha of the presenting view. This can be done using an AVPlayer
and AVPlayerLayer
by adding the AVPlayerLayer
to a UIView
and setting the alpha of the UIView
. Something like:
self.player = [[AVPlayer alloc] initWithURL:url];
self.playerLayer = [AVPlayerLayer playerLayerWithPlayer:self.player];
self.playerLayer.frame = view.bounds;
...etc...
self.playerView.alpha = 0.3;
[self.playerView.layer addSublayer:self.playerLayer];
I haven't tried this with the alpha channel in the video itself, but AVPlayerLayer should work for that as well.
Upvotes: 0
Reputation: 2531
MPMoviePlayerController has a backgroundView property. The docs state:
This view provides the backing content, on top of which the movie content is displayed. You can add subviews to the background view if you want to display custom background content.
I haven't tried it, but if the video content itself has alpha, it sounds like this view should show up. If you set that view to clear, it may just work...
Upvotes: 1
Reputation: 393
I think you can make videos transparent , while playing the video adjust the alpha of view from 0.0 to 1.0. for eg 0.50. After playing the vido change the alpha of view to 1.0.
Upvotes: -1
Reputation: 2468
first your video needs transparency: http://docs.info.apple.com/article.html?artnum=42599
IMHO: I think the videocomponent has a solid background color (black) you will have to set it to [UIColor clearColor]
You have to try, im not sure if that works.
cheers endo
Upvotes: 0