DoubleLi

qq: 517712484 wx: ldbgliet

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
  4737 随笔 :: 2 文章 :: 542 评论 :: 1615万 阅读
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

This is a very simple demonstration of how to stream from a native application to the browser using WebRTC.

But first, a small demonstration of how a call is set up in WebRTC. A call is established by exchanging SDP and ICE information using some unspecified method. In the movie below, I simply copy-paste the required information from a 'sender' web page to a 'receiver' web page. The sender is the one that captures the webcam and streams it to the receiver where it is displayed in a video tag.

(best viewed full screen)

If you'd like to try this yourself, these are the pages:

I've noticed that the copy-pasting needs to be done rather swiftly to get it to work.

Although my hand waving skills are undoubtedly very impressive, it would be great to be able to stream something else to the browser. The following video demonstrates a small native Qt application which streams the contents of a widget to a browser. The call set up is still done using the copy-paste technique, to keep the code in the application to a minimum.

The source of this application is available in two formats:

 
  • patch against the WebRTC source tree (I used revision 5628).
     
    1. First, do the 'gclient config' and 'gclient sync' steps as described on that page.
    2. Apply the patch
    3. Go to the trunk/talk/examples/qtwebrtc_textedit directory and run the runme.sh script (runs the uic and moc commands, I didn't figure out how to do this in the gyp file)
    4. Run the ./webrtc/build/gyp_webrtc command to generate the ninja build files
    5. Run ninja to build everything
     
  • tarball containing a qmake project file to build everything.
     
    1. Make sure you've got WebRTC compiled somewhere.
    2. Extract the tarball somewhere
    3. Run 'qmake WEBRTCTRUNK=/path/to/webrtc/trunk' and make

Although the source code itself probably also works in Windows, I've only tested it on Linux and the patch/qmake file are Linux specific. For the qmake project, you may need to remove some libraries or add some extra libraries, depending on the WebRTC build settings on your platform. The project file is for Qt 5.

Big thanks to Kam for making the modified peerconnection code available, it really helped getting me started using the native WebRTC library.

 

from:http://research.edm.uhasselt.be/jori/page/Misc/QtWebRTC.html

posted on   DoubleLi  阅读(5052)  评论(0编辑  收藏  举报
编辑推荐:
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!
历史上的今天:
2017-03-26 使程序在Linux下后台运行 (关掉终端继续让程序运行的方法)
2017-03-26 Linux前台的程序转到后台执行(关闭终端而不杀死命令)
2015-03-26 让C/C++程序一次编译可以发布到多版本Linux之上
2015-03-26 linux下so动态库一些不为人知的秘密(中二)
2015-03-26 linux下so动态库一些不为人知的秘密(中)
2015-03-26 linux下so动态库一些不为人知的秘密(上)
2013-03-26 C++中int 转换成 string类型
点击右上角即可分享
微信分享提示