notedit / media-server-go-demo

webrtc media server go demo
MIT License
212 stars 64 forks source link

Can not play the stream on the web page #8

Closed diepchicuong closed 5 years ago

diepchicuong commented 5 years ago

I setup the sample to the Google Cloud VPS running CentOS. I changed a bit in your code to enable the https using autotls with Let's Encrypt and a free subdomain. Then I added the ICE servers to the page

iceServers: [
    {urls: "stun:stun.1.google.com:19302"},
    {urls: "turn:numb.viagenie.ca", credential: "muazkh", username: "webrtc@live.com"}
]

Then I use another server to push the rtmp stream using ffmpeg

ffmpeg -i bbb_sunflower_1080p_30fps_normal.mp4 -vcodec libx264 -preset ultrafast -acodec libfdk_aac -ar 44100 -b:a 128k -b:v 512k -s 640x480 -profile:v baseline -level 3.0 -maxrate 1000k -bufsize 64k -f flv rtmp://<myhost>:1935/live/test

I get his warning with rtmp stream

(rtmp-to-webrtc:7717): GStreamer-WARNING **: 08:27:04.697: gstpad.c:5079:store_sticky_event:<avdec_aac0:src> Sticky event misordering, got 'segment' before 'caps'

I open the web page and nothing is displayed Here is the full log

