mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-29 14:45:55 +08:00
添加Rtmp推流示例
This commit is contained in:
parent
568d8ad53f
commit
8f847ffb78
@ -43,9 +43,13 @@ int main(int argc,char *argv[]){
|
||||
//媒体源"app/stream"已经注册,这时方可新建一个RtmpPusher对象并绑定该媒体源
|
||||
const_cast<RtmpPusher::Ptr &>(pusher).reset(new RtmpPusher(app,stream));
|
||||
|
||||
pusher->setOnShutdown([](const SockException &ex){
|
||||
WarnL << "已断开与服务器连接:" << ex.getErrCode() << " " << ex.what();
|
||||
});
|
||||
|
||||
pusher->setOnPublished([](const SockException &ex){
|
||||
if(ex){
|
||||
WarnL << "发布失败:" << ex.what();
|
||||
WarnL << "发布失败:" << ex.getErrCode() << " "<< ex.what();
|
||||
}else{
|
||||
InfoL << "发布成功,请用播放器打开:rtmp://jizan.iok.la/live/test";
|
||||
}
|
||||
@ -54,7 +58,6 @@ int main(int argc,char *argv[]){
|
||||
//推流地址,请改成你自己的服务器。
|
||||
//这个范例地址(也是基于mediakit)是可用的,但是带宽只有1mb,访问可能很卡顿。
|
||||
pusher->publish("rtmp://jizan.iok.la/live/test");
|
||||
//如果你想监听RtmpPusher的相关事件,请派生之并重载 onShutdown 与 onPlayResult方法
|
||||
});
|
||||
|
||||
EventPoller::Instance().runLoop();
|
||||
|
Loading…
Reference in New Issue
Block a user