大きな問題が残っています。 私はvideoplayerを持っている1つのtableviewを持っています - AVPlayer 私は10のセルとそれぞれのビデオを再生しています。問題は、私が スクロールテーブルビューをプレイヤーが再初期化してビデオ再生を から開始するときです。私はこの再初期化を防止し、twitterのようなビデオを再生したいです。最後に残すように再生するコードは試してください。私は、複数のコードを試してみましたが、セルのavplayer - テーブルビューの再初期化を防ぐ方法
Code is here
if (Arr_avPlayer.count > indexPath.row){
Cell_TVC * cell = (Cell_TVC *)[Arr_avPlayer
objectAtIndex:indexPath.row];
return cell;
}
// Cell_TVC *cell = (Cell_TVC *)[tableView
dequeueReusableCellWithIdentifier:@"Cell_TVC"
forIndexPath:indexPath];
**Cell_TVC *cell = [[Cell_TVC alloc] init];**
// Cell_TVC *cell = [tableView
dequeueReusableCellWithIdentifier:@"Cell_TVC"];
// if (!cell) {
// cell = [[Cell_TVC
alloc]initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:@"Cell_TVC"];
//
// }
AVURLAsset *asset = [[AVURLAsset alloc] initWithURL:[NSURL
fileURLWithPath:[self filepath:[myIntegers
objectAtIndex:indexPath.row]]] options:nil];
cell.avPlayerItem = [[AVPlayerItem alloc] initWithAsset:asset];
cell.avPlayer = [[AVPlayer alloc]
initWithPlayerItem:cell.avPlayerItem];
cell.avPlayerLayer = [[AVPlayerLayer alloc] init];
cell.avPlayerLayer = [AVPlayerLayer
playerLayerWithPlayer:cell.avPlayer];
cell.lblTime.text = @"0.0";
CGRect contentViewFrame = cell.contentView.frame;
contentViewFrame.origin.x = 0;
contentViewFrame.origin.y = 25;
contentViewFrame.size.width = APP_width;
contentViewFrame.size.height = APP_width * 0.55;
cell.contentView.frame = contentViewFrame;
cell.contentView.backgroundColor = [UIColor redColor];
UILabel *lbl = [[UILabel
alloc]initWithFrame:CGRectMake((cell.contentView.frame.size.width/2
) - 100, contentViewFrame.size.height + 10, 200, 100)];
//lbl.text = [NSString stringWithFormat:@"%02f:%02f", dMinutes11,
dSeconds11];
lbl.tag = indexPath.row;
[cell.avPlayerLayer setFrame:cell.contentView.frame];
[cell.contentView.layer addSublayer:cell.avPlayerLayer];
[Arr_avPlayer insertObject:cell atIndex:indexPath.row];
[cell.contentView addSubview:lbl];
if i write the cell like below
Cell_TVC *cell = [[Cell_TVC alloc] init];
i am not able to acess the property of cell and when i use like
below
if (!cell)
{
cell = [[Cell_TVC
alloc]initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:@"Cell_TVC"];
}
プレーヤーの屈折率変化と映像が がどのようにこの問題の乗り心地を得るためにそのインデックスを変え得る成功しないのですか?
uは、テーブルビューのデータソースでAVPlayerのシーク時間を維持する必要があります –
そのコードはどこですか? 'tableView:cellForRowAtIndexPath:'?あなたのコードは面倒です、あなたの質問をフォーマットしてください。また、デキューを使用して、セルの再利用を使用してください。再利用のために、そこにサブビューを追加することも避けてください。 – Larme
Anbu.Karthik今すぐ見ることができません。seektimeが必要です。avplayerの再初期化を防ぐ方法が必要です – Anita