1.è°è°MediaStream
è°è°MediaStream
源码app精品源码MediaStream æ¯è¿æ¥ WebRTC API ååºå±ç©çæµçä¸é´å±ï¼webRTCå°é³è§é¢ç»è¿Vocie / Video engineè¿è¡å¤çåï¼åéè¿MediaStream APIç»æ´é²ç»ä¸å±ä½¿ç¨ã
源码app精品源码MediaStreamTrackæ¯WebRTCä¸çåºæ¬åªä½åä½ï¼ä¸ä¸ªMediaStreamTrackå å«ä¸ç§åªä½æºï¼åªä½è®¾å¤æå½å¶å 容ï¼è¿åçåä¸ç±»åçåªä½ï¼å¦é³é¢ï¼è§é¢ï¼ãå个轨éå¯å å«å¤ä¸ªé¢éï¼å¦ç«ä½å£°æºå°½ç®¡ç±å¤ä¸ªé³é¢è½¨éææï¼ä½ä¹å¯ä»¥çä½æ¯ä¸ä¸ªè½¨éã
源码app精品源码WebRTC并ä¸è½ç´æ¥è®¿é®æè æ§å¶æºï¼å¯¹æºçä¸åæ§å¶é½å¯ä»¥éè¿è½¨éæ§å¶ MediaTrackConstraints è¿è¡å®æ½ã
源码app精品源码MediaStreamTrack MDNææ¡£
源码app精品源码MediaTrackConstraints MDNææ¡£
源码app精品源码MediaStreamæ¯MediaStreamTrackçåéï¼å¯ä»¥å å« >=0 个 MediaStreamTrackãMediaStreamè½å¤ç¡®ä¿å®æå å«çææ轨éé½æ¯æ¯åæ¶ææ¾çï¼ä»¥å轨éçåä¸æ§ã
源码app精品源码MediaStream MDNææ¡£
源码app精品源码åMediaTrackçæºç ä¸ï¼MediaTracké½æ¯ç±å¯¹åºçsourceåsinkç»æçã
源码app精品源码æµè§å¨ä¸åå¨ä»sourceå°sinkçåªä½ç®¡éï¼å ¶ä¸sourceè´è´£ç产åªä½èµæºï¼å æ¬å¤åªä½æ件ï¼webèµæºçéæèµæºä»¥å麦å é£ééçé³é¢ï¼æå头ééçè§é¢çå¨æèµæºãèsinkåè´è´£æ¶è´¹sourceç产åªä½èµæºï¼ä¹å°±æ¯éè¿<img>ï¼<video>ï¼<audio>çåªä½æ ç¾è¿è¡å±ç¤ºï¼æè æ¯éè¿RTCPeerConnectionå°sourceéè¿ç½ç»ä¼ éå°è¿ç«¯ãRTCPeerConnectionå¯åæ¶æ®æ¼sourceä¸sinkçè§è²ï¼ä½ä¸ºsinkï¼å¯ä»¥å°è·åçsourceéä½ç çï¼ç¼©æ¾ï¼è°æ´å¸§ççï¼ç¶åä¼ éå°è¿ç«¯ï¼ä½ä¸ºsourceï¼å°è·åçè¿ç«¯ç æµä¼ éå°æ¬å°æ¸²æã
源码app精品源码source ä¸sinkææä¸ä¸ªMediaTrackï¼å¤ä¸ªMeidaTrackææMediaStramã
源码app精品源码MediaTrackConstraints æè¿°MediaTrackçåè½ä»¥åæ¯ä¸ªåè½å¯ä»¥éç¨çä¸ä¸ªæå¤ä¸ªå¼ï¼ä»èè¾¾å°éæ©åæ§å¶æºçç®çã MediaTrackConstraints å¯ä½ä¸ºåæ°ä¼ éç» applyConstraints() 以达å°æ§å¶è½¨éå±æ§çç®çï¼åæ¶å¯ä»¥éè¿è° getConstraints() ç¨æ¥æ¥çæè¿åºç¨èªå®ä¹çº¦æã
源码app精品源码å¯å°MediaStream对象ç´æ¥èµå¼ç» HTMLMediaElement æ¥å£ç srcObject å±æ§ã
源码app精品源码srcObject MDNææ¡£
源码app精品源码å¯éè¿è°ç¨ MediaDevices.getUserMedia() æ¥è®¿é®æ¬å°åªä½ï¼è°ç¨è¯¥æ¹æ³åæµè§å¨ä¼æ示ç¨æ·ç»äºä½¿ç¨åªä½è¾å ¥ç许å¯ï¼åªä½è¾å ¥ä¼äº§çä¸ä¸ª MediaStream ï¼éé¢å å«äºè¯·æ±çåªä½ç±»åç轨éãæ¤æµå¯ä»¥å å«ä¸ä¸ªè§é¢è½¨éï¼æ¥èªç¡¬ä»¶æè èæè§é¢æºï¼æ¯å¦ç¸æºãè§é¢éé设å¤åå±å¹å ±äº«æå¡ççï¼ãä¸ä¸ªé³é¢è½¨éï¼åæ ·æ¥èªç¡¬ä»¶æèæé³é¢æºï¼æ¯å¦éº¦å é£ãA/D转æ¢å¨ççï¼ï¼ä¹å¯è½æ¯å ¶å®è½¨éç±»åã
源码app精品源码éè¿ MediaDevices.enumerateDevices() æ们å¯ä»¥å¾å°ä¸ä¸ªæ¬æºå¯ç¨çåªä½è¾å ¥åè¾åºè®¾å¤çå表ï¼ä¾å¦éº¦å é£ï¼æåæºï¼è³æºè®¾å¤çã
源码app精品源码å表ä¸çæ¯ä¸ªåªä½è¾å ¥é½å¯ä½ä¸ºMediaTrackConstraintsä¸å¯¹åºç±»åçå¼ï¼å¦ä¸ä¸ªé³é¢è®¾å¤è¾å ¥audioDeviceInputå¯è®¾ç½®ä¸ºMediaTrackConstraintsä¸audioå±æ§çå¼
源码app精品源码å°è¯¥constraintå¼ä½ä¸ºåæ°ä¼ å ¥å° MediaDevices.getUserMedia(constraints) ä¸ï¼ä¾¿å¯è·å¾è¯¥è®¾å¤çMediaStreamã
源码app精品源码MediaDevices.enumerateDevices() MDNææ¡£
源码app精品源码MediaDevices.getUserMedia() MDNææ¡£
源码app精品源码ä½¿ç¨ MediaDevices.getDisplayMedia() æ¹æ³ï¼å¯ä»¥æ示ç¨æ·å»éæ©åæææè·å±ç¤ºçå 容æé¨åå 容ï¼å¦ä¸ä¸ªçªå£ï¼ï¼å¹¶å°å½å¶å 容å¨ä¸ä¸ª MediaStream éã
源码app精品源码MediaDevices.getDisplayMedia() MDNææ¡£
源码app精品源码ä½¿ç¨ HTMLCanvasElement.captureStream() æ¹æ³è¿åç CanvasCaptureMediaStream æ¯ä¸ä¸ªå®æ¶æè·çcanvaså¨ç»æµã
源码app精品源码HTMLCanvasElement.captureStream() MDNææ¡£
源码app精品源码CanvasCaptureMediaStream MDNææ¡£
源码app精品源码å¯éè¿æé å½æ° MediaStream() è¿åæ°å»ºç空ç½ç MediaStream å®ä¾
源码app精品源码MediaRecorder MDNææ¡£
源码app精品源码