// // JXShortDramaCell.m // AICity // // Created by TogetherWatch on 2025-10-20. // #import "JXShortDramaCell.h" #import "JXSuperPlayer.h" #import "JXDramaContent.h" #import "JXInteraction.h" #import "GuestHelper.h" @interface JXShortDramaCell () #pragma mark - UI组件 // 播放器容器 @property (nonatomic, strong) UIView *playerContainerView; // 右侧交互按钮组 @property (nonatomic, strong) UIStackView *interactionStackView; @property (nonatomic, strong) UIButton *likeButton; @property (nonatomic, strong) UILabel *likeCountLabel; @property (nonatomic, strong) UIButton *favoriteButton; @property (nonatomic, strong) UILabel *favoriteCountLabel; @property (nonatomic, strong) UIButton *commentButton; @property (nonatomic, strong) UILabel *commentCountLabel; @property (nonatomic, strong) UIButton *collectionButton; // 底部信息区 @property (nonatomic, strong) UIView *bottomInfoView; @property (nonatomic, strong) UILabel *titleLabel; @property (nonatomic, strong) UILabel *descriptionLabel; #pragma mark - 数据 @property (nonatomic, strong) JXDramaContent *drama; #pragma mark - 播放器 @property (nonatomic, strong) JXSuperPlayer *superPlayer; @property (nonatomic, assign) JXSuperPlayerState playerState; // 播放器状态 // 播放超时检测 @property (nonatomic, strong) NSTimer *playTimeoutTimer; // 播放超时检测定时器 @property (nonatomic, strong) NSDate *playStartTime; // 播放开始时间 @end @implementation JXShortDramaCell #pragma mark - 初始化 - (instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { [self setupUI]; } return self; } - (void)prepareForReuse { [super prepareForReuse]; NSLog(@"[JXShortDramaCell] prepareForReuse - 停止当前播放"); // 只停止播放,不释放播放器实例 // 重用播放器实例可以避免频繁创建销毁导致的连接问题 [self stopPlay]; // 停止超时检测 [self stopPlayTimeoutTimer]; } #pragma mark - UI设置 - (void)setupUI { self.contentView.backgroundColor = [UIColor blackColor]; // 创建播放器容器 [self setupPlayerContainer]; // 创建交互按钮组 [self setupInteractionButtons]; // 创建底部信息区 [self setupBottomInfo]; // ========== 总体诊断 ========== NSLog(@"[JXShortDramaCell] ✅ setupUI 完成"); NSLog(@"[JXShortDramaCell] 📊 contentView: %@", self.contentView); NSLog(@"[JXShortDramaCell] 📊 contentView subviews count: %lu", (unsigned long)self.contentView.subviews.count); NSLog(@"[JXShortDramaCell] 📊 interactionStackView: %@", self.interactionStackView); if (self.interactionStackView) { NSLog(@"[JXShortDramaCell] 📊 interactionStackView arrangedSubviews: %lu", (unsigned long)self.interactionStackView.arrangedSubviews.count); for (NSUInteger i = 0; i < self.interactionStackView.arrangedSubviews.count; i++) { UIView *subview = self.interactionStackView.arrangedSubviews[i]; NSLog(@"[JXShortDramaCell] [%lu] %@ - subviews: %lu", (unsigned long)i, [subview class], (unsigned long)subview.subviews.count); } } UIButton *allBtn = [[UIButton alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-86)/2, (kScreenHeight-31)/2, 86, 31)]; [allBtn setImage:[UIImage imageNamed:@"查看全部 1"] forState:UIControlStateNormal]; [allBtn setTitle:@"查看全部" forState:UIControlStateNormal]; [self.contentView addSubview:allBtn]; allBtn.titleLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightBold]; allBtn.backgroundColor = [UIColor colorWithRed:24/255.0 green:24/255.0 blue:24/255.0 alpha:1]; allBtn.layer.cornerRadius = 15.5; allBtn.clipsToBounds = YES; [allBtn addTarget:self action:@selector(handleDetailTap) forControlEvents:UIControlEventTouchUpInside]; } - (void)setupPlayerContainer { self.playerContainerView = [[UIView alloc] init]; self.playerContainerView.backgroundColor = [UIColor blackColor]; [self.contentView addSubview:self.playerContainerView]; // 约束 - 播放器下边界贴近底部导航栏(44pt高) self.playerContainerView.translatesAutoresizingMaskIntoConstraints = NO; [NSLayoutConstraint activateConstraints:@[ [self.playerContainerView.topAnchor constraintEqualToAnchor:self.contentView.topAnchor], [self.playerContainerView.leadingAnchor constraintEqualToAnchor:self.contentView.leadingAnchor], [self.playerContainerView.trailingAnchor constraintEqualToAnchor:self.contentView.trailingAnchor], [self.playerContainerView.bottomAnchor constraintEqualToAnchor:self.contentView.bottomAnchor constant:-44] ]]; } - (void)setupInteractionButtons { // 点赞按钮 [self addLikeButton]; // 收藏按钮 [self addFavoriteButton]; // 评论按钮 [self addCommentButton]; // 合集按钮 [self addCollectionButton]; } - (void)addLikeButton { UIView *likeContainer = [[UIView alloc] initWithFrame:CGRectMake(self.frame.size.width-48, self.frame.size.height-BAR_HEIGHT - 100 - 130, 32, 50)]; self.likeButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 32, 32)]; [self.likeButton setImage:[UIImage imageNamed:@"icon 1.1"] forState:UIControlStateNormal]; [self.likeButton setImage:[UIImage imageNamed:@"icon 1.5"] forState:UIControlStateSelected]; self.likeButton.tintColor = [UIColor whiteColor]; [self.likeButton addTarget:self action:@selector(handleLikeTap) forControlEvents:UIControlEventTouchUpInside]; [likeContainer addSubview:self.likeButton]; self.likeCountLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 32, 32, 18)]; self.likeCountLabel.textColor = [UIColor whiteColor]; self.likeCountLabel.font = [UIFont systemFontOfSize:12]; self.likeCountLabel.textAlignment = NSTextAlignmentCenter; self.likeCountLabel.text = @"0"; [likeContainer addSubview:self.likeCountLabel]; [self.contentView addSubview:likeContainer]; } - (void)addFavoriteButton { UIView *favoriteContainer = [[UIView alloc] initWithFrame:CGRectMake(self.frame.size.width-48, self.frame.size.height-BAR_HEIGHT - 100 - 65, 32, 50)]; self.favoriteButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 32, 32)]; [self.favoriteButton setImage:[UIImage imageNamed:@"icon 1.2"] forState:UIControlStateNormal]; [self.favoriteButton setImage:[UIImage imageNamed:@"icon 1.5"] forState:UIControlStateSelected]; self.favoriteButton.tintColor = [UIColor whiteColor]; [self.favoriteButton addTarget:self action:@selector(handleFavoriteTap) forControlEvents:UIControlEventTouchUpInside]; [favoriteContainer addSubview:self.favoriteButton]; self.favoriteCountLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 32, 32, 18)]; self.favoriteCountLabel.textColor = [UIColor whiteColor]; self.favoriteCountLabel.font = [UIFont systemFontOfSize:12]; self.favoriteCountLabel.textAlignment = NSTextAlignmentCenter; self.favoriteCountLabel.text = @"0"; [favoriteContainer addSubview:self.favoriteCountLabel]; [self.contentView addSubview:favoriteContainer]; } - (void)addCommentButton { UIView *commentContainer = [[UIView alloc] initWithFrame:CGRectMake(self.frame.size.width-48, self.frame.size.height-BAR_HEIGHT - 100, 32, 50)]; self.commentButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 32, 32)]; [self.commentButton setImage:[UIImage imageNamed:@"icon 1.3"] forState:UIControlStateNormal]; self.commentButton.tintColor = [UIColor whiteColor]; [self.commentButton addTarget:self action:@selector(handleCommentTap) forControlEvents:UIControlEventTouchUpInside]; [commentContainer addSubview:self.commentButton]; self.commentCountLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 32, 32, 18)]; self.commentCountLabel.textColor = [UIColor whiteColor]; self.commentCountLabel.font = [UIFont systemFontOfSize:12]; self.commentCountLabel.textAlignment = NSTextAlignmentCenter; self.commentCountLabel.text = @"0"; [commentContainer addSubview:self.commentCountLabel]; [self.contentView addSubview:commentContainer]; } - (void)addCollectionButton { UIView *bottomView = [[UIView alloc] initWithFrame:CGRectMake(0, self.frame.size.height - 38 - BAR_HEIGHT, SCREEN_WIDTH, 38)]; bottomView.backgroundColor = [UIColor colorWithRed:255/255.0 green:255/255.0 blue:255/255.0 alpha:0.1]; [self.contentView addSubview:bottomView]; UIImageView *sImgView = [[UIImageView alloc] initWithFrame:CGRectMake(16, 10.5, 17, 17)]; sImgView.image = [UIImage imageNamed:@"icon 2.1 拷贝"]; [bottomView addSubview:sImgView]; UILabel *hjL = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(sImgView.frame)+4, 0, 100, 38)]; [bottomView addSubview:hjL]; hjL.font = [UIFont boldSystemFontOfSize:18]; hjL.textColor = UIColor.whiteColor; hjL.text = @"合集"; UIImageView *mImgView = [[UIImageView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH-27, 13.5, 11, 11)]; mImgView.image = [UIImage imageNamed:@"Frame 9366"]; [bottomView addSubview:mImgView]; UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleCollectionTap)]; [bottomView addGestureRecognizer:tap]; } - (void)setupBottomInfo { self.bottomInfoView = [[UIView alloc] init]; [self.contentView addSubview:self.bottomInfoView]; // 标题 self.titleLabel = [[UILabel alloc] init]; self.titleLabel.textColor = [UIColor whiteColor]; self.titleLabel.font = [UIFont boldSystemFontOfSize:16]; self.titleLabel.numberOfLines = 2; [self.bottomInfoView addSubview:self.titleLabel]; // 描述 self.descriptionLabel = [[UILabel alloc] init]; self.descriptionLabel.textColor = [UIColor colorWithWhite:1.0 alpha:1]; self.descriptionLabel.font = [UIFont systemFontOfSize:15]; self.descriptionLabel.numberOfLines = 2; [self.bottomInfoView addSubview:self.descriptionLabel]; // 约束 self.bottomInfoView.translatesAutoresizingMaskIntoConstraints = NO; self.titleLabel.translatesAutoresizingMaskIntoConstraints = NO; self.descriptionLabel.translatesAutoresizingMaskIntoConstraints = NO; [NSLayoutConstraint activateConstraints:@[ [self.bottomInfoView.leadingAnchor constraintEqualToAnchor:self.contentView.leadingAnchor], [self.bottomInfoView.trailingAnchor constraintEqualToAnchor:self.contentView.trailingAnchor constant:-90], [self.bottomInfoView.bottomAnchor constraintEqualToAnchor:self.contentView.safeAreaLayoutGuide.bottomAnchor constant:-(BAR_HEIGHT+54)], [self.bottomInfoView.heightAnchor constraintGreaterThanOrEqualToConstant:80], [self.titleLabel.topAnchor constraintEqualToAnchor:self.bottomInfoView.topAnchor constant:12], [self.titleLabel.leadingAnchor constraintEqualToAnchor:self.bottomInfoView.leadingAnchor constant:16], [self.titleLabel.trailingAnchor constraintEqualToAnchor:self.bottomInfoView.trailingAnchor constant:-16], [self.descriptionLabel.topAnchor constraintEqualToAnchor:self.titleLabel.bottomAnchor constant:8], [self.descriptionLabel.leadingAnchor constraintEqualToAnchor:self.bottomInfoView.leadingAnchor constant:16], [self.descriptionLabel.trailingAnchor constraintEqualToAnchor:self.bottomInfoView.trailingAnchor constant:-16], ]]; } #pragma mark - 公开方法 - (void)configureWithDrama:(JXDramaContent *)drama { self.drama = drama; // 更新UI self.titleLabel.text = drama.title ?: @"未知标题"; self.descriptionLabel.text = drama.descriptions ?: @"暂无描述"; // 更新交互数据 [self updateLikeUI:drama.isLiked count:drama.likeCount]; [self updateFavoriteUI:drama.isFavorited count:drama.favoriteCount]; [self updateCommentCount:drama.commentCount]; } - (void)startPlay { if (!self.drama) { NSLog(@"[JXShortDramaCell] ❌ startPlay - drama为空"); return; } NSLog(@"[JXShortDramaCell] ========== 开始播放 =========="); NSLog(@"[JXShortDramaCell] Drama ID: %lld", self.drama.dramaId); NSLog(@"[JXShortDramaCell] 播放器实例: %@", self.superPlayer ? @"已存在(重用)" : @"需创建"); // 创建播放器(如果不存在) if (!self.superPlayer) { NSLog(@"[JXShortDramaCell] 创建新播放器实例"); self.superPlayer = [[JXSuperPlayer alloc] initWithContainerView:self.playerContainerView]; self.superPlayer.delegate = self; } else { NSLog(@"[JXShortDramaCell] 重用现有播放器实例"); } // 根据播放模式选择播放方式 if ([self.drama isFileIdMode]) { NSLog(@"[JXShortDramaCell] 播放模式: FileID + psign (DRM)"); // FileID + psign播放(DRM推荐) NSString *appId = self.drama.appId; // 如果没有appId,尝试从psign中提取 if (!appId || appId.length == 0) { appId = [JXSuperPlayer extractAppIdFromPsign:self.drama.psign]; NSLog(@"[JXShortDramaCell] 从psign提取appId: %@", appId); } if (!appId) { NSLog(@"[JXShortDramaCell] ❌ appId为空,无法播放"); return; } NSLog(@"[JXShortDramaCell] 播放参数:"); NSLog(@"[JXShortDramaCell] - appId: %@", appId); NSLog(@"[JXShortDramaCell] - fileId: %@", self.drama.fileId); NSLog(@"[JXShortDramaCell] - psign前20字符: %@...", [self.drama.psign substringToIndex:MIN(20, self.drama.psign.length)]); [self.superPlayer playWithAppId:appId fileId:self.drama.fileId psign:self.drama.psign]; } else if ([self.drama isUrlMode]) { // URL播放 NSLog(@"[JXShortDramaCell] 播放模式: URL"); NSLog(@"[JXShortDramaCell] URL: %@", self.drama.videoUrl); [self.superPlayer playWithURL:self.drama.videoUrl]; } else { // 显示占位符 - 使用封面作为背景 NSLog(@"[JXShortDramaCell] ⚠️ 无法播放 - 既不是FileID模式也不是URL模式"); NSLog(@"[JXShortDramaCell] Drama数据:"); NSLog(@"[JXShortDramaCell] - fileId: %@", self.drama.fileId ? @"有" : @"无"); NSLog(@"[JXShortDramaCell] - appId: %@", self.drama.appId ? @"有" : @"无"); NSLog(@"[JXShortDramaCell] - psign: %@", self.drama.psign ? @"有" : @"无"); NSLog(@"[JXShortDramaCell] - videoUrl: %@", self.drama.videoUrl ? @"有" : @"无"); if (self.drama.coverUrl && self.drama.coverUrl.length > 0) { // 创建临时的 UIImageView 显示封面 UIImageView *placeholderView = [[UIImageView alloc] initWithFrame:self.playerContainerView.bounds]; placeholderView.contentMode = UIViewContentModeScaleAspectFill; placeholderView.clipsToBounds = YES; [self.playerContainerView addSubview:placeholderView]; // 加载网络图片 dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:self.drama.coverUrl]]; UIImage *image = [UIImage imageWithData:imageData]; dispatch_async(dispatch_get_main_queue(), ^{ placeholderView.image = image; }); }); } } } - (void)stopPlay { NSLog(@"[JXShortDramaCell] stopPlay 调用 - 播放器实例:%@", self.superPlayer ? @"存在" : @"不存在"); if (self.superPlayer) { [self.superPlayer stop]; NSLog(@"[JXShortDramaCell] 播放器已停止"); } } - (void)pausePlay { if (self.superPlayer) { [self.superPlayer pause]; } } - (void)resumePlay { if (self.superPlayer) { [self.superPlayer resume]; } } - (void)updateLikeUI:(BOOL)isLiked count:(long long)count { self.likeButton.selected = isLiked; self.likeButton.tintColor = isLiked ? [UIColor systemPinkColor] : [UIColor whiteColor]; self.likeCountLabel.text = [JXShortDramaCell formattedCountWithCount:count]; } - (void)updateFavoriteUI:(BOOL)isFavorited count:(long long)count { self.favoriteButton.selected = isFavorited; self.favoriteButton.tintColor = isFavorited ? [UIColor systemYellowColor] : [UIColor whiteColor]; self.favoriteCountLabel.text = [JXShortDramaCell formattedCountWithCount:count]; } - (void)updateCommentCount:(long long)count { self.commentCountLabel.text = [JXShortDramaCell formattedCountWithCount:count]; } /** * 格式化数字显示(如 1000 -> 1K) */ + (NSString *)formattedCountWithCount:(long long)count { if (count >= 1000000) { return [NSString stringWithFormat:@"%.1fM", count / 1000000.0]; } else if (count >= 1000) { return [NSString stringWithFormat:@"%.1fK", count / 1000.0]; } return [NSString stringWithFormat:@"%lld", count]; } /** * 与ViewController调用匹配的方法 */ - (void)updateLikeCount:(NSInteger)likeCount isLiked:(BOOL)isLiked { [self updateLikeUI:isLiked count:likeCount]; } - (void)updateFavoriteCount:(NSInteger)favoriteCount isFavorited:(BOOL)isFavorited { [self updateFavoriteUI:isFavorited count:favoriteCount]; } #pragma mark - 按钮事件 - (void)handleLikeTap { NSLog(@"[JXShortDramaCell] ❤️ handleLikeTap 被调用"); if ([self.delegate respondsToSelector:@selector(shortDramaCellDidTapLike:)]) { NSLog(@"[JXShortDramaCell] ✅ delegate 响应 shortDramaCellDidTapLike"); [self.delegate shortDramaCellDidTapLike:self]; } else { NSLog(@"[JXShortDramaCell] ⚠️ delegate 不响应 shortDramaCellDidTapLike"); } } - (void)handleFavoriteTap { NSLog(@"[JXShortDramaCell] ⭐ handleFavoriteTap 被调用"); if ([self.delegate respondsToSelector:@selector(shortDramaCellDidTapFavorite:)]) { NSLog(@"[JXShortDramaCell] ✅ delegate 响应 shortDramaCellDidTapFavorite"); [self.delegate shortDramaCellDidTapFavorite:self]; } else { NSLog(@"[JXShortDramaCell] ⚠️ delegate 不响应 shortDramaCellDidTapFavorite"); } } - (void)handleCommentTap { NSLog(@"[JXShortDramaCell] 💬 handleCommentTap - 评论按钮被点击!"); NSLog(@"[JXShortDramaCell] 💬 handleCommentTap - delegate: %@", self.delegate); NSLog(@"[JXShortDramaCell] 💬 handleCommentTap - delegate class: %@", [self.delegate class]); if (self.delegate) { NSLog(@"[JXShortDramaCell] 💬 handleCommentTap - delegate 存在"); SEL selector = @selector(shortDramaCellDidTapComment:); BOOL responds = [self.delegate respondsToSelector:selector]; NSLog(@"[JXShortDramaCell] 💬 handleCommentTap - delegate 响应 shortDramaCellDidTapComment: %@", responds ? @"YES ✅" : @"NO ❌"); if (responds) { NSLog(@"[JXShortDramaCell] 💬 handleCommentTap - 调用 delegate 方法"); [self.delegate shortDramaCellDidTapComment:self]; NSLog(@"[JXShortDramaCell] 💬 handleCommentTap - delegate 方法已调用"); } else { NSLog(@"[JXShortDramaCell] ❌ handleCommentTap - delegate 不响应该方法"); } } else { NSLog(@"[JXShortDramaCell] ❌ handleCommentTap - delegate 为 nil"); } } - (void)handleCollectionTap { if ([self.delegate respondsToSelector:@selector(shortDramaCellDidTapCollection:)]) { [self.delegate shortDramaCellDidTapCollection:self]; } } - (void)handleDetailTap { if ([self.delegate respondsToSelector:@selector(shortDramaCellDidTapDetail:)]) { [self.delegate shortDramaCellDidTapDetail:self]; } } #pragma mark - JXSuperPlayerDelegate - (void)superPlayerDidChangeState:(JXSuperPlayerState)state { self.playerState = state; switch (state) { case JXSuperPlayerStatePreparing: NSLog(@"[JXShortDramaCell] 播放器状态变更: 准备中"); // 开始播放时启动超时检测 [self startPlayTimeoutTimer]; break; case JXSuperPlayerStatePlaying: NSLog(@"[JXShortDramaCell] 播放器状态变更: 播放中"); // 成功开始播放,取消超时检测 [self stopPlayTimeoutTimer]; break; case JXSuperPlayerStatePaused: NSLog(@"[JXShortDramaCell] 播放器状态变更: 暂停"); break; case JXSuperPlayerStateCompleted: NSLog(@"[JXShortDramaCell] 播放器状态变更: 播放完成"); [self stopPlayTimeoutTimer]; break; case JXSuperPlayerStateError: NSLog(@"[JXShortDramaCell] 播放器状态变更: 错误"); [self stopPlayTimeoutTimer]; break; default: break; } } // 播放超时检测 - (void)startPlayTimeoutTimer { [self stopPlayTimeoutTimer]; // 先停止之前的定时器 self.playStartTime = [NSDate date]; // 30秒超时检测 self.playTimeoutTimer = [NSTimer scheduledTimerWithTimeInterval:30.0 target:self selector:@selector(onPlayTimeout) userInfo:nil repeats:NO]; NSLog(@"[JXShortDramaCell] 启动播放超时检测: 30秒"); } - (void)stopPlayTimeoutTimer { if (self.playTimeoutTimer) { [self.playTimeoutTimer invalidate]; self.playTimeoutTimer = nil; self.playStartTime = nil; NSLog(@"[JXShortDramaCell] 停止播放超时检测"); } } - (void)onPlayTimeout { NSLog(@"[JXShortDramaCell] 播放超时!30秒内未开始播放,触发恢复机制"); // 停止定时器 [self stopPlayTimeoutTimer]; // 触发播放失败处理 if ([self.delegate respondsToSelector:@selector(shortDramaCellDidFailToPlay:)]) { [self.delegate shortDramaCellDidFailToPlay:self]; } } - (void)superPlayerDidUpdateProgress:(NSTimeInterval)currentTime duration:(NSTimeInterval)duration { // 播放进度更新(可用于显示进度条) // NSLog(@"[JXShortDramaCell] 播放进度: %.1f / %.1f", currentTime, duration); } - (void)superPlayerDidFailWithError:(NSError *)error { NSLog(@"[JXShortDramaCell] 播放失败: %@", error.localizedDescription); // 检查是否是网络相关错误 BOOL isNetworkError = [error.domain isEqualToString:NSURLErrorDomain] && (error.code == NSURLErrorTimedOut || error.code == NSURLErrorCannotConnectToHost || error.code == NSURLErrorNetworkConnectionLost || error.code == NSURLErrorNotConnectedToInternet); // 也检查播放器内部错误 BOOL isPlayerError = [error.domain isEqualToString:@"JXSuperPlayer"] || [error.domain isEqualToString:@"TXVodPlayer"]; if (isNetworkError || isPlayerError) { NSLog(@"[JXShortDramaCell] 检测到播放错误,尝试恢复: domain=%@, code=%ld", error.domain, (long)error.code); // 延迟3秒后通知控制器重新获取播放数据 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ if ([self.delegate respondsToSelector:@selector(shortDramaCellDidFailToPlay:)]) { [self.delegate shortDramaCellDidFailToPlay:self]; } }); } else { // 其他类型的错误,直接显示 NSLog(@"[JXShortDramaCell] 非网络错误,不进行重试: %@", error); } // 显示错误提示(可以在这里添加UI反馈) // TODO: 在UI上显示播放失败的提示,但不阻塞用户操作 } #pragma mark - 生命周期 - (void)dealloc { // 清理定时器 [self stopPlayTimeoutTimer]; // 清理播放器 if (self.superPlayer) { [self.superPlayer releasePlayer]; } } @end