LiveCenterAPIManager.m 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. //
  2. // LiveCenterAPIManager.m
  3. // BuguLive
  4. //
  5. // Created by 岳克奎 on 16/12/13.
  6. // Copyright © 2016年 xfg. All rights reserved.
  7. //
  8. #import "LiveCenterAPIManager.h"
  9. @implementation LiveCenterAPIManager
  10. BogoSingletonM(Instance);
  11. #pragma mark -public methods ------------------------------------------ 公有方法区域 -----------------------------------------
  12. #pragma mark - 主播开直播API
  13. /**
  14. * 主播发起开直播的请求
  15. *
  16. * @discussion:请求的目的是获取 开直播的权限,判断直播时用的SDK等
  17. */
  18. - (void)liveCenterAPIOfShowHostLiveOfDic:(NSMutableDictionary *)dic block:(LiveAddBlock)block
  19. {
  20. [[NetHttpsManager manager] POSTWithParameters:dic SuccessBlock:^(NSDictionary *responseJson) {
  21. if ([responseJson toInt:@"status"] == 1 && [[responseJson allKeys] containsObject:@"room_id"])
  22. {
  23. int sdk_type = [responseJson toInt:@"sdk_type"];
  24. SUS_WINDOW.liveType = FW_LIVE_TYPE_HOST;
  25. SUS_WINDOW.sdkType = sdk_type;
  26. SUS_WINDOW.isHost = YES;
  27. sdk_type = [[GlobalVariables sharedInstance].appModel.sdk_type intValue];
  28. [[NSNotificationCenter defaultCenter] postNotificationName:kInvalidateHomeTimer object:nil];
  29. if (block)
  30. {
  31. block(responseJson,YES,nil);
  32. }
  33. }
  34. else
  35. {
  36. if(block)
  37. {
  38. [[BGHUDHelper sharedInstance] tipMessage:responseJson[@"error"]];
  39. block(responseJson,NO,nil);
  40. }
  41. }
  42. } FailureBlock:^(NSError *error) {
  43. if (block)
  44. {
  45. block(nil,NO,error);
  46. }
  47. }];
  48. }
  49. @end