Giter VIP home page Giter VIP logo

astsdk's Introduction

#AST SDK 使用指南

• SDK 概述

全聚星SDK(AST SDK)为iOS移动应用提供完善的视屏直播开发框架,方便第三方应用快速集成全聚星视频直播功能。SDK兼容iOS 8.0+,Demo兼容iOS 8.0+。

• 开发准备

AST SDK  通过提供静态库的方式集成到项目中,只需要手动将StarLiveLib.framework和ASTImages.bundle拖入到项目中,然后需要设置Enable Bitcode 为NO,添加libstdc.tbd库 ,最后通过CocoaPods 的podfile文件添加相应的依赖库(注1)即可使用。

注1 :开发者应根据自身项目,将不冲突的依赖库添加进工程。


初始化 SDK

在需要使用 SDK 的地方导入头文件'StarLiveLib/ASTSDK.h'

添加 SDK 初始化方法。

-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
   
**  appKey和appsocks联系客服提供,cerName推送证书名称
   [[ASTSDK sharedSDK]registerWithAppID:@"appKey" appsocks:@"appsocks" cerName:@"cerName"];

 
  }

以下所有的block回调方法中ceode=1表示是请求成功,其他数值表示请求失败并且返回的message说明了失败原因

####登录SDK 一般是放在用户登录成功后调用

[[ASTSDK sharedSDK]UserLogin:@"用户ID" nickName:@"昵称" avatar:@"头像地址链接"completion:^(NSString * _Nonnull message, NSInteger code) {
            
       NSLog(@"登录返回状态%ld",(long)code);

      
 }];
 (此处需要注意只有第一次登录设置的名字和头像有效 后期调用名字和头像不会变需要调用UserModiNickName 和 UserModiUserFace分别修改用户昵称和头像)

***特别说明以下api方法调用前必须是放在登录之后调用***


当前登录状态

-(BOOL)isLogined;

修改头像

[[ASTSDK sharedSDK]UserModiUserFace:@"http://pic.58pic.com/58pic/13/91/46/64c58PICRTg_1024.png" completion:^(NSString * _Nonnull message, NSInteger code) {
    
        NSLog(@"更换头像返回状态%ld",(long)code);
    }];

###修改昵称

[[ASTSDK sharedSDK]UserModiNickName:@"nickname" completion:^(NSString * _Nonnull message, NSInteger code) {

                NSLog(@"更换昵称返回状态%ld",(long)code);
 
    }];

###返回充值列表的数据

返回的数据说明
  • iosStrength表示充值可以获取的体力
  • priceStr表示支付价格(元)
  • rechargeId充值ID
  • 请求失败的话数组为空
[[ASTSDK sharedSDK]UserRechargeList:^(NSArray * _Nonnull dataArray) {
    
        
        for (NSDictionary *dic in dataArray) {
            
            NSLog(@"获取的充值列表%@",dic);
            
        }
    }];

###账户充值

  • rechargeId是从充值列表的数据中获取
  • transId是交易流水号 必须大于13位
[[ASTSDK sharedSDK]UserRecharge:@"1" transId:@"10000900000889" completion:^(NSString * _Nonnull message, NSInteger code) {
            
            NSLog(@"查询充值结果%ld---%@",(long)code,message);
            
        }];

###直播间确认充值按钮的点击事件的代理方法

  • 使用方法初始化SDK时候需要遵守代理ASTSDKDelegate
[ASTSDK sharedSDK].delegate=self;
  • charge是一个字典类型返回当前选中的充值额度的数据
-(void)userRecharge:(_Nonnull id)charge;

退出登录代理回调

-(void)exitSDK;

astsdk's People

Contributors

ws1227 avatar xulovepu avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.