[0x7fb4f07f7880][1562056148.054][LOG]>DTLSConnection::Initialize()
[0x7fb4f07f7880][1562056148.055][LOG]>DTLSConnection::GenerateCertificate()
[0x7fb4f07f7880][1562056148.064][LOG]<DTLSConnection::GenerateCertificate()
[0x7fb4f07f7880][1562056148.064][LOG]<DTLSConnection::Initialize(5)
[0x7fb4f07f7880][1562056148.077][LOG]>RTPBundleTransport::Init()
[0x7fb4f07f7880][1562056148.077][LOG]-RTPBundleTransport::Init() | Got port [39834]
[0x7fb4f07f7880][1562056148.077][LOG]<RTPBundleTransport::Init()
[GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.

[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
 - using env:   export GIN_MODE=release
 - using code:  gin.SetMode(gin.ReleaseMode)

[GIN-debug] GET    /channel                  --> main.channel (3 handlers)
[GIN-debug] GET    /                         --> main.index (3 handlers)
[0x7fb4e1ffb700][1562056154.989][LOG]>RTPTransport::Init()
[0x7fb4e1ffb700][1562056154.989][LOG]-RTPTransport::Init() | Got ports [48124,48125]
[0x7fb4e1ffb700][1562056154.989][LOG]<RTPTransport::Init()
[0x7fb4e1ffb700][1562056154.999][LOG]>RTPTransport::Init()
[0x7fb4e1ffb700][1562056154.999][LOG]-RTPTransport::Init() | Got ports [56935,56936]
[0x7fb4e1ffb700][1562056154.999][LOG]<RTPTransport::Init()
[0x7fb4db7fe700][1562056155.005][LOG]-RTPTransport::ReadRTP() | NAT: received packet from new source [127.0.0.1:40736]
[0x7fb4db7fe700][1562056155.005][LOG]-RTPSession::onRemotePeer(Video) [127.0.0.1:40736]
[0x7fb4db7fe700][1562056155.006][LOG]-RTPSession::onRTPPacket(Video) | New SSRC [new:2682374516,old:0]
[0x7fb4db7fe700][1562056155.006][LOG]-RemoteRateEstimator adding stream [ssrc:2682374516]

(rtmp-to-webrtc:7775): GStreamer-WARNING **: 08:29:15.018: gstpad.c:5079:store_sticky_event:<avdec_aac0:src> Sticky event misordering, got 'segment' before 'caps'

(rtmp-to-webrtc:7775): GStreamer-WARNING **: 08:29:15.018: gstpad.c:5079:store_sticky_event:<'':decodepad0> Sticky event misordering, got 'segment' before 'caps'

(rtmp-to-webrtc:7775): GStreamer-WARNING **: 08:29:15.020: gstpad.c:5079:store_sticky_event:<src_0:proxypad1> Sticky event misordering, got 'segment' before 'caps'
[0x7fb4cb7fe700][1562056155.025][LOG]-RTPTransport::ReadRTP() | NAT: received packet from new source [127.0.0.1:47664]
[0x7fb4cb7fe700][1562056155.025][LOG]-RTPSession::onRemotePeer(Audio) [127.0.0.1:47664]
[0x7fb4cb7fe700][1562056155.025][LOG]-RTPSession::onRTPPacket(Audio) | New SSRC [new:24309093,old:0]
[0x7fb4cb7fe700][1562056155.025][LOG]-RemoteRateEstimator adding stream [ssrc:24309093]
helloworld
[GIN] 2019/07/02 - 08:29:31 | 200 |     561.978µs |    101.99.40.46 | GET      /
[0x7fb4e0ff9700][1562056171.333][LOG]-RTPBundleTransport::AddICETransport [52fdfc072182654f:3Ku3]
[0x7fb4e0ff9700][1562056171.333][LOG]-RemoteRateEstimator adding stream [ssrc:0]
[0x7fb4e0ff9700][1562056171.333][LOG]-DTLSConnection::SetSRTPProtectionProfiles() [profiles:'']
[0x7fb4e0ff9700][1562056171.333][LOG]-DTLSICETransport::SetLocalSTUNCredentials() | [frag:52fdfc072182654f,pwd:163f5f0f9a621d729566c74d10037c4d7bbb0407d1e2c649]
[0x7fb4e0ff9700][1562056171.333][LOG]-DTLSICETransport::SetRemoteSTUNCredentials() |  [frag:3Ku3,pwd:ZIWiDuPA022uEiIgXX/r9b76]
[0x7fb4e0ff9700][1562056171.333][LOG]-DTLSICETransport::SetRemoteCryptoDTLS | [setup:actpass,hash:sha-256,fingerprint:D8:7B:10:BF:9F:99:2D:9D:23:22:A8:70:73:B9:4E:D7:E8:AB:66:C1:2E:86:6B:E1:BE:D2:8F:E9:00:DD:0A:8A]
[0x7fb4e0ff9700][1562056171.333][LOG]-DTLSConnection::SetRemoteSetup() | [remote:2]
[0x7fb4e0ff9700][1562056171.333][LOG]>DTLSConnection::Init()
[0x7fb4e0ff9700][1562056171.333][LOG]<DTLSConnection::Init()
[0x7fb4e0ff9700][1562056171.334][LOG]-DTLSICETransport::AddOutgoingSourceGroup() [group:0x7fb4a0017ba0,ssrc:1000000001,fec:0,rtx:0]
[0x7fb4e0ff9700][1562056171.334][LOG]-DTLSICETransport::AddOutgoingSourceGroup() [group:0x7fb4a0018af0,ssrc:1000000002,fec:0,rtx:0]
[0x7fb4e2ffd700][1562056173.559][LOG]-DTLSConnection::onSSLInfo() | DTLS handshake done
[0x7fb4e2ffd700][1562056173.559][LOG]-DTLSICETransport::onDTLSSetup() [suite:1]
[0x7fb4e2ffd700][1562056173.559][LOG]-DTLSICETransport::SetLocalCryptoSDES() | [suite:AES_CM_128_HMAC_SHA1_80]
[0x7fb4e2ffd700][1562056173.559][LOG]-SRTPSession::AddStream() | [ssrc:1000000001,OK]
[0x7fb4e2ffd700][1562056173.559][LOG]-SRTPSession::AddStream() | [ssrc:1000000002,OK]
[0x7fb4e2ffd700][1562056173.559][LOG]-DTLSICETransport::SetRemoteCryptoSDES() | [suite:AES_CM_128_HMAC_SHA1_80]
OnDTLSStateChange 2