pili-engineering / PLCameraStreamingKit

PLCameraStreamingKit 是 Pili 直播 SDK 的 iOS 推流端,是带有采集模块老版本 SDK。如果是新用户接入,建议使用 PLMediaStreamingKit。该版本支持 RTMP 推流,h.264 和 AAC 编码,硬编软编支持。具有丰富的数据和状态回调,方便用户根据自己的业务定制化开发。具有直播场景下的重要功能,如:美颜、背景音乐、水印等功能。
https://github.com/pili-engineering/PLMediaStreamingKit
Apache License 2.0
1.03k stars 254 forks source link

运行自带的Example出现报错 #10

Closed qingfeng closed 9 years ago

qingfeng commented 9 years ago

可以在真机运行起来,但是点击Start之后,出现如下报错:

error: failed to launch '/private/var/mobile/Containers/Bundle/Application/F9A1E37F-E2E2-4CBA-ACA2-8531D5E1C656/PLCameraStreamingKit.app' -- process launch failed: failed to get the task for process 967

求解。。。

Phunk87 commented 9 years ago

我在 Google 搜了这个问题,拍前三的 stackoverflow 结果: http://stackoverflow.com/questions/18913676/xcode-5-failed-to-get-the-task-for-process http://stackoverflow.com/questions/23462225/xcode-build-run-error-process-launch-failed-failed-to-get-the-task-for-proc http://stackoverflow.com/questions/11601304/xcode-failed-to-get-the-task-for-process

看起来是与证书相关,确认在使用 develop 证书,并且 scheme 中环境是 debug 而非 release.

qingfeng commented 9 years ago

感谢,可以了!但是遇到这样一个问题,我运行example.go,获取到的推流地址是:

Publish URL is: rtmp://pub.z1.glb.pili.qiniup.com/gouhuolive/gouhuolive?nonce=1430369128074326635&token=F1vEwabFEC5zO2OZfYlM2iXg6Qk=

然后把这个URL马上设置到了PLViewController.m里的PUSH_URL

但是,提示如下报错:

2015-04-30 12:45:54.226 PLCameraStreamingKit[1397:540324] CameraSource: startRunning
2015-04-30 12:45:55.027 PLCameraStreamingKit[1397:540324] MicrophoneSource: startRunning
ERROR: RTMP_ReadPacket, failed to read RTMP packet header
2015-04-30 12:45:57.159 PLCameraStreamingKit[1397:540324] Stream State: Connecting
2015-04-30 12:45:57.307 PLCameraStreamingKit[1397:540324] Stream State: Disconnected

求解,麻烦了

qingfeng commented 9 years ago

顶~ :beer:

Phunk87 commented 9 years ago

每次都会有吗?你尝试 1.1.4 的新版本,看看回调状态中是什么。

qingfeng commented 9 years ago
  1. pull最新的master代码
  2. 执行example.go获取到了最新的推流地址:
rtmp://pub.z1.glb.pili.qiniup.com/gouhuolive/gouhuolive?nonce=1430395318007779844&token=hKKWkDcT6C4-v3Wdg9JnFkTZVQs=

并写到了PUSH_URL

3.再次再手机上运行,报错确实发生了一些变化:

2015-04-30 20:02:22.630 PLCameraStreamingKit[1546:635044] CameraSource: startRunning
2015-04-30 20:02:23.453 PLCameraStreamingKit[1546:635044] MicrophoneSource: startRunning
ERROR: RTMP_ReadPacket, failed to read RTMP packet header
2015-04-30 20:02:25.498 PLCameraStreamingKit[1546:635044] Stream State: Connecting
2015-04-30 20:02:25.604 PLCameraStreamingKit[1546:635044] Stream State: Error
ERROR: RTMP_ReadPacket, failed to read RTMP packet header
2015-04-30 20:02:25.939 PLCameraStreamingKit[1546:635044] Stream State: Connecting
2015-04-30 20:02:26.066 PLCameraStreamingKit[1546:635044] Stream State: Error
ERROR: RTMP_ReadPacket, failed to read RTMP packet header
2015-04-30 20:02:26.397 PLCameraStreamingKit[1546:635044] Stream State: Connecting
2015-04-30 20:02:26.526 PLCameraStreamingKit[1546:635044] Stream State: Error
ERROR: RTMP_ReadPacket, failed to read RTMP packet header
2015-04-30 20:02:26.848 PLCameraStreamingKit[1546:635044] Stream State: Connecting
2015-04-30 20:02:26.996 PLCameraStreamingKit[1546:635044] Stream State: Error

之后就不停的开始重连了,是否是推流地址的问题?感谢

why404 commented 9 years ago

@qingfeng https://github.com/pili-io/pili-sdk-go/blob/master/example/example.go 里边包含了更新流 SetStream() 和删除流 DelStream() 的操作,一旦流的 publishKey 被修改,或者 流本身被删除,推流地址自然无效了。建议注释掉 example.go 里边关于 更新流 和 删除流 的代码片段(#L48)。

qingfeng commented 9 years ago

可以了!感谢!

qingfeng commented 9 years ago

顺便再问一个问题,这个HLS Playback URL地址,是视频结束之后的回放地址吗?大约多久会生成?感谢

why404 commented 9 years ago

@qingfeng 一个 m3u8 index 通常是 3 个 ts 切片,每个 ts 是 10s 一片,理论上,直播的过程中就可以往回看的。不过,查询时序的 segments 接口得等到推流断掉之后才能返回时间片段。

qingfeng commented 9 years ago

@why404 喔~我的意思是,执行example.go之后返回的这个HLS Playback URL,是怎么用的?

HLS Playback URL:http://hls1.z1.glb.pili.qiniuapi.com/gouhuolive/55421e50d409d2292f000184.m3u8?start=1429678551&end=1429689551
qingfeng commented 9 years ago

@why404 再顶一下关于HLS Playback的问题~现在生成的HLS Playback地址是回看地址吗?感谢

why404 commented 9 years ago

@qingfeng 抱歉没注意看消息,Sorry!

HLS Play URL 的格式是:

http://{host}/{hub}/{id}[@{preset}].m3u8

HLS Playback URL 的格式是:

http://{host}/{hub}/{id}[@{preset}].m3u8?start={start_time}&end={end_time}

@{preset} 是自定义的分辨率别名,可选,不出现在URL里边时为原始码流。

startend 这两个参数是 Unix Timestamp 数值,该值范围由 获取推流时序列表的 API 决定,参考:

https://gist.github.com/why404/706a196dab8279c2a49d#%E8%8E%B7%E5%8F%96%E7%89%87%E6%AE%B5