From c422fa65fc751b3199fe4c937384de90aaa7309f Mon Sep 17 00:00:00 2001 From: calzoneman Date: Wed, 1 Jul 2015 09:38:01 -0700 Subject: [PATCH] Add fileplayer --- build-player.js | 29 + player/raw-file.coffee | 27 + player/update.coffee | 2 + player/videojs.coffee | 4 + templates/channel.jade | 10 +- www/css/font/vjs.eot | Bin 0 -> 4804 bytes www/css/font/vjs.svg | 28 + www/css/font/vjs.ttf | Bin 0 -> 4640 bytes www/css/font/vjs.woff | Bin 0 -> 2508 bytes www/css/video-js.css | 1011 ++++++++++++++++++ www/js/callbacks.js | 6 +- www/js/jwplayer.js | 96 -- www/js/player-new.js | 1106 -------------------- www/js/player.js | 2228 ++++++++++++++++++++-------------------- www/js/swf.js | 777 -------------- www/js/video.js | 200 ++++ www/video-js.swf | Bin 0 -> 17476 bytes 17 files changed, 2399 insertions(+), 3125 deletions(-) create mode 100644 build-player.js create mode 100644 player/raw-file.coffee create mode 100644 www/css/font/vjs.eot create mode 100644 www/css/font/vjs.svg create mode 100644 www/css/font/vjs.ttf create mode 100644 www/css/font/vjs.woff create mode 100644 www/css/video-js.css delete mode 100644 www/js/jwplayer.js delete mode 100644 www/js/player-new.js delete mode 100644 www/js/swf.js create mode 100644 www/js/video.js create mode 100644 www/video-js.swf diff --git a/build-player.js b/build-player.js new file mode 100644 index 00000000..4512f3b3 --- /dev/null +++ b/build-player.js @@ -0,0 +1,29 @@ +var coffee = require('coffee-script'); +var fs = require('fs'); +var path = require('path'); + +var order = [ + 'base.coffee', + 'vimeo.coffee', + 'youtube.coffee', + 'dailymotion.coffee', + 'videojs.coffee', + 'raw-file.coffee', + 'soundcloud.coffee', + 'livestream.com.coffee', + 'twitch.coffee', + 'embed.coffee', + 'custom-embed.coffee', + 'rtmp.coffee', + 'hitbox.coffee', + 'ustream.coffee', + 'imgur.coffee', + 'update.coffee' +]; + +var buffer = ''; +order.forEach(function (file) { + buffer += fs.readFileSync(path.join('player', file)) + '\n'; +}); + +fs.writeFileSync(path.join('www', 'js', 'player.js'), coffee.compile(buffer)); diff --git a/player/raw-file.coffee b/player/raw-file.coffee new file mode 100644 index 00000000..f16f9735 --- /dev/null +++ b/player/raw-file.coffee @@ -0,0 +1,27 @@ +guessMimeTypeBecauseBrowsersAreDumb = (link) -> + m = /.*\.([a-zA-Z0-9]+)[^.]*$/.exec(link) + if m + return m[1] + else + # Couldn't guess mime type; give up and hope flash can play it + return 'flv' + +window.FilePlayer = class FilePlayer extends VideoJSPlayer + constructor: (data) -> + if not (this instanceof FilePlayer) + return new FilePlayer(data) + + data.meta.direct = + 480: [{ + contentType: guessMimeTypeBecauseBrowsersAreDumb(data.id) + link: data.id + }] + super(data) + + load: (data) -> + data.meta.direct = + 480: [{ + contentType: guessMimeTypeBecauseBrowsersAreDumb(data.id) + link: data.id + }] + super(data) diff --git a/player/update.coffee b/player/update.coffee index 8550bdb0..eda70405 100644 --- a/player/update.coffee +++ b/player/update.coffee @@ -4,6 +4,8 @@ TYPE_MAP = dm: DailymotionPlayer gd: VideoJSPlayer gp: VideoJSPlayer + fi: FilePlayer + jw: FilePlayer sc: SoundCloudPlayer li: LivestreamPlayer tw: TwitchPlayer diff --git a/player/videojs.coffee b/player/videojs.coffee index 913506cf..f2edb53d 100644 --- a/player/videojs.coffee +++ b/player/videojs.coffee @@ -32,6 +32,10 @@ sortSources = (sources) -> quality: source.quality ) +waitUntilDefined(window, 'videojs', => + videojs.options.flash.swf = '/video-js.swf' +) + window.VideoJSPlayer = class VideoJSPlayer extends Player constructor: (data) -> if not (this instanceof VideoJSPlayer) diff --git a/templates/channel.jade b/templates/channel.jade index b9f4800f..f95799a1 100644 --- a/templates/channel.jade +++ b/templates/channel.jade @@ -4,7 +4,7 @@ html(lang="en") include head mixin head() link(href="//code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css", rel="stylesheet") - link(rel="stylesheet", href="https://vjs.zencdn.net/4.12/video-js.css") + link(rel="stylesheet", href="/css/video-js.css") body #wrap nav.navbar.navbar-inverse.navbar-fixed-top(role="navigation") @@ -219,14 +219,12 @@ html(lang="en") script(src="/js/data.js") script(src="/sioconfig") script(src="/js/util.js") - script(src="/js/player-new.js") + script(src="/js/player.js") script(src="/js/paginator.js") script(src="/js/ui.js") script(src="/js/callbacks.js") script(defer, src="https://www.youtube.com/iframe_api") - script(defer, src="//api.dmcdn.net/all.js") - script(defer, src="//jwpsrv.com/library/QouFCLBMEeKC+CIACpYGxA.js") + script(defer, src="https://api.dmcdn.net/all.js") script(defer, src="/js/sc.js") script(defer, src="/js/froogaloop.min.js") - script(defer, src="/js/swf.js") - script(defer, src="https://vjs.zencdn.net/4.12/video.js") + script(defer, src="/js/video.js") diff --git a/www/css/font/vjs.eot b/www/css/font/vjs.eot new file mode 100644 index 0000000000000000000000000000000000000000..a2c0f5f24111047aa05a51377821e11312b48912 GIT binary patch literal 4804 zcmcH-OKcm*b!KOOT#CzGa`~6|6@U6rq9ls4W24l+XM(|p-oXBZR#9~B5iu$!Mznt4@F?0Xdxg)E=5uM5TJDa-K|+IWh~+ z9JvSrDmg@E$XW7Da)C^d7lGm@6F_;9Tmo5?iIXBJkbYBkb8jHxfKE~+jP!r)aNmG> zlXU^*H}FhO&rZ!heCKB{3~dMeD6)OYN{-1JnGj{vA$hN>_-b!DE!$j5-c z1$g}8)a=a8;4eM|{4R{KWq$6`Wv~+pEGqB`;|aY%1VXqsxZeTgRjZ|cBZJg|B29&Y z*{!8QU?^5wgCDCAz}6QZ<>FYG8;2trFfOi?L3r{sv?`H-Cju?LqOQa~CTpu}Ye0v7 zD`X|w!0FmYaX$7**w^T73N$K8DD-ffS}hVdNqGwn^29Xgu~y?@4q%B3y6IUdTh1~m zkkA8Vo-EfUYs<^E<@)3@%n)n9SK*;RwZ?&YGx*^=y$)LAs;gC2saNY&pj3ee7}zcW zH=!peJXKn$*JurER#^q!YQtVPt+55uH%4ic`gB93nLe7*2g~$3itdsmm##cmUVgw9 z6iL+7Pw%RlC@BwU^?|j@Zf-a9Pmv))(#ZmsE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LP5>O13w= zdlU{U1{v!fV0yNWn{3|)8tDl696A5qD~A|2w(#9?3>p}eF(~3Wd^CsE4lMoh+=<)Y z+PUlMk51V^6wm9Yqoe@DnHU{JR|}N0 zqwFhGXu8dqA(SV#I6)BE#L}YZa;Z|V7L-(%OI%!gdu{vCXB5p;|~( zU2WpkrK51-fL$k>GYy?IW!6=&n>Sh02(}7o5mg8RyLHQCA6;6M%n=}?w5CzqBZxm( zKD_qojjy}6eL|dgDJSHEH-7Tljka;~!y5(U8?!(^eD@`AEkhjYh9;AXm46)q0K1`P zcxv!e8!+O8uUK@{)ZmS@@U4Dvn+7N$3fyU;aHrWvzCo^$Kho1&CpW|hQ+dM2`IG#L za6~*Hz9q#$7A^CWzk>Bx>=~Fyqf*Jw8}?IpH@8=X19*3X&H(Ogz&ya?4OjrpY6BMG zO?RLHEAXB-4Ox!z4xpe;3$}Dxu%*+2Eu9u@>9k-G`fh3TwRE^r= + + +Generated by IcoMoon + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/www/css/font/vjs.ttf b/www/css/font/vjs.ttf new file mode 100644 index 0000000000000000000000000000000000000000..682a9b21ef23161d9f1ce0087c4385a8b31b3e26 GIT binary patch literal 4640 zcmcH+TWnlMb>_}}?cLqG_wL?(+xzss{8)Q!uh&TvcY~v(X&$6W>_mBCB`MHK6|tZQsZi1ngn;s~ALS2GK2Q}2fg%<42O*M=N+{H8&bg0x?KWwP zV0Q1!dCZ(SGjrygGlUXC+@wJm8Tjhq{z3Hy>juhi;hUP7n_hVE_RlU7LOTFId3O5J z0<;?7SD=;8URZkepZ~b@HsB3H)cU#E=`-y1t02+W1pdf5Ah=RO74Uxn-gR#7@|C?m z;O>A3ly~gH{LFNMj{~S(hN?U_ePw|p$wz>{33%$_^xW*u$S*zs{5_as%fkGn%b+I| zKUOKictT$x0wLV%-0y+%venYRlOgKDE^UQ^+8axqz*MZc20zv$fDzmar=(1PgBoWv zphm7ic=8mqDv=3CM4+Yas&|tgk+s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Fzc8sMt7HM_#B47hCyLUg6zb^RgtxIost0t!1HZnl z{mi%?yec_O>J}Vm&n96P$Dg!4X`4Q3D1KeMy_3o(oCP&q7~N0YPn>Hxm>f8KK0O=~ z#a!UG>akK(mgCLZX9$fD&#kma25$_{KMi;^Rs_)I0_B2$@Tz^y77Kd!A3n3MMXnbsIIU(;l zB_(ps1XC(v5{;=OD;q<8GH**~+wpAeG&Ar)PI=-NzY zY;8ta7?qt@S@C1od6FZ*-&Q$pw{5F0w%V)Cc{0+GP4wEiwG%_v3x@E{(Hk!HJ<@|G zj5h{DXS;P4egUosMn0@RBqU%JM-Xs$3X${u zZe9l^>vuL06gM&qGVEqAE+sBrbQUGEONwVRheR1`g~GUv-*N&auYV!^TLXjfjmIG1 zXt;nm+lF{YtSFox`M#IdLF=Nyh3yHn9pfX!8&*4uMRruy#}JSl3+InWH8eSvqor__ zBn(AmJ1f+zq>Sm&FqmfpqCX2>`0v`h0kW5zFW35kwg;lgg?5mkI&hA2pQS#k`xR=e z&H)uN7X}#8oMHdltKk|8fIVW z%N#8NN`|@R>!$%g*iC2&_||LzK=in8B_2bP#H?~ZdLyL9vC=x)F%?;zs5@qHlLf(->K*?p|9)#4cyWsZ*#83{JY~E9 literal 0 HcmV?d00001 diff --git a/www/css/video-js.css b/www/css/video-js.css new file mode 100644 index 00000000..97113b50 --- /dev/null +++ b/www/css/video-js.css @@ -0,0 +1,1011 @@ +/*! +Video.js Default Styles (http://videojs.com) +Version 4.12.7 +Create your own skin at http://designer.videojs.com +*/ +/* SKIN +================================================================================ +The main class name for all skin-specific styles. To make your own skin, +replace all occurrences of 'vjs-default-skin' with a new name. Then add your new +skin name to your video tag instead of the default skin. +e.g.