Novage / p2p-media-loader

An open-source engine for P2P streaming of live and on demand video directly in a web browser HTML page
https://novage.com.ua/p2p-media-loader/demo.html
Apache License 2.0
1.41k stars 311 forks source link

ABR not working? #97

Closed ranweb closed 7 months ago

ranweb commented 4 years ago

i try to use ABR: http origin wowza +nginx edges. it works well with peer5 but can't get it with p2ploader - maybe setup??

p2ploader: https://go.shidur.net/player/testlive.php (can't get ABR atleast not automatic)

peer5: https://go.shidur.net/player/testlive-js.php (automatic abr works "out of the box")

any ideas? BTW: this is the setup ->

cachedSegmentExpiration: 5 60 1000, cachedSegmentsCount: 30, useP2P: true, consumeOnly: false, requiredSegmentsPriority: 1, simultaneousHttpDownloads: 2, httpDownloadProbability: 0.1, httpDownloadProbabilityInterval: 1000, httpDownloadProbabilitySkipIfNoPeers: false, httpFailedSegmentTimeout: 10000, httpDownloadMaxPriority: 20, httpDownloadInitialTimeout: 0, httpDownloadInitialTimeoutPerSegment: 4000, httpUseRanges: true, simultaneousP2PDownloads: 5, p2pDownloadMaxPriority: 20, p2pSegmentDownloadTimeout: 60000, webRtcMaxMessageSize: 64 * 1024 - 1, trackerAnnounce: ["wss://trk1.shidur.net:8533", "wss://vdo.shidur.net:8020", "wss://tracker.openwebtorrent.com"], peerRequestsPerAnnounce: 10, rtcConfig: Peer.config BTW2: i use my own private trackers. as a matter of fact - they keep crushing... any ideas how to keep them stable? (I use your wt-tracker on one vps and bittorent-tracker on the other. the wt-tracker doesn't go through nginx but has ssl in it's config.json)

mrlika commented 4 years ago

Why do you think that ABR is not working?

When I put the stream into the demo adaptive bitrate and manual bitrate switching work: http://novage.com.ua/p2p-media-loader/demo.html?url=https%3A%2F%2Fstream71.shidur.net%2Fhtvlive2%2F_definst_%2Fsmil%3Alive2.smil%2Fplaylist.m3u8&type=clappr

ranweb commented 4 years ago

manual bitrate is working well. my problem is with Adaptive. first of all - maybe there is a difference between FETCH and XHR. p2ploader uses XHR and peer5 uses FETCH - since i tried to use google's network throtelling, even on fast3g or slow3f i could still get 1200kbit stream (in peer5 it switched down to 748k maybe XHR requests bypass google throttle?!@#) - so I tried to use an app called THROTTELER (i use MacOS) and this time the player simply was stuck - it tried to get the 1200k version instead of requesting the 748k one.

did it work well for you? meaning when you tried throtelling it actually choose the lower quality stream? (i am talking about my stream).

by the way - i tried both with WOWZA live stream and KALTURA NGINX VOD stream - both didn't work well adaptively...

if it does work for you - any idea why it doesn't work for me and peer5 does??

i added a screen shot - look how many seconds it tries to download a segment (almost a minutee!) instead of asking the server for lower bitrate...

screen

mrlika commented 4 years ago

As far as I know, throttling affects XHR, fetch and regular browser HTTP request. But it doesn't affect WebRTC bandwidth.

Hls.js engine doesn't know about P2P network and random video pre-downloading. That is why we calculate and report the average P2P network bandwidth to it. On your screen I see peers that is why network bandwidth can be different from real throttled speed.

But I see some issues with detecting correct bandwidth with p2p-media-loader and without. I will try to investigate the issue.

ranweb commented 4 years ago

tnx! you're doing amazing work.

afdah commented 4 years ago

i tried this with jwplayer and p2pml. when there is no peers, abr works. when there are peers, abr does not work. probably like @mrlika said about problem p2p bandwith reporting.

mrlika commented 4 years ago

Thanks for the report. I also see issues with ABR (especially in JWPlayer). I am working on it right now.

ranweb commented 4 years ago

hi mrlika - any news? am i the only one that tries to use it with HLS ABR?

afdah commented 4 years ago

@mrlika I tried another test using the latest version of jwplayer v8.13.4 I think the previous test I have done above is inaccurate.

First pic without p2pml. Screenshot_85

2nd pic with p2pml. Screenshot_86

Both setup using the same stream, using 360p as default. For p2pml setup, "usep2p" has been disable to make the test as accurate as possible. So both tests is running without any p2p involve.

See the difference? jwplayer.bandwithEstimate is way off. It's like the bandwith estimate is x3 the value without p2pml.

By the way, the value can be seen at the local browser storage, not cookies.

mullerivan commented 3 years ago

Hi there take a look at https://swarm.video/#/home is a nice production platform

cheers