4

アルファ チャンネルを使用して AVPlayerLayer で再生しているビデオを持っている人はいますか?

もしそうなら、それはどのように可能ですか?純粋なアルファ チャネル ビデオの使用、ターゲット レイヤーへのブレンド モードの適用、すべてのフレームのアニメーション化など、さまざまなソリューションを試しました。唯一の実行可能な解決策は後者であり、電話の動作が非常に遅くなります.

4

1 に答える 1

2

私はマスクを使っていますが、

NSURL *fileURL = [[NSURL alloc] initFileURLWithPath: file];

AVURLAsset* url = [AVURLAsset URLAssetWithURL:fileURL options:[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:AVURLAssetPreferPreciseDurationAndTimingKey]];

AVPlayerItem* pitem = [AVPlayerItem playerItemWithAsset:url1];
AVPlayer*player  = [AVPlayer playerWithPlayerItem:pitem1];

pv = [[PlayerView alloc] initWithFrame:CGRectMake(0,0, 100, 100)];
[pv setPlayer:player];

UIImageView*iv = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"mask"]];
pv.layer.mask = iv.layer;

マスクは透明度のあるpngファイルです。

于 2010-11-30T13:50:21.987 に答える