抓娃娃版1127

ProfileCell.m 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. //
  2. // ProfileCell.m
  3. // OpenLive
  4. //
  5. // Created by GongYuhua on 2016/9/12.
  6. // Copyright © 2016年 Agora. All rights reserved.
  7. //
  8. #import "ProfileCell.h"
  9. @interface ProfileCell()
  10. @property (weak, nonatomic) IBOutlet UILabel *resLabel;
  11. @property (weak, nonatomic) IBOutlet UILabel *frameLabel;
  12. @property (weak, nonatomic) IBOutlet UILabel *bitRateLabel;
  13. @end
  14. @implementation ProfileCell
  15. - (void)updateWithProfile:(AgoraRtcVideoProfile)profile isSelected:(BOOL)isSelected {
  16. self.resLabel.text = [self resolutionOfProfile:profile];
  17. self.frameLabel.text = [self fpsOfProfile:profile];
  18. self.bitRateLabel.text = [self bitRateOfProfile:profile];
  19. self.backgroundColor = isSelected ? [UIColor colorWithRed:0 green:0 blue:0.5 alpha:0.3] : [UIColor whiteColor];
  20. }
  21. - (NSString *)resolutionOfProfile:(AgoraRtcVideoProfile)profile {
  22. switch (profile) {
  23. case AgoraRtc_VideoProfile_120P: return @"160×120"; break;
  24. case AgoraRtc_VideoProfile_180P: return @"320×180"; break;
  25. case AgoraRtc_VideoProfile_240P: return @"320×240"; break;
  26. case AgoraRtc_VideoProfile_360P: return @"640×360"; break;
  27. case AgoraRtc_VideoProfile_480P: return @"640×480"; break;
  28. case AgoraRtc_VideoProfile_720P: return @"1280×720"; break;
  29. default: return @""; break;
  30. }
  31. }
  32. - (NSString *)fpsOfProfile:(AgoraRtcVideoProfile)profile {
  33. return @"15";
  34. }
  35. - (NSString *)bitRateOfProfile:(AgoraRtcVideoProfile)profile {
  36. switch (profile) {
  37. case AgoraRtc_VideoProfile_120P: return @"65"; break;
  38. case AgoraRtc_VideoProfile_180P: return @"140"; break;
  39. case AgoraRtc_VideoProfile_240P: return @"200"; break;
  40. case AgoraRtc_VideoProfile_360P: return @"400"; break;
  41. case AgoraRtc_VideoProfile_480P: return @"500"; break;
  42. case AgoraRtc_VideoProfile_720P: return @"1130"; break;
  43. default: return @""; break;
  44. }
  45. }
  46. @end