Skip to content

How can i implement this player in UITableViewCells? #2

@chetan-duke

Description

@chetan-duke

I have implemented player in UITableViewCells. Its not working properly as it has to. When cell is reuse i need its state as its previously has. When i reload the tableview the video layer of one cell is copied to another cells video layer.
Below is the screen when tableview is not reloaded yet.

simulator screen shot 15-feb-2017 3 10 03 pm

After reload i insert some records (objects) in tableview and reload. The UI is disturbed and SRVideoPlayer's objects are misplaced.
simulator screen shot 15-feb-2017 3 11 04 pm

TableViewCell are XIB's

Code in VideoCell.h
@property (nonatomic, strong) SRVideoPlayer *videoPlayer;

Code in ViewController cellForRowAtIndexPath

if (cell.videoPlayer == nil) {
                    cell.videoPlayer = [SRVideoPlayer playerWithVideoURL:[NSURL URLWithString:videoUrl] playerView:cell.viewVideoLayer playerSuperView:cell.viewVideoLayer.superview];
                    cell.videoPlayer.videoName = [[arrData objectAtIndex:indexPath.row] objectForKey:MessageUserFullName];
                    cell.videoPlayer.playerEndAction = SRVideoPlayerEndActionLoop;
                    [cell.videoPlayer play];
                    [cell.vwContents bringSubviewToFront:cell.viewVideoLayer];
}

If I'm going wrong anywhere please update.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions