shogo4405 / HaishinKit.swift

Camera and Microphone streaming library via RTMP and SRT for iOS, macOS, tvOS and visionOS.
https://docs.haishinkit.com/swift/latest
BSD 3-Clause "New" or "Revised" License
2.78k stars 618 forks source link

Dailymotion connection issue #739

Closed Goule closed 4 years ago

Goule commented 4 years ago

Hello,

Describe the bug Connection on a Dailymotion RTMP URL doesn't work with the sample project.

The android library we are using had the same problem, apparently a "/" error with the connect packet : https://github.com/pedroSG94/rtmp-rtsp-stream-client-java/issues/653#issuecomment-682430512

Here is an RTMP URL to test that :

rtmp://publish.dailymotion.com/publish-dm/
x7vv28t?auth=LaBMUbmckiGndGhHZ7KwMzdQfveRb53AjIbdV8Du2v

Here is some logs :

2020-30-08 18:27:22.249 [Info] [com.haishinkit.Exsample.iOS] [LiveViewController.swift:153] rtmpStatusHandler(_:) > NetConnection.Connect.Success
2020-30-08 18:27:22.323 [Info] [com.haishinkit.Exsample.iOS] [LiveViewController.swift:153] rtmpStatusHandler(_:) > NetStream.Publish.Start
2020-30-08 18:27:22.342 [Info] [com.haishinkit.HaishinKit] [AudioConverter.swift:94] inSourceFormat > AudioStreamBasicDescription(mSampleRate: 48000.0, mFormatID: 1819304813, mFormatFlags: 12, mBytesPerPacket: 2, mFramesPerPacket: 1, mBytesPerFrame: 2, mChannelsPerFrame: 1, mBitsPerChannel: 16, mReserved: 0)
2020-30-08 18:27:22.343 [Info] [com.haishinkit.Exsample.iOS] [LiveViewController.swift:153] rtmpStatusHandler(_:) > NetConnection.Connect.Rejected
2020-30-08 18:27:22.344 [Info] [com.haishinkit.HaishinKit] [AudioConverter.swift:81] formatDescription > Optional(<CMAudioFormatDescription 0x282a14e60 [0x1d7213730]> {
    mediaType:'soun' 
    mediaSubType:'aac ' 
    mediaSpecific: {
        ASBD: {
            mSampleRate: 48000.000000 
            mFormatID: 'aac ' 
            mFormatFlags: 0x2 
            mBytesPerPacket: 0 
            mFramesPerPacket: 1024 
            mBytesPerFrame: 0 
            mChannelsPerFrame: 1 
            mBitsPerChannel: 0  } 
        cookie: {(null)} 
        ACL: {(null)}
        FormatList Array: {
            Index: 0 
            ChannelLayoutTag: 0x640001 
            ASBD: {
            mSampleRate: 48000.000000 
            mFormatID: 'aac ' 
            mFormatFlags: 0x2 
            mBytesPerPacket: 0 
            mFramesPerPacket: 1024 
            mBytesPerFrame: 0 
            mChannelsPerFrame: 1 
            mBitsPerChannel: 0  }} 
    } 
    extensions: {(null)}
})
2020-30-08 18:27:22.344 [Error] [com.haishinkit.HaishinKit] [RTMPMessage.swift:309] payload > AMF0Serializer{data: 17 bytes,position: 17,reference: HaishinKit.AMFReference}
2020-30-08 18:27:22.347 [Warn] [com.haishinkit.HaishinKit] [RTMPConnection.swift:380] on(status:) > 
2020-30-08 18:27:22.347 [Info] [com.haishinkit.Exsample.iOS] [LiveViewController.swift:153] rtmpStatusHandler(_:) > NetConnection.Connect.Closed
2020-30-08 18:27:22.348 [Info] [com.haishinkit.HaishinKit] [AudioConverter.swift:72] actualBitrate > 32000
2020-30-08 18:27:22.348 [Info] [com.haishinkit.HaishinKit] [AudioConverter.swift:81] formatDescription > nil
2020-30-08 18:27:23.464 [Info] [com.haishinkit.Exsample.iOS] [LiveViewController.swift:153] rtmpStatusHandler(_:) > NetConnection.Connect.Success
2020-30-08 18:27:23.539 [Info] [com.haishinkit.Exsample.iOS] [LiveViewController.swift:153] rtmpStatusHandler(_:) > NetStream.Publish.Start
2020-30-08 18:27:23.540 [Info] [com.haishinkit.HaishinKit] [AudioConverter.swift:94] inSourceFormat > AudioStreamBasicDescription(mSampleRate: 48000.0, mFormatID: 1819304813, mFormatFlags: 12, mBytesPerPacket: 2, mFramesPerPacket: 1, mBytesPerFrame: 2, mChannelsPerFrame: 1, mBitsPerChannel: 16, mReserved: 0)
2020-30-08 18:27:23.540 [Info] [com.haishinkit.HaishinKit] [AudioConverter.swift:81] formatDescription > Optional(<CMAudioFormatDescription 0x282a15360 [0x1d7213730]> {
    mediaType:'soun' 
    mediaSubType:'aac ' 
    mediaSpecific: {
        ASBD: {
            mSampleRate: 48000.000000 
            mFormatID: 'aac ' 
            mFormatFlags: 0x2 
            mBytesPerPacket: 0 
            mFramesPerPacket: 1024 
            mBytesPerFrame: 0 
            mChannelsPerFrame: 1 
            mBitsPerChannel: 0  } 
        cookie: {(null)} 
        ACL: {(null)}
        FormatList Array: {
            Index: 0 
            ChannelLayoutTag: 0x640001 
            ASBD: {
            mSampleRate: 48000.000000 
            mFormatID: 'aac ' 
            mFormatFlags: 0x2 
            mBytesPerPacket: 0 
            mFramesPerPacket: 1024 
            mBytesPerFrame: 0 
            mChannelsPerFrame: 1 
            mBitsPerChannel: 0  }} 
    } 
    extensions: {(null)}
})
2020-30-08 18:27:23.547 [Info] [com.haishinkit.HaishinKit] [AudioConverter.swift:72] actualBitrate > 32000
2020-30-08 18:27:23.560 [Info] [com.haishinkit.Exsample.iOS] [LiveViewController.swift:153] rtmpStatusHandler(_:) > NetConnection.Connect.Rejected
2020-30-08 18:27:23.563 [Error] [com.haishinkit.HaishinKit] [RTMPMessage.swift:309] payload > AMF0Serializer{data: 17 bytes,position: 17,reference: HaishinKit.AMFReference}
2020-30-08 18:27:23.566 [Info] [com.haishinkit.HaishinKit] [AudioConverter.swift:81] formatDescription > nil
2020-30-08 18:27:23.568 [Warn] [com.haishinkit.HaishinKit] [RTMPConnection.swift:380] on(status:) > 
2020-30-08 18:27:23.568 [Info] [com.haishinkit.Exsample.iOS] [LiveViewController.swift:153] rtmpStatusHandler(_:) > NetConnection.Connect.Closed
2020-30-08 18:27:24.757 [Info] [com.haishinkit.Exsample.iOS] [LiveViewController.swift:153] rtmpStatusHandler(_:) > NetConnection.Connect.Success
2020-30-08 18:27:24.831 [Info] [com.haishinkit.Exsample.iOS] [LiveViewController.swift:153] rtmpStatusHandler(_:) > NetStream.Publish.Start
2020-30-08 18:27:24.839 [Info] [com.haishinkit.HaishinKit] [AudioConverter.swift:94] inSourceFormat > AudioStreamBasicDescription(mSampleRate: 48000.0, mFormatID: 1819304813, mFormatFlags: 12, mBytesPerPacket: 2, mFramesPerPacket: 1, mBytesPerFrame: 2, mChannelsPerFrame: 1, mBitsPerChannel: 16, mReserved: 0)
2020-30-08 18:27:24.849 [Info] [com.haishinkit.HaishinKit] [AudioConverter.swift:81] formatDescription > Optional(<CMAudioFormatDescription 0x282a11180 [0x1d7213730]> {
    mediaType:'soun' 
    mediaSubType:'aac ' 
    mediaSpecific: {
        ASBD: {
            mSampleRate: 48000.000000 
            mFormatID: 'aac ' 
            mFormatFlags: 0x2 
            mBytesPerPacket: 0 
            mFramesPerPacket: 1024 
            mBytesPerFrame: 0 
            mChannelsPerFrame: 1 
            mBitsPerChannel: 0  } 
        cookie: {(null)} 
        ACL: {(null)}
        FormatList Array: {
            Index: 0 
            ChannelLayoutTag: 0x640001 
            ASBD: {
            mSampleRate: 48000.000000 
            mFormatID: 'aac ' 
            mFormatFlags: 0x2 
            mBytesPerPacket: 0 
            mFramesPerPacket: 1024 
            mBytesPerFrame: 0 
            mChannelsPerFrame: 1 
            mBitsPerChannel: 0  }} 
    } 
    extensions: {(null)}
})
2020-30-08 18:27:24.854 [Info] [com.haishinkit.Exsample.iOS] [LiveViewController.swift:153] rtmpStatusHandler(_:) > NetConnection.Connect.Rejected
2020-30-08 18:27:24.854 [Error] [com.haishinkit.HaishinKit] [RTMPMessage.swift:309] payload > AMF0Serializer{data: 17 bytes,position: 17,reference: HaishinKit.AMFReference}
2020-30-08 18:27:24.857 [Info] [com.haishinkit.HaishinKit] [AudioConverter.swift:72] actualBitrate > 32000
2020-30-08 18:27:24.857 [Warn] [com.haishinkit.HaishinKit] [RTMPConnection.swift:380] on(status:) > 
2020-30-08 18:27:24.857 [Info] [com.haishinkit.HaishinKit] [AudioConverter.swift:81] formatDescription > nil
2020-30-08 18:27:24.857 [Info] [com.haishinkit.Exsample.iOS] [LiveViewController.swift:153] rtmpStatusHandler(_:) > NetConnection.Connect.Closed

If you need another RTMP URL you can ask me, because verified Dailymotion account is needed to create Live.

To Reproduce

Launch a live with this RTMP URL : rtmp://publish.dailymotion.com/publish-dm/x7vv28t?auth=LaBMUbmckiGndGhHZ7KwMzdQfveRb53AjIbdV8Du2v

Have you any idea how to fix it ?

Thanks for your help :)

gouravideal commented 4 years ago

Hi @Goule were you able to fix this issue? I'm also getting the same issue, If you have fixed this please share.

Goule commented 4 years ago

It was an issue with the slash at the end of the rtmp url.

Use rtmp://publish.dailymotion.com/publish-dm instead of rtmp://publish.dailymotion.com/publish-dm/