Giter Club home page Giter Club logo

pili-ios-camera-recorder's Introduction

PLRecorderKit

PLRecorderKit 是为 pili.io 流媒体云服务提供的一套推送直播流 SDK, 旨在解决 iOS 端快速、轻松实现 iOS 设备利用摄像头直播接入,便于 pili.io 的开发者专注于产品业务本身,而不必在技术细节上花费不必要的时间。

内容摘要

1 快速开始

先来看看 PLRecroderKit 接入的步骤

1.1 配置工程

1.1.1 二进制包方式

  • 下载 PLRecorderKit 的 release zip 文件;
  • 解压后得到 libPLRecorderKit.a 和 其 include 头文件;
  • 将 libPLRecorderKit.a 和 include 头文件选中并拖拽到自己的 Xcode 工程中;
  • 添加依赖库:
    • AVFoundation.framework
    • AudioToolbox.framework
    • CFNetwork.framework
    • CoreGraphics.framework
    • CoreMedia.framework
    • Foundation.framework
    • OpenGLES.framework
    • VideoToolbox.framewrok
  • 添加 search path
    • 在工程的 Build Settings / Header Search Paths 下添加 include 目录的相对路径
  • 编译并开始你的工作吧

1.1.2 源码方式

  • 添加 PLRecorderKit 为你的项目 submodule
git submodule add https://github.com/pili-io/pili-ios-camera-recorder.git /Vendor/pili-ios-camera-recorder.git
  • 添加 PLRecorderKit.xcodeproj 为你的 iOS 工程的子工程
  • 在 Build Phases / Target Dependecies 中添加 PLRecorderKit-Universal
  • 在 Build Phases / Link Binary With Libraries 中添加以下依赖库
    • libPLRecorderKit.a
    • AVFoundation.framework
    • AudioToolbox.framework
    • CFNetwork.framework
    • CoreGraphics.framework
    • CoreMedia.framework
    • Foundation.framework
    • OpenGLES.framework
    • VideoToolbox.framewrok
  • 编译并开始你的工作吧

1.2 示例代码

在需要的地方添加

#import <PLRecorderKit/PLRecorderKit.h>

PLCaptureManager 是核心类,你只需要关注并使用这个类就可以完成通过摄像头推流、预览的工作

推流前务必要先检查摄像头授权,并记得设置预览界面

	// 检查摄像头是否有授权
	PLCaptureDeviceAuthorizedStatus status = [PLCaptureManager captureDeviceAuthorizedStatus];
    
    if (PLCaptureDeviceAuthorizedStatusUnknow == status) {
        [PLCaptureManager requestCaptureDeviceAccessWithCompletionHandler:^(BOOL granted) {
            if (granted) {
                dispatch_async(dispatch_get_main_queue(), ^{
                    [PLCaptureManager sharedManager].previewView = self.previewView;
                });
            }
        }];
    } else if (PLCaptureDeviceAuthorizedStatusGranted == status) {
        [PLCaptureManager sharedManager].previewView = self.previewView;
    } else {
    	// 处理未授权的情况
    }

设置推流地址,这里的推流地址应该是你自己的服务端通过 pili.io 请求到的

    // 设置推流地址
    [PLCaptureManager sharedManager].rtmpPushURL = [NSURL URLWithString:@"YOUR_RTMP_PUSH_URL_HERE"];

推流操作

    // 开始推流
    [[PLCaptureManager sharedManager] connect];
    // 停止推流
    [[PLCaptureManager sharedManager] disconnect];

2 系统要求

  • iOS Target : >= iOS 7

3 版本历史

  • 1.0.0
    • 完成基本的推流、预览功能

pili-ios-camera-recorder's People

Contributors

why404 avatar yuyedaidao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.