6

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

我在 Raspberry pi2 上设置了 openelec 的 Kodi。我上传了一个视频,并设法让它通过 HDMI 在连接的电视上播放。我似乎无法弄清楚如何让 Kodi 作为媒体服务器,这样我就可以使用手机或计算机的浏览器浏览媒体并播放它。我已经通过可用的设置,安装了几个插件(即合唱等),但我仍然看不到如何实现这一点。每当我登录 Kodi Web 界面后在浏览器上打开视频时,它仍然会在连接到 PI 的电视上播放。

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

4

3 回答 3

3

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

Kodi 不完全是媒体服务器,它充当媒体中心。但是,使用 plex,您可以设置媒体中心并从 Web 浏览器访问您的媒体。

尝试寻找 kodi 和 plex 之间的差异。

于 2018-07-05T10:19:13.877 回答
1

Chorus 应该仍然可以选择在浏览器中播放视频。它似乎不再适用于 Chrome 或 Firefox,但请看这里:https ://github.com/xbmc/chorus2/issues/127

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

于 2016-11-19T22:24:11.703 回答
0

我修改了 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>!');
});

  1. 修改了 div id="movie-watch" 下的文件 "Kodi\addons\webinterface.chorus\tpl\MovieView.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>-->

  1. 修改了 div id="movie-watch" 下的文件 "Kodi\addons\webinterface.chorus\tpl\TvshowView.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>-->

于 2020-06-08T14:22:03.257 回答