Code Monkey home page Code Monkey logo

letvplayer's Introduction

乐视视频播放SDK

安装方式

use_frameworks!

pod 'LetvPlayer', :git => '[email protected]:phoenixbull/LetvPlayer.git'

项目配置

1、打开项目中的info.plist文件,在其中添加一个字典类型的项目App Transport Security Settings,然后在其中添加一个key:Allow Arbitrary Loads,其值为YES.如下所示:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

2、配置依赖系统类库 分别点击: Target-> Build Phases -> Link Binary With Libraries 增加 libc++.tbd 类库即可

SDK使用

1、 SDK初始化

#import <LetvPlayer/LetvPlayer.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    LetvPlayerManager_Initialize(@"test Demo");// 产品线标示
    return YES;
}

2、具体调用 继承LetvPlayerSdkControllerProtocol 协议 声明 LetvPlayerSdkController *player 对象

@interface xxxxxxxxxxx ()<LetvPlayerSdkControllerProtocol>
@property (nonatomic, strong) LetvPlayerSdkController *player;
@end


self.player = [[LetvPlayerSdkController alloc] initWithVid:@"66901427" p2p:YES streamCode:LetvMobilePlayerStreamCodeSD];
self.player.delegate = self;
[self.player startProcess];

- (void)LetvMobilePlayerControllerSuccess:(NSString *)url useP2p:(BOOL)p2p metadata:(NSDictionary *)metaDict
{
    NSLog(@"request success p2p status: %d  url is %@",p2p,url);
    self.playerView  = [[VideoPlayerView alloc] initWithFrame:CGRectMake(0, 44+20, self.view.frame.size.width, 350) andPath:url];
    [self.view addSubview:self.playerView];
}

- (void)LetvMobilePlayerControllerFailed:(NSError *)error useP2p:(BOOL)p2p
{
    NSLog(@"request failed p2p status: %d  err is %@",p2p,error);

}

3、具体参数说明

[[LetvPlayerSdkController alloc] initWithVid:@"66901427" p2p:YES streamCode:LetvMobilePlayerStreamCodeSD];

参数 类型 描述 备注
vid NSString 对应乐视视频的vid 服务接口提供
p2p BOOL 是否返回p2p流地址 YES: 返回支持p2p播放的流地址 NO: 返回CDN播放流地址
streamCode LetvMobilePlayerStreamCode 清晰度 LetvMobilePlayerStreamCodeLD : 渣清 LetvMobilePlayerStreamCodeMD : 流畅 LetvMobilePlayerStreamCodeSD : 标清 LetvMobilePlayerStreamCodeHD : 高清 LetvMobilePlayerStreamCodeTD : 超清
  • (void)LetvMobilePlayerControllerSuccess:(NSString *)url useP2p:(BOOL)p2p metadata:(NSDictionary *)metaDict
参数 类型 描述 备注
url NSString 播放流地址
p2p BOOL 是否返回p2p流地址 YES: 返回支持p2p播放的流地址 NO: 返回CDN播放流地址
metaDict NSDictionary 数据源 可忽略,排查问题用

LetvMobilePlayerControllerFailed:(NSError *)error useP2p:(BOOL)p2p

参数 类型 描述 备注
error NSError 错误信息
p2p BOOL 是否返回p2p流地址 YES: 返回支持p2p播放的流地址 NO: 返回CDN播放流地址

letvplayer's People

Contributors

phoenixbull avatar

Watchers

 avatar

Forkers

feeloc

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.