MistServer
2.5.3-Pro-19-gf5e75b1 ( Generic_64)
Main Page
Human-readable topics
Data Structures
Files
Source code
File List
Globals
embed.js.h
Go to the documentation of this file.
1
const
char
*
embed_js
=
2
"function mistembed(streamname) {\n \n //find the current script\n var me;\n "
\
3
"if (('currentScript' in document) && (document.currentScript)) {\n me = docum"
\
4
"ent.currentScript;\n //not supported in old browsers :(\n }\n else {\n v"
\
5
"ar scripts = document.getElementsByTagName('script');\n me = scripts[scripts."
\
6
"length - 1];\n //not correct if the script is inserted dynamically, but this "
\
7
"is how it used to be\n }\n \n \n // return the current flash version\n func"
\
8
"tion flash_version() {\n var version = 0;\n\n try {\n // check in the"
\
9
" mimeTypes\n version = navigator.mimeTypes['application/x-shockwave-flash']"
\
10
".enabledPlugin.description.replace(/([^0-9\\.])/g, '').split('.')[0];\n } cat"
\
11
"ch(e){}\n try {\n // for our special friend IE\n version = new Acti"
\
12
"veXObject('ShockwaveFlash.ShockwaveFlash').GetVariable(\"$version\").replace(/(["
\
13
"^0-9\\,])/g, '').split(',')[0];\n } catch(e){}\n\n return parseInt(version"
\
14
", 10);\n };\n\n // return true if silverlight is installed\n function silverl"
\
15
"ight_installed() {\n var plugin;\n \n try {\n // check in the mime"
\
16
"Types\n plugin = navigator.plugins[\"Silverlight Plug-In\"];\n return "
\
17
"!!plugin;\n } catch(e){}\n try {\n // for our special friend IE\n "
\
18
" plugin = new ActiveXObject('AgControl.AgControl');\n return true;\n } "
\
19
"catch(e){}\n\n return false;\n };\n\n // return true if the browser thinks "
\
20
"it can play the mimetype\n function html5_video_type(type) {\n var support ="
\
21
" false;\n\n \n if (type == 'video/mp4') {\n if (navigator.userAgent.i"
\
22
"ndexOf('Firefox') > -1) {\n //firefox claims to support MP4 but doesn't\n"
\
23
" return false;\n }\n else if ((navigator.userAgent.indexOf('MSI"
\
24
"E') > -1) && (parseInt(navigator.userAgent.split('MSIE')[1]) <= 9)) {\n /"
\
25
"/IE <= 9 doesn't either\n return false;\n }\n }\n \n \n "
\
26
"try {\n var v = document.createElement('video');\n\n if( v && v.canPla"
\
27
"yType(type) != \"\" )\n {\n support = true; // true-ish, anyway\n "
\
28
" }\n } catch(e){}\n\n return support;\n }\n \n //return true if rtsp "
\
29
"is supported\n function rtsp_support() {\n var plugin;\n \n try {\n "
\
30
" // check in the mimeTypes\n plugin = navigator.mimeTypes[\"application/x"
\
31
"-google-vlc-plugin\"];\n return !!plugin;\n } catch(e){}\n try {\n "
\
32
" // for our special friend IE\n plugin = new ActiveXObject('VideoLAN.Vlcp"
\
33
"lugin.1');\n return true;\n } catch(e){}\n \n return false;\n }\n"
\
34
"\n // parse a \"type\" string from the controller. Format:\n // xxx/# (e.g. fl"
\
35
"ash/3) or xxx/xxx/xxx (e.g. html5/application/ogg)\n function parseType(type) {"
\
36
"\n var split = type.split('/');\n \n if( split.length > 2 ) {\n sp"
\
37
"lit[1] += '/' + split[2];\n }\n \n return split;\n }\n \n // return "
\
38
"true if a type is supported\n function hasSupport(type) {\n var typemime = p"
\
39
"arseType(type);\n \n switch(typemime[0]) {\n case 'flash': "
\
40
" return flash_version() >= parseInt(typemime[1], 10); break;\n "
\
41
"case 'html5': return html5_video_type(typemime[1]); "
\
42
" break;\n case 'rtsp': return rtsp_support(); "
\
43
" break;\n case 'silverlight': return"
\
44
" silverlight_installed(); break;\n default:"
\
45
" return false; "
\
46
" break;\n }\n }\n\n \n // build HTML for certain kinds of types\n functi"
\
47
"on buildPlayer(src, container, videowidth, videoheight, vtype) {\n // used to"
\
48
" recalculate the width/height\n var ratio;\n\n // get the container's widt"
\
49
"h/height\n var containerwidth = parseInt(container.scrollWidth, 10);\n var"
\
50
" containerheight = parseInt(container.scrollHeight, 10);\n\n if(videowidth > "
\
51
"containerwidth && containerwidth > 0) {\n ratio = videowidth / containerwid"
\
52
"th;\n\n videowidth /= ratio;\n videoheight /= ratio;\n }\n\n if("
\
53
"videoheight > containerheight && containerheight > 0) {\n ratio = videoheig"
\
54
"ht / containerheight;\n\n videowidth /= ratio;\n videoheight /= ratio;"
\
55
"\n }\n\n var maintype = parseType(src.type);\n mistvideo[streamname].em"
\
56
"bedded = src;\n \n switch(maintype[0]) {\n case 'flash':\n // "
\
57
"maintype[1] is already checked (i.e. user has version > maintype[1])\n va"
\
58
"r flashplayer,\n url = encodeURIComponent(src.url) + '&controlBarMode=flo"
\
59
"ating&initialBufferTime=0.5&expandedBufferTime=5&minContinuousPlaybackTime=3' + "
\
60
"(vtype == 'live' ? \"&streamType=live\" : \"\") + (autoplay ? '&autoPlay=true' :"
\
61
" '');\n \n /*\n if( parseInt(maintype[1], 10) >= 10 ) {\n "
\
62
" flashplayer = 'http://fpdownload.adobe.com/strobe/FlashMediaPlayback_101"
\
63
".swf';\n }\n else {\n flashplayer = 'http://fpdownload.ad"
\
64
"obe.com/strobe/FlashMediaPlayback.swf';\n }\n */\n flashpla"
\
65
"yer = src.player_url;\n \n container.innerHTML += '<object width=\""
\
66
"' + videowidth + '\" height=\"' + videoheight + '\">' +\n "
\
67
" '<param name=\"movie\" value=\"' + flashplayer + '\"></param>' + \n "
\
68
" '<param name=\"flashvars\" value=\"src=' + url + '\""
\
69
"></param>' +\n '<param name=\"allowFullScreen\" v"
\
70
"alue=\"true\"></param>' +\n '<param name=\"allows"
\
71
"criptaccess\" value=\"always\"></param>' + \n '<p"
\
72
"aram name=\"wmode\" value=\"direct\"></param>' +\n "
\
73
" (autoplay ? '<param name=\"autoPlay\" value=\"true\">' : '') +\n "
\
74
" '<embed src=\"' + flashplayer + '\" type=\"application/x-shock"
\
75
"wave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"' + v"
\
76
"ideowidth + '\" height=\"' + videoheight + '\" flashvars=\"src=' + url + '\"></e"
\
77
"mbed>' + \n '</object>';\n break;\n\n cas"
\
78
"e 'html5':\n container.innerHTML += '<video width=\"' + videowidth + '\" "
\
79
"height=\"' + videoheight + '\" src=\"' + encodeURI(src.url) + '\" controls=\"con"
\
80
"trols\" '+(autoplay ? 'autoplay=\"autoplay\"' : '')+'><strong>No HTML5 video sup"
\
81
"port</strong></video>';\n break;\n \n case 'rtsp':\n /"
\
82
"*container.innerHTML += '<object classid=\"clsid:CFCDAA03-8BE4-11cf-B84B-0020AFB"
\
83
"BCCFA\" width=\"'+videowidth+'\" height=\"'+videoheight+'\">'+\n "
\
84
" '<param name=\"src\" value=\"'+encodeURI(src.url)+'\">'+\n "
\
85
" '<param name=\"console\" value=\"video1\">'+\n "
\
86
" '<param name=\"controls\" value=\"All\">'+\n "
\
87
" '<param name=\"autostart\" value=\"false\">'+\n "
\
88
" '<param name=\"loop\" value=\"false\">'+\n "
\
89
" '<embed name=\"myMovie\" src=\"'+encodeURI(src.url)+'\""
\
90
" width=\"'+videowidth+'\" height=\"'+videoheight+'\" autostart=\"false\" loop=\""
\
91
"false\" nojava=\"true\" console=\"video1\" controls=\"All\"></embed>'+\n "
\
92
" '<noembed>Something went wrong.</noembed>'+\n "
\
93
" '</object>'; //realplayer, doesnt work */\n contai"
\
94
"ner.innerHTML += '<embed type=\"application/x-google-vlc-plugin\"'+\n "
\
95
" 'pluginspage=\"http://www.videolan.org\"'+\n "
\
96
" 'width=\"'+videowidth+'\"'+\n "
\
97
" 'height=\"'+videoheight+'\"'+\n 'target=\""
\
98
"'+encodeURI(src.url)+'\"'+\n 'autoplay=\"'+(aut"
\
99
"oplay ? 'yes' : 'no')+'\"'+\n '>'+\n "
\
100
" '</embed>'+\n '<object classid"
\
101
"=\"clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921\" codebase=\"http://downloads.vide"
\
102
"olan.org/pub/videolan/vlc/latest/win32/axvlc.cab\">'+\n "
\
103
" '</object>'; //vlc, seems to work, sort of. it's trying anyway\n bre"
\
104
"ak;\n \n case 'silverlight':\n container.innerHTML += '<obje"
\
105
"ct data=\"data:application/x-silverlight,\" type=\"application/x-silverlight\" w"
\
106
"idth=\"' + videowidth + '\" height=\"' + videoheight + '\">'+\n "
\
107
" '<param name=\"source\" value=\"' + encodeURI(src.url) + '/play"
\
108
"er.xap\"/>'+\n '<param name=\"onerror\" value=\""
\
109
"onSilverlightError\" />'+\n '<param name=\"auto"
\
110
"Upgrade\" value=\"true\" />'+\n '<param name=\""
\
111
"background\" value=\"white\" />'+\n '<param nam"
\
112
"e=\"enableHtmlAccess\" value=\"true\" />'+\n '<"
\
113
"param name=\"minRuntimeVersion\" value=\"3.0.40624.0\" />'+\n "
\
114
" '<param name=\"initparams\" value =\\'autoload=false,'+(autoplay "
\
115
"? 'autoplay=true' : 'autoplay=false')+',displaytimecode=false,enablecaptions=tru"
\
116
"e,joinLive=true,muted=false,playlist=<playList><playListItems><playListItem titl"
\
117
"e=\"Test\" description=\"testing\" mediaSource=\"' + encodeURI(src.url) + '\" ad"
\
118
"aptiveStreaming=\"true\" thumbSource=\"\" frameRate=\"25.0\" width=\"\" height=\""
\
119
"\"></playListItem></playListItems></playList>\\' />'+\n "
\
120
" '<a href=\"http://go.microsoft.com/fwlink/?LinkID=124807\" style=\"text"
\
121
"-decoration: none;\"> <img src=\"http://go.microsoft.com/fwlink/?LinkId=108181\""
\
122
" alt=\"Get Microsoft Silverlight\" style=\"border-style: none\" /></a>'+\n "
\
123
" '</object>';\n break;\n default:\n co"
\
124
"ntainer.innerHTML += '<strong>Missing embed code for output type \"'+src.type+'\""
\
125
"</strong>';\n video.error = 'Missing embed code for output type \"'+src.t"
\
126
"ype;\n }\n }\n \n var video = mistvideo[streamname],\n container = docu"
\
127
"ment.createElement('div'),\n forceType = false,\n forceSupportCheck = fals"
\
128
"e,\n autoplay = false,\n urlappend = false;\n \n if (me.parentNode.hasAt"
\
129
"tribute('data-forcetype')) {\n forceType = me.parentNode.getAttribute('data-f"
\
130
"orcetype');\n }\n if (me.parentNode.hasAttribute('data-forcesupportcheck')) {\n"
\
131
" forceSupportCheck = true;\n }\n if (me.parentNode.hasAttribute('data-autop"
\
132
"lay')) {\n autoplay = true;\n }\n if (me.parentNode.hasAttribute('data-urla"
\
133
"ppend')) {\n urlappend = me.parentNode.getAttribute('data-urlappend');\n }\n"
\
134
" \n if (video.width == 0) { video.width = 250; }\n if (video.height == 0) { v"
\
135
"ideo.height = 250; }\n \n // create the container\n me.parentNode.insertBefor"
\
136
"e(container, me);\n // set the class to 'mistvideo'\n container.setAttribute('"
\
137
"class', 'mistvideo');\n // remove script tag\n me.parentNode.removeChild(me);\n"
\
138
"\n if(video.error) {\n // there was an error; display it\n if (video.on_e"
\
139
"rror){\n container.innerHTML = video.on_error;\n }else{\n container"
\
140
".innerHTML = ['<strong>Error: ', video.error, '</strong>'].join('');\n }\n }"
\
141
"\n else if ((typeof video.source == 'undefined') || (video.source.length < 1)) "
\
142
"{\n // no stream sources\n if (video.on_error){\n container.innerHTML"
\
143
" = video.on_error;\n }else{\n container.innerHTML = '<strong>Error: no p"
\
144
"rotocols found</strong>';\n }\n }\n else {\n // no error, and sources fo"
\
145
"und. Check the video types and output the best\n // available video player.\n"
\
146
" var i,\n vtype = (video.type ? video.type : 'unknown'),\n foundPla"
\
147
"yer = false,\n len = video.source.length;\n \n for (var i in video."
\
148
"source) {\n var support = hasSupport(video.source[i].type);\n video.so"
\
149
"urce[i].browser_support = support;\n if ((support) || (forceType)) {\n "
\
150
" if ((!forceType) || ((forceType) && (video.source[i].type.indexOf(forceType) "
\
151
">= 0))) {\n if (foundPlayer === false) { \n foundPlayer = i;"
\
152
"\n if (!forceSupportCheck) {\n break;\n }\n "
\
153
" }\n }\n }\n }\n if (foundPlayer === false) {\n //"
\
154
" of all the streams given, none was supported (eg. no flash and HTML5 video). Di"
\
155
"splay error\n container.innerHTML = '<strong>No support for any player foun"
\
156
"d</strong>';\n }\n else {\n // we support this kind of video, so buil"
\
157
"d it.\n var source = video.source[foundPlayer];\n if (urlappend) {\n "
\
158
" source.url += urlappend;\n source.relurl += urlappend;\n }\n "
\
159
" else if (me.src.indexOf('?') != -1) {\n var params = me.src.split('?'"
\
160
");\n params.shift();\n params.join('?');\n source.url += '?"
\
161
"'+params;\n source.relurl += '?'+params;\n }\n buildPlayer(sour"
\
162
"ce, container, video.width, video.height, vtype);\n }\n }\n \n return (mis"
\
163
"tvideo[streamname].embedded ? mistvideo[streamname].embedded.type : false);\n /"
\
164
"/keep empty line at end of file\n}\n"
;
165
unsigned
int
embed_js_len
= 12497;
embed_js
const char * embed_js
Definition:
embed.js.h:1
embed_js_len
unsigned int embed_js_len
Definition:
embed.js.h:165
Generated on Mon Feb 29 2016 18:17:23 for MistServer by
1.8.11