Intel® Collaboration Suite for WebRTC
Community support and discussions on the Intel® Collaboration Suite for WebRTC (Intel® CS for WebRTC).
1136 Discussions

请问有实现P2P远程视频播放的样例吗?

Liu__David
Beginner
840 Views

您好,请问有实现P2P远程视频播放的样例吗?

Signaling server采用了PeerServer-Release-4.2.1,通过node peerserver.js命令已经运行起来。

但有在Peer A和Peer B上运行的样例代码吗? 谢谢!

   

 

系统框图.png

0 Kudos
11 Replies
dandy__kiven
Beginner
840 Views

i do it ok and run success ,please add me email :1213126651@qq.com

Chunbo_H_Intel1
Employee
840 Views

Please look at the source code from CS_WebRTC_Client_SDK_JavaScript.v4.3\samples\p2p.

Liu__David
Beginner
840 Views

Chunbo H. (Intel) wrote:

Please look at the source code from CS_WebRTC_Client_SDK_JavaScript.v4.3\samples\p2p.

The source code in the p2p example can capture stream from webcam in the local machine.

It uses MediaStreamFactory.createMediaStream() to create a video stream( call getDisplayMedia() for srceen and getUserMedia() for webcam).

I want to capture stream from a IPcamera which provides RTSP or RTMP stream, not webcam or screen。

How can I capture the stream from a RTMP url? For example :  rtmp://127.0.0.1/live/  (It can played in VLC player)

Below is my code:

      <video width="640px" height="480px" id="localVideo" controls playsinline muted>
        <source src="rtmp://127.0.0.1/live/" type="rtmp/flv">
        <!-- source src="rtmp://media3.sinovision.net:1935/live/livestream" type="rtmp/flv" -->
      </video>

       ... ...

            var video_element = document.getElementById("localVideo");
            mediaStream = video_element.captureStream();
            video_element.play();
When I run the code, an error prompted :  "Error: All tracks are ended."

Can you tell me what is wrong with the code above? Thanks.

Liu__David
Beginner
840 Views

When the <video> source is a mp4 file, such as :<source src="js/array.mp4" type="video/mp4">, the video_element.captureStream() works OK. Mp4 stream can be transported to the remote peer and played OK.

 

Liu__David
Beginner
840 Views

The source code I used has change from v4.2.1 to v4.3 

Chunbo_H_Intel1
Employee
840 Views

Did this local video element with RTMP play as expected?

Liu__David
Beginner
840 Views

Yes, it can be played with VLC player, or played with video.js inside the webpage:

var vsplayer = videojs("localVideo");
      vsplayer.play();

Liu__David
Beginner
840 Views

I want :

    Peer B capture RTMP stream and publish to Peer A.

Peer B can play the locally with videojs, but can not publish to Peer A. It prompted :  "Error: All tracks are ended."

Liu__David
Beginner
840 Views

Chunbo H. (Intel) wrote:

Did this local video element with RTMP play as expected?

Can you tell me your email? I can send the complete code to you.

Liu__David
Beginner
840 Views
Is there any other method to capture stream from an video object besides of captureStream()?
Chunbo_H_Intel1
Employee
840 Views

According to the feedback from our feature owner, we don’t support RTSP/RTMP at client side currently.

Reply