Exported embed code to separate file.
This commit is contained in:
parent
728f852bfb
commit
2e5ae34547
4 changed files with 26 additions and 16 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -29,4 +29,5 @@ libtool
|
||||||
*.flv
|
*.flv
|
||||||
*.json
|
*.json
|
||||||
server.html*
|
server.html*
|
||||||
|
*.js.h
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
SUBDIRS=src
|
SUBDIRS=src
|
||||||
EXTRA_DIST=server.html server.html.h VERSION lsp/*.js lsp/*.html lsp/*.css
|
EXTRA_DIST=server.html server.html.h VERSION lsp/*.js lsp/*.html lsp/*.css src/embed.js*
|
||||||
docs:
|
docs:
|
||||||
doxygen ./Doxyfile > /dev/null
|
doxygen ./Doxyfile > /dev/null
|
||||||
.PHONY: docs
|
.PHONY: docs
|
||||||
|
|
|
@ -1,17 +1,3 @@
|
||||||
AM_CPPFLAGS = $(MIST_CFLAGS)
|
|
||||||
LDADD = $(MIST_LIBS)
|
|
||||||
SUBDIRS=converters analysers
|
|
||||||
bin_PROGRAMS=MistBuffer MistController MistConnRAW MistConnRTMP MistConnHTTP MistConnHTTPProgressive MistConnHTTPDynamic
|
|
||||||
MistBuffer_SOURCES=buffer.cpp buffer_user.h buffer_user.cpp buffer_stream.h buffer_stream.cpp tinythread.cpp tinythread.h ../VERSION
|
|
||||||
MistBuffer_LDADD=$(MIST_LIBS) -lpthread
|
|
||||||
MistController_SOURCES=controller.cpp ../VERSION ../server.html.h
|
|
||||||
MistConnRAW_SOURCES=conn_raw.cpp ../VERSION
|
|
||||||
MistConnRTMP_SOURCES=conn_rtmp.cpp ../VERSION
|
|
||||||
MistConnHTTP_SOURCES=conn_http.cpp tinythread.cpp tinythread.h ../VERSION
|
|
||||||
MistConnHTTP_LDADD=$(MIST_LIBS) -lpthread
|
|
||||||
MistConnHTTPProgressive_SOURCES=conn_http_progressive.cpp ../VERSION
|
|
||||||
MistConnHTTPDynamic_SOURCES=conn_http_dynamic.cpp ../VERSION
|
|
||||||
|
|
||||||
../lsp/uncompressed.js: ../lsp/jquery.js ../lsp/placeholder.js ../lsp/md5.js ../lsp/main.js ../lsp/functions.js
|
../lsp/uncompressed.js: ../lsp/jquery.js ../lsp/placeholder.js ../lsp/md5.js ../lsp/main.js ../lsp/functions.js
|
||||||
cat ../lsp/jquery.js ../lsp/placeholder.js ../lsp/md5.js ../lsp/main.js ../lsp/functions.js > ../lsp/uncompressed.js
|
cat ../lsp/jquery.js ../lsp/placeholder.js ../lsp/md5.js ../lsp/main.js ../lsp/functions.js > ../lsp/uncompressed.js
|
||||||
../lsp/compressed.js: ../lsp/uncompressed.js
|
../lsp/compressed.js: ../lsp/uncompressed.js
|
||||||
|
@ -26,3 +12,23 @@ MistConnHTTPDynamic_SOURCES=conn_http_dynamic.cpp ../VERSION
|
||||||
cat ../lsp/footer.html >> ../server.html
|
cat ../lsp/footer.html >> ../server.html
|
||||||
../server.html.h: ../server.html
|
../server.html.h: ../server.html
|
||||||
xxd -i ../server.html ../server.html.h
|
xxd -i ../server.html ../server.html.h
|
||||||
|
./embed.js.h: ./embed.js
|
||||||
|
mv embed.js tmp.js
|
||||||
|
java -jar ../lsp/jscompiler.jar < tmp.js > embed.js
|
||||||
|
xxd -i embed.js embed.js.h
|
||||||
|
mv tmp.js embed.js
|
||||||
|
|
||||||
|
AM_CPPFLAGS = $(MIST_CFLAGS)
|
||||||
|
LDADD = $(MIST_LIBS)
|
||||||
|
SUBDIRS=converters analysers
|
||||||
|
bin_PROGRAMS=MistBuffer MistController MistConnRAW MistConnRTMP MistConnHTTP MistConnHTTPProgressive MistConnHTTPDynamic
|
||||||
|
MistBuffer_SOURCES=buffer.cpp buffer_user.h buffer_user.cpp buffer_stream.h buffer_stream.cpp tinythread.cpp tinythread.h ../VERSION
|
||||||
|
MistBuffer_LDADD=$(MIST_LIBS) -lpthread
|
||||||
|
MistController_SOURCES=controller.cpp ../VERSION ../server.html.h
|
||||||
|
MistConnRAW_SOURCES=conn_raw.cpp ../VERSION
|
||||||
|
MistConnRTMP_SOURCES=conn_rtmp.cpp ../VERSION
|
||||||
|
MistConnHTTP_SOURCES=conn_http.cpp tinythread.cpp tinythread.h ../VERSION ./embed.js.h
|
||||||
|
MistConnHTTP_LDADD=$(MIST_LIBS) -lpthread
|
||||||
|
MistConnHTTPProgressive_SOURCES=conn_http_progressive.cpp ../VERSION
|
||||||
|
MistConnHTTPDynamic_SOURCES=conn_http_dynamic.cpp ../VERSION
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include <mist/config.h>
|
#include <mist/config.h>
|
||||||
#include <mist/procs.h>
|
#include <mist/procs.h>
|
||||||
#include "tinythread.h"
|
#include "tinythread.h"
|
||||||
|
#include "embed.js.h"
|
||||||
|
|
||||||
/// Holds everything unique to HTTP Connector.
|
/// Holds everything unique to HTTP Connector.
|
||||||
namespace Connector_HTTP{
|
namespace Connector_HTTP{
|
||||||
|
@ -164,7 +165,9 @@ namespace Connector_HTTP{
|
||||||
}
|
}
|
||||||
response += "mistvideo['" + streamname + "'] = "+json_resp.toString()+";\n";
|
response += "mistvideo['" + streamname + "'] = "+json_resp.toString()+";\n";
|
||||||
if (url.substr(0, 6) != "/info_" && !json_resp.isMember("error")){
|
if (url.substr(0, 6) != "/info_" && !json_resp.isMember("error")){
|
||||||
response += "\n\nif(!mistvideo.hasSupport||!mistvideo.buildPlayer){mistvideo.flashVersion=function(){var version=0;try{version=navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin.description.replace(/([^0-9\\.])/g,'').split('.')[0];}catch(e){}try{version=new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable(\"$version\").replace(/([^0-9\\,])/g,'').split(',')[0];}catch(e){}return version;};mistvideo.supports={flashversion:parseInt(mistvideo.flashVersion(),10)};mistvideo.hasSupport=function(type){switch(type){case'f4v':return mistvideo.supports.flashversion>=11;break;case'rtmp':return mistvideo.supports.flashversion>=10;break;case'flv':return mistvideo.supports.flashversion>=7;break;default:return false;}};mistvideo.buildPlayer=function(src,container,width,height){switch(src.type){case'f4v':case'rtmp':case'flv':container.innerHTML='<object width=\"'+width+'\" height=\"'+height+'\"><param name=\"movie\" value=\"http://fpdownload.adobe.com/strobe/FlashMediaPlayback.swf\"></param><param name=\"flashvars\" value=\"src='+encodeURI(src.url)+'&controlBarMode=floating\"></param><param name=\"allowFullScreen\" value=\"true\"></param><param name=\"allowscriptaccess\" value=\"always\"></param><embed src=\"http://fpdownload.adobe.com/strobe/FlashMediaPlayback.swf\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"'+width+'\" height=\"'+height+'\" flashvars=\"src='+encodeURI(src.url)+'&controlBarMode=floating\"></embed></object>';break;}};}var video=mistvideo['"+streamname+"'],container=document.createElement('div'),scripts=document.getElementsByTagName('script'),me=scripts[scripts.length-1];me.parentNode.insertBefore(container,me);container.setAttribute('class','mistvideo');me.parentNode.removeChild(me);if(video.error){container.innerHTML=['<strong>Error: ',video.error,'</strong>'].join('');}else if(video.source.length<1){container.innerHTML='<strong>Error: no streams found</strong>';}else{var i,videofoundPlayer=false,len=video.source.length;for(i=0;i<len;i++){if(mistvideo.hasSupport(video.source[i].type)){mistvideo.buildPlayer(video.source[i],container,video.width,video.height);foundPlayer=true;break;}}if(!foundPlayer){container.innerHTML='fallback here';}}\n";
|
response.append("\n(");
|
||||||
|
response.append((char*)embed_js, (size_t)embed_js_len);
|
||||||
|
response.append("(\"" + streamname + "\"));\n");
|
||||||
}
|
}
|
||||||
H.SetBody(response);
|
H.SetBody(response);
|
||||||
conn->Send(H.BuildResponse("200", "OK"));
|
conn->Send(H.BuildResponse("200", "OK"));
|
||||||
|
|
Loading…
Add table
Reference in a new issue