Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upVideo PLayer #657
Video PLayer #657
Comments
This comment has been minimized.
This comment has been minimized.
|
+1 same issue. |
This comment has been minimized.
This comment has been minimized.
|
I find that most of the time it's best to simply use appendTo, as it generates everything you need without having to worry about what data is going to what element. appendTo has a callback method that gives you access to the element once it's added to the DOM.
|
This comment has been minimized.
This comment has been minimized.
|
I'm sorry but I'm new to JS and this doesn't seem to be working for me. Is this a piece of blank code or does it have the needed attributes already applied? Thanks in advanced |
This comment has been minimized.
This comment has been minimized.
|
I'm not sure what @itanhduy 's skin is in this game. But I am trying to operate the stream so that I can change the size(width length) of the video stream by using the 'file' as a src for the source element |
This comment has been minimized.
This comment has been minimized.
|
You're using an old API that's since been removed. Here's a complete example: <!doctype html>
<html>
<head>
<script src="https://cdn.jsdelivr.net/webtorrent/latest/webtorrent.min.js"></script>
</head>
<body>
<script>
var client = new WebTorrent()
var torrentId = 'https://webtorrent.io/torrents/sintel.torrent'
client.add(torrentId, function (torrent) {
// Torrents can contain many files. Let's use the first.
var file = torrent.files[0]
// Create a video element
file.appendTo(document.body, function (err, elem) {
elem.width = 640
elem.height = 360
})
})
</script>
</body>
</html> |
This comment has been minimized.
This comment has been minimized.
|
@feross doesn't work on Google Chrome. <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>WebTorrent Demo</title>
</head>
<body>
<video id="video-container" controls="true"></video>
</body>
<script src="https://cdn.jsdelivr.net/webtorrent/latest/webtorrent.min.js"></script>
<script type="text/javascript">
var client = new WebTorrent();
var torrentId = 'magnet:?xt=urn:btih:6a9759bffd5c0af65319979fb7832189f4f3c35d&dn=sintel.mp4&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&tr=wss%3A%2F%2Ftracker.webtorrent.io&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fsintel-1024-surround.mp4';
client.add(torrentId, function (torrent) {
var file = torrent.files[0];
var container = document.getElementById('video-container');
file.appendTo(container);
});
</script>
</html>Triggers the following error:
|
This comment has been minimized.
This comment has been minimized.
|
You can try this pen for a working example with renderTo: http://codepen.io/yciabaud/pen/XdOeWM |
This comment has been minimized.
This comment has been minimized.
|
@yciabaud thanks for the response. I've replaced with
|
This comment has been minimized.
This comment has been minimized.
|
@ghaiklor Your code example works fine if you just change Full code: <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>WebTorrent Demo</title>
</head>
<body>
<video id="video-container" controls="true"></video>
</body>
<script src="https://cdn.jsdelivr.net/webtorrent/latest/webtorrent.min.js"></script>
<script type="text/javascript">
var client = new WebTorrent();
var torrentId = 'magnet:?xt=urn:btih:6a9759bffd5c0af65319979fb7832189f4f3c35d&dn=sintel.mp4&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&tr=wss%3A%2F%2Ftracker.webtorrent.io&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fsintel-1024-surround.mp4';
client.add(torrentId, function (torrent) {
var file = torrent.files[0];
var container = document.getElementById('video-container');
file.renderTo(container);
});
</script>
</html> |
This comment has been minimized.
This comment has been minimized.
|
This thread has been automatically locked because it has not had recent activity. To discuss futher, please open a new issue. |
I want to try and customize the video player so I am trying this code out
It doesn't seem to want to stream the video though. When I use a private torrent (ie with only one seed) I saw that the video downloads to the page but it doesn't stream or play it once it's done.