屏幕共享demo能够在iPhone手机启动,但是没有数据传输

使用X及7 plus都能够运行demo,但是都没有数据流传输

请问没有数据流传输是指什么?具体现象是远端用户加入同一频道,看不到该用户屏幕共享的内容吗?

声网的通话记录里没有记录,我查看了Wi-Fi流量监测也没有看到手机发出数据

那应该是加入频道失败了吧。请提供 SDK log,我们来排查一下:https://docs.agora.io/cn/faq/logfile

建议先自查:
项目是否有启用 app 证书?如果启用了, joinChannel 时必须传入 Token。

完全按照你们GitHub上的步骤完成打包操作及运行,还是没有数据传输,设备日志也没有找到对应app的

OpenLive app是可以传输的,是否是我打包APP时有什么不对的地方?

你的屏幕共享 demo 地址发我一下哈。另外控制台打印是否有报错?


这个是demo地址,控制台我没有看到错误

请问你是用真机测试的么?屏幕共享不支持模拟器的哦

用的真机,都是打包到自己手机上测试的

我们这边本地测试是好的,没有问题。

  1. 请看下按照下述方法,是否可以找到日志?
    App log: xcode → window → Devices→选中相关设备 → 选中相应应用 → 应用列表下方设置按键 → Download Container → 已下载文件右键选择显示包内容 → AppData → Libary → Caches → agorasdk.log
  2. 请问你集成的是什么版本的 SDK?该 Demo 适配的是官网的 v3.0.0:
    https://download.agora.io/sdk/release/Agora_Native_SDK_for_iOS_v3_0_0_1_FULL.zip?_ga=2.248675207.1619566875.1587217455-1583961819.1580439641
  3. 断点调试看下 joinChannel 的执行结果是什么?

你们使用的是什么机型?我再试试

image

为啥我导出的文件没有日志文件

SKView: ignoreRenderSyncInLayoutSubviews is NO. Call _renderSynchronouslyForTime without handler

要不你删除本地项目,重新下载测试一下。按照如下步骤:

  1. 新建一个没有启用 app 证书的项目,将 AppID 填写进 KeyCenter.swift:
static let AppId: String = <#Your App Id#>
// 如果你没有打开Token功能,token可以直接给nil
static var Token: String? = nil
  1. 通过 这个链接 下载 SDK ,解压后将其中 libs 文件夹中的下列文件拷贝到 iOS&macOS/libs/iOS 文件夹下。
  • AgoraRtcKit.framework
  • AgoraRtcCryptoLoader.framework
  • libcrypto.a
  1. 使用 Xcode 打开 Agora-Screen-Sharing-iOS.xcodeproj,连接 iPhone/iPad 测试设备,设置有效的开发者签名后即可运行。

可以了,谢谢

不客气

问一下为何我跑的这个demo无法触发SampleHandler里的回调

你参考一下 guide.md 的内容,应该是要自己实现的

Create the SampleHandler Class

SampleHandler.swift defines and connects application functionality to the AgoraUploader class.

The SampleHandler methods are contained within its RPBroadcastSampleHandler subclass.

import ReplayKit

class SampleHandler: RPBroadcastSampleHandler {

	...
	
}

The broadcastStarted() method starts the broadcast.

Check if the channelName for setupInfo is null.

  • If the channelName is not null, start the broadcast with channel using AgoraUploader.startBroadcast().
  • If the channelName is null, start the broadcast with the static string channel using AgoraUploader.startBroadcast().
    override func broadcastStarted(withSetupInfo setupInfo: [String : NSObject]?) {
        
        if let setupInfo = setupInfo, let channel = setupInfo["channelName"] as? String {
            //In-App Screen Capture
            AgoraUploader.startBroadcast(to: channel)
        } else {
            //iOS Screen Record and Broadcast
            AgoraUploader.startBroadcast(to: "channel")
        }
    }

The broadcastFinished() method stops the broadcast using AgoraUploader.stopBroadcast().

    override func broadcastFinished() {
        AgoraUploader.stopBroadcast()
    }

The broadcastPaused() and broadcastResumed() methods are used to manage an existing broadcast stream.

    override func broadcastPaused() {
        // User has requested to pause the broadcast. Samples will stop being delivered.
    }
    
    override func broadcastResumed() {
        // User has requested to resume the broadcast. Samples delivery will resume.
    }

The processSampleBuffer() method processes the sampleBuffer for the broadcast.

Asynchronously check for the value of sampleBufferType using DispatchQueue.main.async and call the appropriate method.

Value Method Description
RPSampleBufferType.video AgoraUploader.sendVideoBuffer(sampleBuffer) The sample is a video buffer.
RPSampleBufferType.audioApp AgoraUploader.sendAudioAppBuffer(sampleBuffer) The sample is an audio buffer from the application.
RPSampleBufferType.audioMic AgoraUploader.sendAudioMicBuffer(sampleBuffer) The sample is an audio buffer from the microphone.
    override func processSampleBuffer(_ sampleBuffer: CMSampleBuffer, with sampleBufferType: RPSampleBufferType) {
        DispatchQueue.main.async {
            switch sampleBufferType {
            case RPSampleBufferType.video:
                AgoraUploader.sendVideoBuffer(sampleBuffer)
                break
            case RPSampleBufferType.audioApp:
                AgoraUploader.sendAudioAppBuffer(sampleBuffer)
                break
            case RPSampleBufferType.audioMic:
                AgoraUploader.sendAudioMicBuffer(sampleBuffer)
                break
            }
        }
    }