如何流视频浏览器与Kodi



不知道这是不是问这个问题的正确地方,但是这里什么也没有。

我在Raspberry pi2上安装openelec的Kodi。我上传了一个视频,并设法通过HDMI在连接的电视上播放。我似乎不明白的是如何让Kodi作为媒体服务器,这样我就可以使用手机或电脑的浏览器浏览媒体并播放它。我已经通过可用的设置,安装了几个插件(I。(合唱等),我仍然不知道如何做到这一点。每当我登录Kodi web界面后在浏览器上打开视频时,它仍然在连接到PI的电视上播放。

几乎所有的谷歌搜索结果都在谈论从设备到电视和chromecast的投射。我希望能够在我的本地浏览器上播放这个媒体。不,我不能使用Kodi应用程序,因为我使用的是不支持的手机和电脑操作系统。

在您的情况下,最好使用plex而不是kodi。

Kodi不是一个媒体服务器,它是一个媒体中心。但是,使用plex,您可以设置媒体中心并从web浏览器访问您的媒体。

尝试查找kodi和plex之间的差异

Chorus应该仍然有一个在浏览器中播放视频的选项。它似乎不再与Chrome或Firefox一起工作,但看看这里:https://github.com/xbmc/chorus2/issues/127

此功能依赖于Flash Player,此功能已从大多数web浏览器中删除。裁判:https://support.google.com/chrome/answer/6258784?visit_id=637521928282450874 - 904852602和rd = 1

我已经修改了Chorus web界面,允许在后台使用nodejs进程进行流媒体。

  1. NodeJS脚本:

const express = require('express')
const fs = require('fs')
const path = require('path')
const app = express()
const url = require('url')
const gracefulFs = require('graceful-fs')
gracefulFs.gracefulify(fs)
app.get('/video', function(req, res) {
  var q = url.parse(req.url, true).query;
  var filepath = q.src;
  fs.stat(filepath, function(err, stats){
	if (err){
		if (err.code === 'ENOENT'){
			//404 Error if file not found
			res.writeHead(404, {
				"Accept-Ranges" : "bytes",
				"Content-Range" : "bytes " + start + "-" + end + "/" + total,
				"Content-Length" : chunksize,
				"Content-Type" : "video/mp4"
			});
		}
		res.end(err);
	}
	
	var start;
	var end;
	var chunksize;
	var total = stats.size;
	
	var range = req.headers.range;
	if (range) {
		var parts = range.replace(/bytes=/, "").split("-");
		start = parseInt(parts[0], 10);
		end = parts[1] ? parseInt(parts[1], 10) : total - 1;
	} else {
		start = 0;
		end = total - 1;
	}
	
	if (start > end || start < 0 || end > total - 1){
		//error 416 is "Range Not Satisfiable"
		res.writeHead(416, {
			"Accept-Ranges" : "bytes",
			"Content-Range" : "*/" + stats.size,
			"Content-Type" : "video/mp4"
		});
		res.end();
		return;
	}
	
	if (start == 0 && end == (total -1)){
		res.writeHead(200, {
			'Accept-Ranges': 'bytes',
			'Content-Range': `bytes ${start}-${end}/${total}`,
			'Content-Length': total,
			'Content-Type': 'video/mp4'
		});
	} else {
		chunksize = (end - start) + 1;
		res.writeHead(206, {
			'Content-Range': `bytes ${start}-${end}/${total}`,
			'Accept-Ranges': 'bytes',
			'Content-Length': chunksize,
			'Content-Type': 'video/mp4'
		});
	}
	var stream = fs.createReadStream(filepath, {
		start : start, 
		end : end
	}).on("open", function() {
		stream.pipe(res);
	}).on("error", function(err) {
		console.log(err);
		res.end(err);
	});
  });
});
app.listen(<port>, function () {
  console.log('Listening on port <port>!');
});

  • 修改了div id="movie-watch"下的"Kodiaddonswebinterface.chorustplMovieView.html"文件:
  •                 <div id="movie-watch" class="tab-pane">
                        <div class="col-1">
    						<video id="videoPlayer" controls width="100%" height="90%" preload="metadata">
    							<source src="http://<mydomain>:<port>/video?src=<%=encodeURIComponent(file) %>&movieId=<%= movieid %>" type="video/mp4">
    						</video>
    						<!--
                            <h2>HTML5 player</h2>
                            <p>Codec support is very <a href="https://developer.mozilla.org/en-US/docs/HTML/Supported_media_formats" target="_blank">limited in the browser</a>.
                                H.264 video generally works but only with 2 channel audio. Works best in Chrome, may crash browser and/or XBMC!</p>
                            <div class="buttons">
                                <a href="#" class="movie-stream btn" data-player="html5">Launch HTML5 player</a>
                            </div>
                            <br />
                            <h2>VLC player</h2>
                            <p><a href="http://www.videolan.org/vlc/index.html" target="_blank">VLC Player</a> provides an
                                embeddable video player, it will play most videos, but does require you to
                                <a href="http://www.videolan.org/vlc/index.html" target="_blank">download and install</a> extra software.
                                Works well in Chrome and Firefox.</p>
                            <div class="buttons">
                                <a href="#" data-player="vlc" class="movie-stream btn">Launch VLC player</a>
                            </div>-->

  • 修改了div id="movie-watch"下的"Kodiaddonswebinterface.chorustplTvshowView.html"文件:
  •                 <div id="tv-watch" class="tab-pane">
                        <div class="col-1">
    						<video id="videoPlayer" controls width="100%" height="90%">
    							<source src="http://<mydomain>:<port>/video?src=<%=encodeURIComponent(file) %>&episodeId=<%= episodeid %>" type="video/mp4">
    						</video>
    						<!--
                            <h2>HTML5 player</h2>
                            <p>Codec support is very <a href="https://developer.mozilla.org/en-US/docs/HTML/Supported_media_formats" target="_blank">limited in the browser</a>.
                                H.264 video generally works but only with 2 channel audio. Works best in Chrome, may crash browser and/or XBMC!</p>
                            <div class="buttons">
                                <a href="#" class="tv-stream btn" data-player="html5">Launch HTML5 player</a>
                            </div>
                            <br />
                            <h2>VLC player</h2>
                            <p><a href="http://www.videolan.org/vlc/index.html" target="_blank">VLC Player</a> provides an
                                embeddable video player, it will play most videos, but does require you to
                                <a href="http://www.videolan.org/vlc/index.html" target="_blank">download and install</a> extra software.
                                Works well in Chrome and Firefox.</p>
                            <div class="buttons">
                                <a href="#" data-player="vlc" class="tv-stream btn">Launch VLC player</a>
                            </div>-->

    最新更新