[英]Fast forward and rewind is not working in nodejs server
我正在運行nodejs服務器來建立視頻注釋工具。 但是問題是我無法運行快進和快退功能。 這是我的node-js server.js文件:
視頻文件位於html中,而不位於server.js中
var http = require('http');
var fs = require('fs');
var path = require('path');
http.createServer(function (request, response) {
console.log('request starting...');
var filePath = '.' + request.url;
if (filePath == './')
filePath = './dragnew_popup.html';
var extname = path.extname(filePath);
var contentType = 'text/html';
switch (extname) {
case '.js':
contentType = 'text/javascript';
break;
case '.css':
contentType = 'text/css';
break;
case '.json':
contentType = 'application/json';
break;
case '.png':
contentType = 'image/png';
break;
case '.mp4':
contentType = 'video/mp4';
break;
}
fs.readFile(filePath, function(error, content) {
if (error) {
if(error.code == 'ENOENT'){
fs.readFile('./404.html', function(error, content) {
response.writeHead(200, { 'Content-Type': contentType });
response.end(content, 'utf-8');
});
}
else {
response.writeHead(500);
response.end('Sorry, check with the site admin for error: '+error.code+' ..\n');
response.end();
}
}
else {
response.writeHead(200, { 'Content-Type': contentType });
response.end(content, 'utf-8');
}
});
}).listen(8080);
console.log('Server running at http://127.0.0.1:8080/');
當我運行此server.js時,我無法使用快進和快退,但只能播放和暫停。
所以我必須在哪里進行更改,以便可以使用快進和快退?
我又創建了一個用於視頻的node.js服務器,並將其保留在3000端口中。 還有一台服務器來運行我的.html文件。 在此html文件中,我保留了http:// ip-address:8080 / video>。
因此,每當我要求我的html運行視頻時,它將向視頻服務器發送播放請求,每當我請求快進和快退時,它將向視頻服務器發送請求,而html服務器將獲得相同的答復。
這就是我想要的。
謝謝大家給我您的寶貴時間。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.