glomex 1.0.0

glomex 1.0.0

Valeriy HerasymenkoGlomex Service 维护。



glomex 1.0.0

glomex/content-sdk

Carthage compatible CI Status Version License Platform

演示

要运行示例项目,请克隆仓库,并首先从 Example 目录运行 pod install

要求

安装

CocoaPods

Content SDK 通过 CocoaPods 提供。要安装它,只需将以下行添加到 Podfile

pod 'glomex/content-sdk'

Carthage

ContentSdk 添加到您的 Cartfile。

github "glomex/content-sdk"

运行 carthage 以构建框架,并将构建的 ContentSdk.framework 拖到您的 Xcode 项目中。

集成

ContentSdk.load() 用于加载数据。如果内容加载成功,会将 Content 传递给 callback,如果失败,则返回 error 以处理错误结果

import glomex

var video: Content?
var errorDescription: String?

let config = ContentConfig(content_id: contentId, integration_id: integrationId, page_url: pageUrl)
player.playWithURL(URL(string: url)!)

ContentSdk.load(config: config) { [weak self] (content, error) in
    if let error = error {
        switch error {
        case ContentSdkError.configError:
            self?.errorDescription = "configError"
        case ContentSdkError.newrorkError:
            self?.errorDescription = "newrorkError"
        case ContentSdkError.serverError(let reason):
            self?.errorDescription = "serverError: \(reason)"
        default:
            break
        }
        return
    }
    self?.video = content
}

通过 content.getSources() 使用 Content 获取资源

跟踪内容事件

  • 使用 content.trackContentBegin() 来跟踪内容开始事件
  • 使用 content.trackAdBegin(adRollName: AdRollName.preroll) 通过类型来跟踪广告开始事件

原作者

[email protected],

许可证

GlomexContentSdk 在 MIT 许可证下可用。有关更多信息,请参阅 LICENSE 文件。