use hls.js as submodule

pull/74/merge
Michel Promonet 7 years ago
parent 11a3d9c2a2
commit 7aa5cb6c50

3
.gitmodules vendored

@ -1,3 +1,6 @@
[submodule "v4l2wrapper"] [submodule "v4l2wrapper"]
path = v4l2wrapper path = v4l2wrapper
url = https://github.com/mpromonet/v4l2wrapper url = https://github.com/mpromonet/v4l2wrapper
[submodule "hls.js"]
path = hls.js
url = https://github.com/video-dev/hls.js

15407
hls.js

File diff suppressed because it is too large Load Diff

@ -0,0 +1 @@
Subproject commit e90a1b999071e88af0f734ef18b9e8520c839cec

@ -5,7 +5,7 @@
<script src="/getStreamList?streamList" ></script> <script src="/getStreamList?streamList" ></script>
<h3>HLS</h3> <h3>HLS</h3>
<video controls id="hlsvideo"></video> <video controls id="hlsvideo"></video>
<script src="hls.js" ></script> <script src="hls.js/dist/hls.light.min.js" ></script>
<script> <script>
if (Hls.isSupported()) { if (Hls.isSupported()) {
var video = document.getElementById("hlsvideo"); var video = document.getElementById("hlsvideo");

@ -161,13 +161,13 @@ bool HTTPServer::HTTPClientConnection::sendMpdPlayList(char const* urlSuffix)
} }
void HTTPServer::HTTPClientConnection::handleHTTPCmd_StreamingGET(char const* urlSuffix, char const* /*fullRequestStr*/) void HTTPServer::HTTPClientConnection::handleHTTPCmd_StreamingGET(char const* urlSuffix, char const* fullRequestStr)
{ {
char const* questionMarkPos = strrchr(urlSuffix, '?'); char const* questionMarkPos = strrchr(urlSuffix, '?');
if (strncmp(urlSuffix, "getStreamList", strlen("getStreamList")) == 0) if (strncmp(urlSuffix, "getStreamList", strlen("getStreamList")) == 0)
{ {
std::ostringstream os; std::ostringstream os;
ServerMediaSessionIterator it(fOurServer); ServerMediaSessionIterator it(fOurRTSPServer);
ServerMediaSession* serverSession = NULL; ServerMediaSession* serverSession = NULL;
if (questionMarkPos != NULL) { if (questionMarkPos != NULL) {
questionMarkPos++; questionMarkPos++;
@ -220,11 +220,26 @@ void HTTPServer::HTTPClientConnection::handleHTTPCmd_StreamingGET(char const* ur
if (!ok) if (!ok)
{ {
// send local files // send local files
size_t pos = url.find_last_of("/"); std::string url(fullRequestStr);
size_t pos = url.find_first_of(" ");
if (pos != std::string::npos)
{
url.erase(0,pos+1);
}
pos = url.find_first_of(" ");
if (pos != std::string::npos) if (pos != std::string::npos)
{ {
url.erase(pos); url.erase(pos);
} }
pos = url.find_first_of("/");
if (pos != std::string::npos)
{
url.erase(0,1);
}
std::string pattern("../");
while ((pos = url.find(pattern, pos)) != std::string::npos) {
url.erase(pos, pattern.length());
}
if (url.empty()) if (url.empty())
{ {
url = "index.html"; url = "index.html";
@ -299,7 +314,7 @@ void HTTPServer::HTTPClientConnection::handleHTTPCmd_StreamingGET(char const* ur
void HTTPServer::HTTPClientConnection::handleCmd_notFound() { void HTTPServer::HTTPClientConnection::handleCmd_notFound() {
std::ostringstream os; std::ostringstream os;
ServerMediaSessionIterator it(fOurServer); ServerMediaSessionIterator it(fOurRTSPServer);
ServerMediaSession* serverSession = NULL; ServerMediaSession* serverSession = NULL;
while ( (serverSession = it.next()) != NULL) { while ( (serverSession = it.next()) != NULL) {
os << serverSession->streamName() << "\n"; os << serverSession->streamName() << "\n";

Loading…
Cancel
Save