Embedding of flash players
This commit is contained in:
parent
78d69673f3
commit
3c48a6c03c
9 changed files with 48618 additions and 7 deletions
|
@ -286,7 +286,7 @@ void HTTP::Parser::SetBody(std::string s) {
|
|||
/// Function that sets the body of a response or request, along with the correct Content-Length header.
|
||||
/// \param buffer The buffer data to set the body to.
|
||||
/// \param len Length of the buffer data.
|
||||
void HTTP::Parser::SetBody(char * buffer, int len) {
|
||||
void HTTP::Parser::SetBody(const char * buffer, int len) {
|
||||
body = "";
|
||||
body.append(buffer, len);
|
||||
SetHeader("Content-Length", len);
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace HTTP {
|
|||
void setCORSHeaders();
|
||||
void SetVar(std::string i, std::string v);
|
||||
void SetBody(std::string s);
|
||||
void SetBody(char * buffer, int len);
|
||||
void SetBody(const char * buffer, int len);
|
||||
std::string & BuildRequest();
|
||||
std::string & BuildResponse();
|
||||
std::string & BuildResponse(std::string code, std::string message);
|
||||
|
|
|
@ -152,12 +152,15 @@ function mistembed(streamname) {
|
|||
var flashplayer,
|
||||
url = encodeURIComponent(src.url) + '&controlBarMode=floating&initialBufferTime=0.5&expandedBufferTime=5&minContinuousPlaybackTime=3' + (vtype == 'live' ? "&streamType=live" : "") + (autoplay ? '&autoPlay=true' : '');
|
||||
|
||||
/*
|
||||
if( parseInt(maintype[1], 10) >= 10 ) {
|
||||
flashplayer = 'http://fpdownload.adobe.com/strobe/FlashMediaPlayback_101.swf';
|
||||
}
|
||||
else {
|
||||
flashplayer = 'http://fpdownload.adobe.com/strobe/FlashMediaPlayback.swf';
|
||||
}
|
||||
*/
|
||||
flashplayer = src.player_url;
|
||||
|
||||
container.innerHTML += '<object width="' + videowidth + '" height="' + videoheight + '">' +
|
||||
'<param name="movie" value="' + flashplayer + '"></param>' +
|
||||
|
@ -297,4 +300,5 @@ function mistembed(streamname) {
|
|||
}
|
||||
|
||||
return (mistvideo[streamname].embedded ? mistvideo[streamname].embedded.type : false);
|
||||
//keep empty line at end of file
|
||||
}
|
||||
|
|
24308
src/output/flashPlayer.h
Normal file
24308
src/output/flashPlayer.h
Normal file
File diff suppressed because it is too large
Load diff
24270
src/output/oldFlashPlayer.h
Normal file
24270
src/output/oldFlashPlayer.h
Normal file
File diff suppressed because it is too large
Load diff
|
@ -160,6 +160,7 @@ namespace Mist {
|
|||
capa["methods"][0u]["handler"] = "http";
|
||||
capa["methods"][0u]["type"] = "flash/11";
|
||||
capa["methods"][0u]["priority"] = 7ll;
|
||||
capa["methods"][0u]["player_url"] = "/flashplayer.swf";
|
||||
}
|
||||
|
||||
void OutHDS::sendNext(){
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#include <sys/stat.h>
|
||||
#include "output_http_internal.h"
|
||||
#include <mist/stream.h>
|
||||
#include "flashPlayer.h"
|
||||
#include "oldFlashPlayer.h"
|
||||
|
||||
namespace Mist {
|
||||
OutHTTP::OutHTTP(Socket::Connection & conn) : HTTPOutput(conn){
|
||||
|
@ -49,6 +51,8 @@ namespace Mist {
|
|||
capa["url_match"].append("/info_$.js");
|
||||
capa["url_match"].append("/json_$.js");
|
||||
capa["url_match"].append("/embed_$.js");
|
||||
capa["url_match"].append("/flashplayer.swf");
|
||||
capa["url_match"].append("/oldflashplayer.swf");
|
||||
cfg->addConnectorOptions(8080, capa);
|
||||
}
|
||||
|
||||
|
@ -87,18 +91,22 @@ namespace Mist {
|
|||
}
|
||||
};
|
||||
|
||||
void addSource(const std::string & rel, std::set<JSON::Value, sourceCompare> & sources, std::string & host, const std::string & port, JSON::Value & conncapa, unsigned int most_simul, unsigned int total_matches){
|
||||
void addSource(const std::string & rel, std::set<JSON::Value, sourceCompare> & sources, std::string & host, const std::string & port, JSON::Value & conncapa, unsigned int most_simul, unsigned int total_matches, const std::string & flvPlayerPrefix){
|
||||
JSON::Value tmp;
|
||||
tmp["type"] = conncapa["type"];
|
||||
tmp["relurl"] = rel;
|
||||
tmp["priority"] = conncapa["priority"];
|
||||
if (conncapa.isMember("player_url")){
|
||||
tmp["player_url"] = flvPlayerPrefix + conncapa["player_url"].asStringRef();
|
||||
}
|
||||
tmp["simul_tracks"] = most_simul;
|
||||
tmp["total_matches"] = total_matches;
|
||||
tmp["url"] = conncapa["handler"].asStringRef() + "://" + host + ":" + port + rel;
|
||||
sources.insert(tmp);
|
||||
}
|
||||
|
||||
void addSources(std::string & streamname, const std::string & rel, std::set<JSON::Value, sourceCompare> & sources, std::string & host, const std::string & port, JSON::Value & conncapa, JSON::Value & strmMeta){
|
||||
|
||||
void addSources(std::string & streamname, const std::string & rel, std::set<JSON::Value, sourceCompare> & sources, std::string & host, const std::string & port, JSON::Value & conncapa, JSON::Value & strmMeta, const std::string httpHost){
|
||||
unsigned int most_simul = 0;
|
||||
unsigned int total_matches = 0;
|
||||
if (conncapa.isMember("codecs") && conncapa["codecs"].size() > 0){
|
||||
|
@ -137,7 +145,7 @@ namespace Mist {
|
|||
}
|
||||
jsonForEach(conncapa["methods"], it) {
|
||||
if (!strmMeta.isMember("live") || !it->isMember("nolive")){
|
||||
addSource(relurl, sources, host, port, *it, most_simul, total_matches);
|
||||
addSource(relurl, sources, host, port, *it, most_simul, total_matches, "http://" + httpHost);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -164,6 +172,23 @@ namespace Mist {
|
|||
return;
|
||||
} //clientaccesspolicy.xml
|
||||
|
||||
if (H.url == "/flashplayer.swf"){
|
||||
H.Clean();
|
||||
H.SetHeader("Content-Type", "application/x-shockwave-flash");
|
||||
H.SetHeader("Server", "MistServer/" PACKAGE_VERSION);
|
||||
H.SetBody((const char*)FlashMediaPlayback_101_swf, FlashMediaPlayback_101_swf_len);
|
||||
H.SendResponse("200", "OK", myConn);
|
||||
return;
|
||||
}
|
||||
if (H.url == "/oldflashplayer.swf"){
|
||||
H.Clean();
|
||||
H.SetHeader("Content-Type", "application/x-shockwave-flash");
|
||||
H.SetHeader("Server", "MistServer/" PACKAGE_VERSION);
|
||||
H.SetBody((const char *)FlashMediaPlayback_swf, FlashMediaPlayback_swf_len);
|
||||
H.SendResponse("200", "OK", myConn);
|
||||
return;
|
||||
|
||||
}
|
||||
// send logo icon
|
||||
if (H.url.length() > 4 && H.url.substr(H.url.length() - 4, 4) == ".ico"){
|
||||
H.Clean();
|
||||
|
@ -240,6 +265,7 @@ namespace Mist {
|
|||
}
|
||||
|
||||
if ((H.url.length() > 9 && H.url.substr(0, 6) == "/info_" && H.url.substr(H.url.length() - 3, 3) == ".js") || (H.url.length() > 10 && H.url.substr(0, 7) == "/embed_" && H.url.substr(H.url.length() - 3, 3) == ".js") || (H.url.length() > 9 && H.url.substr(0, 6) == "/json_" && H.url.substr(H.url.length() - 3, 3) == ".js")){
|
||||
std::string fullHost = H.GetHeader("Host");
|
||||
std::string response;
|
||||
std::string rURL = H.url;
|
||||
std::string host = H.GetHeader("Host");
|
||||
|
@ -336,7 +362,7 @@ namespace Mist {
|
|||
//and a URL - then list the URL
|
||||
if (capa.getMember("url_rel")){
|
||||
JSON::Value capa_json = capa.asJSON();
|
||||
addSources(streamName, capa.getMember("url_rel").asString(), sources, host, port, capa_json, json_resp["meta"]);
|
||||
addSources(streamName, capa.getMember("url_rel").asString(), sources, host, port, capa_json, json_resp["meta"], fullHost);
|
||||
}
|
||||
//check each enabled protocol separately to see if it depends on this connector
|
||||
DTSC::Scan capa_lst = DTSC::Scan(serverCfg.mapped, serverCfg.len).getMember("capabilities").getMember("connectors");
|
||||
|
@ -345,7 +371,7 @@ namespace Mist {
|
|||
//if it depends on this connector and has a URL, list it
|
||||
if (conns.count(capa_lst.getIndiceName(j)) && (capa_lst.getIndice(j).getMember("deps").asString() == cName || capa_lst.getIndice(j).getMember("deps").asString() + ".exe" == cName) && capa_lst.getIndice(j).getMember("methods")){
|
||||
JSON::Value capa_json = capa_lst.getIndice(j).asJSON();
|
||||
addSources(streamName, capa_lst.getIndice(j).getMember("url_rel").asString(), sources, host, port, capa_json, json_resp["meta"]);
|
||||
addSources(streamName, capa_lst.getIndice(j).getMember("url_rel").asString(), sources, host, port, capa_json, json_resp["meta"], fullHost);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ namespace Mist {
|
|||
capa["methods"][0u]["handler"] = "http";
|
||||
capa["methods"][0u]["type"] = "flash/7";
|
||||
capa["methods"][0u]["priority"] = 5ll;
|
||||
capa["methods"][0u]["player_url"] = "/oldflashplayer.swf";
|
||||
}
|
||||
|
||||
void OutProgressiveFLV::sendNext(){
|
||||
|
|
|
@ -115,6 +115,7 @@ namespace Mist {
|
|||
capa["methods"][0u]["handler"] = "rtmp";
|
||||
capa["methods"][0u]["type"] = "flash/10";
|
||||
capa["methods"][0u]["priority"] = 6ll;
|
||||
capa["methods"][0u]["player_url"] = "/flashplayer.swf";
|
||||
cfg->addConnectorOptions(1935, capa);
|
||||
config = cfg;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue