我正在尝试使用Yasea RTMP编码器连接到youtube流。以下是我的流URL。 我正面临与此问题中定义的问题相同的问题。 Youtube Video Not Showing in Panel。 我也使用了其他RTMP编码器,但是相同的代码也面临相同的问题。 从下面的日志中可以看到,该库表示该库已连接到服务器。但是什么也没发生。请帮忙,我在过去的2天里一直停留在此
GoLive.java
publisher = new SrsPublisher((SrsCameraView) findViewById(R.id.glsurfaceview_camera));
publisher.setEncodeHandler(new SrsEncodeHandler(this));
publisher.setRtmpHandler(new RtmpHandler(this));
publisher.setPreviewResolution(640, 360);
publisher.setOutputResolution(360, 640);
publisher.setVideoHDMode();
publisher.startCamera();
startStream.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
publisher.startPublish("rtmp://a.rtmp.youtube.com/live2/aecb-zc56-rexy-e09z");
publisher.startCamera();
Toast.makeText(LiveStreamPublisher.this, "Clicked", Toast.LENGTH_SHORT).show();
}
});
YoutubeApi.java文件
LiveBroadcastSnippet broadcastSnippet = new LiveBroadcastSnippet();
broadcastSnippet.setTitle(name);
broadcastSnippet.setDescription(description);
broadcastSnippet.setScheduledStartTime(new DateTime(futureDate));
LiveBroadcastContentDetails contentDetails = new LiveBroadcastContentDetails();
MonitorStreamInfo monitorStream = new MonitorStreamInfo();
monitorStream.setEnableMonitorStream(false);
contentDetails.setMonitorStream(monitorStream);
// Create LiveBroadcastStatus with privacy status.
LiveBroadcastStatus status = new LiveBroadcastStatus();
status.setPrivacyStatus(privacy);
LiveBroadcast broadcast = new LiveBroadcast();
broadcast.setKind("youtube#liveBroadcast");
broadcast.setSnippet(broadcastSnippet);
broadcast.setStatus(status);
broadcast.setContentDetails(contentDetails);
// Create the insert request
YouTube.LiveBroadcasts.Insert liveBroadcastInsert = youtube
.liveBroadcasts().insert("snippet,status,contentDetails",
broadcast);
// Request is executed and inserted broadcast is returned
LiveBroadcast returnedBroadcast = liveBroadcastInsert.execute();
// Create a snippet with title.
LiveStreamSnippet streamSnippet = new LiveStreamSnippet();
streamSnippet.setTitle(name);
// Create content distribution network with format and ingestion
// type.
CdnSettings cdn = new CdnSettings();
cdn.setFormat("1080p");
cdn.setIngestionType("rtmp");
LiveStream stream = new LiveStream();
stream.setKind("youtube#liveStream");
stream.setSnippet(streamSnippet);
stream.setCdn(cdn);
// Create the insert request
YouTube.LiveStreams.Insert liveStreamInsert = youtube.liveStreams()
.insert("snippet,cdn", stream);
// Request is executed and inserted stream is returned
LiveStream returnedStream = liveStreamInsert.execute();
String ingestionAddress = returnedStream.getCdn().getIngestionInfo().getIngestionAddress();
String streamName = returnedStream.getCdn().getIngestionInfo().getStreamName();
// Create the bind request
YouTube.LiveBroadcasts.Bind liveBroadcastBind = youtube
.liveBroadcasts().bind(returnedBroadcast.getId(),
"id,contentDetails");
liveBroadcastBind.setStreamId(returnedStream.getId());
// Request is executed and bound broadcast is returned
liveBroadcastBind.execute();
rtmp://a.rtmp.youtube.com/live2/aecb-zc56-rexy-e09z
I/SrsFlvMuxer: worker: connecting to RTMP server by url=rtmp://a.rtmp.youtube.com/live2/aecb-zc56-rexy-e09z
D/RtmpConnection: connect() called. Host: a.rtmp.youtube.com, port: 1935, appName: live2, publishPath: aecb-zc56-rexy-e09z
D/HwRTBlurUtils: check blur style for HwToast-Toast, themeResId : 0x7f0e00fb, context : com.decibal.pc.playlive.LiveStreamPublisher@b12d434, Nhwext : 6, get Blur : disable with , android.graphics.drawable.NinePatchDrawable@2e04778
D/OpenGLRenderer: HWUI Binary is enabled
W/ViewRootImpl[Toast]: EGLdebug relayoutWindow Surface isSurface(name=null) (appName =com.decibal.pc.playlive) ( mSurfaceControllerIsValid =false) (mNativeObject =0)/@0xc1e5689,viewVisibility is0
W/ViewRootImpl[Toast]: EGLdebug relayoutWindow Surface isSurface(name=null) (appName =com.decibal.pc.playlive) ( mSurfaceControllerIsValid =true) (mNativeObject =7640a61000)/@0xc1e5689,relayoutResult is7
W/ViewRootImpl[Toast]: EGLdebug Surface isSurface(name=null) (appName =com.decibal.pc.playlive) ( mSurfaceControllerIsValid =true) (mNativeObject =7640a61000)/@0xc1e5689
D/mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, egl_color_buffer_format *, EGLBoolean) returns 0x3000
D/OpenGLRenderer: HWUI Binary is enabled
D/RtmpConnection: connect(): socket connection established, doing handhake...
D/Handshake: writeC0
writeC1
writeC1(): Calculating digest offset
writeC1(): (real value of) digestOffset: 274
writeC1(): recalculated digestOffset: 1050
D/Handshake: writeC1(): digestOffsetBytes: 000013FF
D/Handshake: partBeforeDigest(): size: 1050
D/Handshake: writeC1(): Writing timestamp and Flash Player version
partAfterDigest(): size: 454
D/Handshake: copying digest offset bytes in partBeforeDigest
writeC1(): Calculating digest
D/Handshake: writeC1(): writing C1 packet
D/Handshake: readS0
D/Handshake: readS1
readS1(): S1 total bytes read OK
writeC2
readS2
D/Handshake: readS2(): S2 total bytes read OK
D/RtmpConnection: connect(): handshake done
D/RtmpConnection: rtmpConnect(): Building 'connect' invoke packet
D/RtmpConnection: starting main rx handler loop
D/RtmpConnection: wrote packet: RTMP Command (command: connect, transaction ID: 1), size: 253
D/RTMPURL: onRtmpConnecting: Connecting
D/RtmpConnection: handleRxPacketLoop(): Setting acknowledgement window size: 2500000
D/RtmpConnection: handleRxPacketLoop(): Send acknowledgement window size: 10000000
D/RtmpConnection: wrote packet: RTMP Window Acknowledgment Size, size: 4
D/RtmpDecoder: readPacket(): Setting chunk size to: 256
D/RtmpConnection: handleRxInvoke: Got result for invoked method: connect
D/RtmpConnection: createStream(): Sending releaseStream command...
D/RtmpConnection: wrote packet: RTMP Command (command: releaseStream, transaction ID: 2), size: 48
D/RtmpConnection: handleRxInvoke(): 'onBWDone'
D/RtmpConnection: createStream(): Sending FCPublish command...
D/RtmpConnection: wrote packet: RTMP Command (command: FCPublish, transaction ID: 3), size: 44
D/RtmpConnection: createStream(): Sending createStream command...
wrote packet: RTMP Command (command: createStream, transaction ID: 4), size: 25
W/libEGL: EGLNativeWindowType 0x7640a61010 disconnect failed
D/RtmpConnection: handleRxInvoke: Got result for invoked method: createStream
handleRxInvoke(): Stream ID to publish: 1
fmlePublish(): Sending publish command...
D/RtmpConnection: wrote packet: RTMP Command (command: publish, transaction ID: 0), size: 49
D/RtmpConnection: handleRxInvoke(): onStatus NetStream.Publish.Start
onMetaData(): Sending empty onMetaData...
D/RtmpConnection: wrote packet: com.github.faucamp.simplertmp.packets.Data@10dfeaf, size: 238
D/RTMPURL: onRtmpConnected: Connected
I/zygote64: Do full code cache collection, code=504KB, data=358KB
I/zygote64: After code cache collection, code=504KB, data=298KB
I/zygote64: Do partial code cache collection, code=504KB, data=301KB
I/zygote64: After code cache collection, code=504KB, data=301KB
Increasing code cache capacity to 2MB