Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introduction to WebRTC

Gen
March 04, 2022

Introduction to WebRTC

Web real time communication

Gen

March 04, 2022
Tweet

More Decks by Gen

Other Decks in Technology

Transcript

  1. IAM Short introduction • Frontend engineer • ex- fl ash

    author • Experiences in creative interactive web contents • Like stacking games (doesn’t mean I play them!) • NEED PS5 NOW! @zenoplex
  2. My Routine 24h schedule pie chart FreeTime Bathtime Activity Tutor

    Dinner Prepare Dinner Pickup Work Lunch Work Walk Bedtime
  3. Preface Why did I choose such topic • Covid-19 spurred

    remote-work • Curious of video conferencing technology and its limit • How much did technology improve since I’ve last touched Flash Communication Server which could do real-time video chat?
  4. WebRTC De fi nition • Web Real Time Communication •

    W3C standard (open-sourced by Google) • P2P Video/audio communication between browsers and devices • Send data other than media (DataChannel) • Access via javascript API without requiring plugins or install
  5. Signaling Before establishing p2p negotiation • Not part of WebRTC

    specs • Provides information(s) needed to connect clients • Room id • STUN/TURN server information • etc https://www.html5rocks.com/en/tutorials/webrtc/infrastructure/
  6. STUN Session Traversal Utilities for NAT • WebRTC client does

    not know public ip address by itself • Responsible to reply public ip address to WebRTC client • Almost always required in real world application https://www.html5rocks.com/en/tutorials/webrtc/infrastructure/
  7. TURN Traversal Using Relays around NAT • Server which will

    relay media in case p2p cannot be established • Required for symmetric NAT? https://www.html5rocks.com/en/tutorials/webrtc/infrastructure/
  8. const pc = new RTCPeerConnection({ iceServers: [ // STUN server

    { urls: "stun:stun1.example.net" }, // TURN server { urls: ["turns:turn1.example.net"], username: "someUsername", credential: "someCredential", }] });
  9. Peer-to-Peer Mesh • Pros • Simplicity • Low operating cost

    • Cons • High bandwidth with multi-peers • High computational cost on client • Non-scalable
  10. MCU Multipoint Conferencing Unit • Pros • Client simplicity •

    Optimal downstream quality depending on client condition • Cons • High computational cost for decoding/encoding stream • High latency at large scale due to encoding delay
  11. SFU Selective Forwarding Unit • Pros • Can handle large

    connection pool • Scalable • Optimal downstream quality depending on client condition • Cons • Clients requires more computational cost than MCU
  12. Challenges Things needs to be learned along the way •

    Client-side knowledge • MediaStream constraints • WebRTC/RTP Compatibility( ie. Webrtc-adapter, safari 😰 ) • Network engineering knowledge • Server costs(Turn) • Testing
  13. Closing Thank you for listening • https://webrtcglossary.com/ • https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API/Perfect_negotiation •

    https://www.html5rocks.com/en/tutorials/webrtc/infrastructure/ • https://www.cloudbees.com/blog/webrtc-issues-and-how-to-debug-them • https://princiya777.wordpress.com/2017/08/19/webrtc-behind-the-browser/ • https://programmer.help/blogs/getting-started-with-webrtc-video- communications.html • chrome://webrtc-internals/