Comments (7)
This works in Chrome. You can start from here:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Clappr/Hls.js with P2P Media Loader</title>
<meta charset="utf-8">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/build/p2p-media-loader-core.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/build/p2p-media-loader-hlsjs.js"></script>
<script src="https://cdn.jsdelivr.net/npm/clappr@latest/dist/clappr.js"></script>
</head>
<body>
<div id="player"></div>
<script>
if (p2pml.hlsjs.Engine.isSupported()) {
const config = {
loader:{
rtcConfig: {
iceServers: [
{
urls: ["stun:stun.l.google.com:19302", "stun:global.stun.twilio.com:3478"]
}
],
}
}
};
var engine = new p2pml.hlsjs.Engine(config);
engine.on("peer_connect", peer => console.log("peer_connect", peer.id, peer.remoteAddress));
engine.on("peer_close", peerId => console.log("peer_close", peerId));
engine.on("segment_loaded", (segment, peerId) => console.log("segment_loaded from", peerId ? `peer ${peerId}` : "HTTP", segment.url));
var player = new Clappr.Player({
parentId: "#player",
source: "http://sample.vodobox.net/skate_phantom_flex_4k/low/skate_phantom_flex_4k_228_144p.m3u8",
mute: false,
autoPlay: true,
playback: {
hlsjsConfig: {
liveSyncDurationCount: 7,
loader: engine.createLoaderClass()
}
}
});
p2pml.hlsjs.initClapprPlayer(player);
} else {
document.write("Not supported :(");
}
</script>
</body>
</html>
I use single quality to test: http://sample.vodobox.net/skate_phantom_flex_4k/low/skate_phantom_flex_4k_228_144p.m3u8
from p2p-media-loader.
Thank you so much :) @mrlika working fine in Chrome now only problem is peers are not connecting cross-browser for example only connecting with Chrome peers and Firefox only connecting with Firefox peers. Anyone knows the solution ?
from p2p-media-loader.
It doesn't depend on JavaScript code. All the popular browsers that support this technology can connect with each other: Firefox, Chrome, Safari, Edge on Windows, Linux, macOS, iPadOS, Android
from p2p-media-loader.
Dear please try above code that you shared open one instance in chrome and one in firefox and see if they both connect? In my case they are not connecting. Also please can you guide how to set turn server in above code any example turn server Thank you
from p2p-media-loader.
It works for me between chrome and firefox
from p2p-media-loader.
Okay, I will try again can you please guide how to set turn servers in the above configuration?
from p2p-media-loader.
It makes no sense to add TURN servers. TURN server is a relay that is not needed because there is always an HTTP video stream source exists.
A dedicated WebTorrent Tracker should be configured for production usage to not depend on public ones.
For privacy reasons, a personal STUN server may also be configured.
from p2p-media-loader.
Related Issues (20)
- someone trying to repair this repo?
- is there any way to stream video from torrent file
- How do I add my wt-tracker to p2p-media-loader? HOT 1
- p2p loader can't work on google chrome version 110.0.0.0 HOT 1
- Not working in the latest version of Chrome HOT 4
- Create 3 folders with NPM packages
- Setup automatic build an publishing
- Create simple hls.js loader plugin
- WebSocket connection to 'wss://tracker.novage.com.ua/' failed: HOT 1
- How to integrating into Reactjs HOT 1
- Peers wont connect !! HOT 5
- Peers are not connecting cross-browser for example chrome peers only connecting with Chrome peers and Firefox only connecting with Firefox peers. Anyone knows the solution ?
- Does the next version support videojs? HOT 1
- Anyone have luck installing on JW Player?
- Release v1 HOT 2
- Not Working P2P HOT 2
- host in mau domain pleass anser HOT 1
- Don't call random download in setTimeout HOT 1
- p2pδΈε·₯δ½ HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from p2p-media-loader.