我是直播新手,很难为初学者找到好的信息。除了Apple的文档,还有谁能推荐给HLS的资源吗?
我正在尝试制作一个类似于 LiveStream 的应用程序,可以将视频实时广播给多个用户。
我遇到过一些服务,如 encoding.com、heywatchencoding.com 和 wowza,但我对每个平台提供的内容有困难,因为每个平台的文档似乎是为更多中级/有经验的用户准备的。
创建像 LiveStream/Ustream/Twitch/Youtube live 这样更简单的网站有多难?我试图从简单的 ios 设备和网络开始,但很难找到在线资源。任何提示都有帮助
顺便问一下,你们中的任何人是否也知道我是否可以将 wowza 与 Parse.com 服务一起使用?
谢谢
最佳答案
这是一个非常简单的 Node.js 媒体服务器,它启动一个 HTTP 服务器以将大多数视频或音频格式文件从服务器流式传输到浏览器。一旦你安装了 nodejs 就执行
node file_containing_below_code.js
然后将您的浏览器指向 URL
http://localhost:8888/
你的浏览器已经内置了一个用于前进/后退的 slider 小部件,它会自动将流量发送回该服务器以做出相应的响应
享受......顺便说一句,不需要文档,只需傻瓜式拍摄
var http = require('http'),
fs = require('fs'),
util = require('util');
var path = "/path/to/audio/or/video/file/local/to/server/cool.mp4"; // put any audio or video file here
var port = 8888;
var host = "localhost";
http.createServer(function (req, res) {
var stat = fs.statSync(path);
var total = stat.size;
if (req.headers.range) { // meaning client (browser) has moved the forward/back slider
// which has sent this request back to this server logic ... cool
var range = req.headers.range;
var parts = range.replace(/bytes=/, "").split("-");
var partialstart = parts[0];
var partialend = parts[1];
var start = parseInt(partialstart, 10);
var end = partialend ? parseInt(partialend, 10) : total-1;
var chunksize = (end-start)+1;
console.log('RANGE: ' + start + ' - ' + end + ' = ' + chunksize);
var file = fs.createReadStream(path, {start: start, end: end});
res.writeHead(206, { 'Content-Range': 'bytes ' + start + '-' + end + '/' + total, 'Accept-Ranges': 'bytes', 'Content-Length': chunksize, 'Content-Type': 'video/mp4' });
file.pipe(res);
} else {
console.log('ALL: ' + total);
res.writeHead(200, { 'Content-Length': total, 'Content-Type': 'video/mp4' });
fs.createReadStream(path).pipe(res);
}
}).listen(port, host);
console.log("Server running at http://" + host + ":" + port + "/");
关于ios - HTTP 直播服务,如 LiveStream/Ustream/Twitch/Youtube Live,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28945968/