rdoroshenko_mediaelement_rails 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. data/.gitignore +9 -0
  2. data/Gemfile +4 -0
  3. data/MIT-LICENSE +20 -0
  4. data/README.md +48 -0
  5. data/Rakefile +12 -0
  6. data/app/assets/images/mediaelement_rails/background.png +0 -0
  7. data/app/assets/images/mediaelement_rails/bigplay.png +0 -0
  8. data/app/assets/images/mediaelement_rails/controls-ted.png +0 -0
  9. data/app/assets/images/mediaelement_rails/controls-wmp-bg.png +0 -0
  10. data/app/assets/images/mediaelement_rails/controls-wmp.png +0 -0
  11. data/app/assets/images/mediaelement_rails/controls.png +0 -0
  12. data/app/assets/images/mediaelement_rails/loading.gif +0 -0
  13. data/app/assets/javascripts/mediaelement_rails/index.js +3 -0
  14. data/app/assets/javascripts/mediaelement_rails/mediaelement.js +1544 -0
  15. data/app/assets/javascripts/mediaelement_rails/mediaelementplayer.js +2757 -0
  16. data/app/assets/javascripts/mediaelement_rails/rails.js.erb +5 -0
  17. data/app/assets/plugins/mediaelement_rails/flashmediaelement.swf +0 -0
  18. data/app/assets/plugins/mediaelement_rails/silverlightmediaelement.xap +0 -0
  19. data/app/assets/stylesheets/mediaelement_rails/index.css +1 -0
  20. data/app/assets/stylesheets/mediaelement_rails/mediaelementplayer.css.erb +801 -0
  21. data/app/assets/stylesheets/mediaelement_rails/mejs-skins.css.erb +283 -0
  22. data/lib/mediaelement_rails.rb +5 -0
  23. data/lib/mediaelement_rails/engine.rb +11 -0
  24. data/lib/mediaelement_rails/version.rb +3 -0
  25. data/mediaelement_rails.gemspec +28 -0
  26. data/mediaelement_rails.thor +83 -0
  27. data/script/rails +5 -0
  28. data/test/dummy/Rakefile +7 -0
  29. data/test/dummy/app/assets/javascripts/mediaelement-and-player.js +1 -0
  30. data/test/dummy/app/assets/javascripts/mediaelement-without-player.js +1 -0
  31. data/test/dummy/app/assets/stylesheets/player-skins.css +3 -0
  32. data/test/dummy/app/assets/stylesheets/player.css +3 -0
  33. data/test/dummy/app/controllers/application_controller.rb +3 -0
  34. data/test/dummy/app/helpers/application_helper.rb +2 -0
  35. data/test/dummy/app/mailers/.gitkeep +0 -0
  36. data/test/dummy/app/models/.gitkeep +0 -0
  37. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  38. data/test/dummy/config.ru +4 -0
  39. data/test/dummy/config/application.rb +42 -0
  40. data/test/dummy/config/boot.rb +10 -0
  41. data/test/dummy/config/database.yml +25 -0
  42. data/test/dummy/config/environment.rb +5 -0
  43. data/test/dummy/config/environments/development.rb +24 -0
  44. data/test/dummy/config/environments/production.rb +51 -0
  45. data/test/dummy/config/environments/test.rb +34 -0
  46. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  47. data/test/dummy/config/initializers/inflections.rb +10 -0
  48. data/test/dummy/config/initializers/mime_types.rb +5 -0
  49. data/test/dummy/config/initializers/secret_token.rb +7 -0
  50. data/test/dummy/config/initializers/session_store.rb +8 -0
  51. data/test/dummy/config/initializers/wrap_parameters.rb +12 -0
  52. data/test/dummy/config/locales/en.yml +5 -0
  53. data/test/dummy/config/routes.rb +3 -0
  54. data/test/dummy/db/.gitkeep +0 -0
  55. data/test/dummy/lib/assets/.gitkeep +0 -0
  56. data/test/dummy/log/.gitkeep +0 -0
  57. data/test/dummy/public/404.html +26 -0
  58. data/test/dummy/public/422.html +26 -0
  59. data/test/dummy/public/500.html +26 -0
  60. data/test/dummy/public/favicon.ico +0 -0
  61. data/test/dummy/script/rails +6 -0
  62. data/test/integration/assets_test.rb +76 -0
  63. data/test/test_helper.rb +11 -0
  64. data/vendor/.gitkeep +0 -0
  65. metadata +235 -0
@@ -0,0 +1,283 @@
1
+ /* TED player */
2
+ .mejs-container.mejs-ted {
3
+
4
+ }
5
+ .mejs-ted .mejs-controls {
6
+ background: #eee;
7
+ height: 65px;
8
+ }
9
+
10
+ .mejs-ted .mejs-button,
11
+ .mejs-ted .mejs-time {
12
+ position: absolute;
13
+ background: #ddd;
14
+ }
15
+ .mejs-ted .mejs-controls .mejs-time-rail .mejs-time-total {
16
+ background-color: none;
17
+ background: url(<%= asset_path "mediaelement_rails/controls-ted.png" %>) repeat-x 0 -52px;
18
+ height: 6px;
19
+ }
20
+ .mejs-ted .mejs-controls .mejs-time-rail .mejs-time-loaded {
21
+ background-color: none;
22
+ background: url(<%= asset_path "mediaelement_rails/controls-ted.png" %>) repeat-x 0 -52px;
23
+ width: 0;
24
+ height: 6px;
25
+ }
26
+ .mejs-ted .mejs-controls .mejs-time-rail .mejs-time-current {
27
+ width: 0;
28
+ height: 6px;
29
+ background-color: none;
30
+ background: url(<%= asset_path "mediaelement_rails/controls-ted.png" %>) repeat-x 0 -59px;
31
+ }
32
+ .mejs-ted .mejs-controls .mejs-time-rail .mejs-time-handle {
33
+ display: block;
34
+ margin: 0;
35
+ width: 14px;
36
+ height: 21px;
37
+ top: -7px;
38
+ border: 0;
39
+ background: url(<%= asset_path "mediaelement_rails/controls-ted.png" %>) no-repeat 0 0;
40
+ }
41
+ .mejs-ted .mejs-controls .mejs-time-rail .mejs-time-float {
42
+ display: none;
43
+ }
44
+ .mejs-ted .mejs-controls .mejs-playpause-button {
45
+ top: 29px;
46
+ left: 9px;
47
+ width: 49px;
48
+ height: 28px;
49
+ }
50
+ .mejs-ted .mejs-controls .mejs-playpause-button button {
51
+ width: 49px;
52
+ height: 28px;
53
+ background: url(<%= asset_path "mediaelement_rails/controls-ted.png" %>) no-repeat -50px -23px;
54
+ margin: 0;
55
+ padding: 0;
56
+ }
57
+ .mejs-ted .mejs-controls .mejs-pause button {
58
+ background-position: 0 -23px;
59
+ }
60
+
61
+ .mejs-ted .mejs-controls .mejs-fullscreen-button {
62
+ top: 34px;
63
+ right: 9px;
64
+ width: 17px;
65
+ height: 15px;
66
+ background : none;
67
+ }
68
+ .mejs-ted .mejs-controls .mejs-fullscreen-button button {
69
+ width: 19px;
70
+ height: 17px;
71
+ background: transparent url(<%= asset_path "mediaelement_rails/controls-ted.png" %>) no-repeat 0 -66px;
72
+ margin: 0;
73
+ padding: 0;
74
+ }
75
+ .mejs-ted .mejs-controls .mejs-unfullscreen button {
76
+ background: transparent url(<%= asset_path "mediaelement_rails/controls-ted.png" %>) no-repeat -21px -66px;
77
+ margin: 0;
78
+ padding: 0;
79
+ }
80
+ .mejs-ted .mejs-controls .mejs-volume-button {
81
+ top: 30px;
82
+ right: 35px;
83
+ width: 24px;
84
+ height: 22px;
85
+ }
86
+ .mejs-ted .mejs-controls .mejs-mute button {
87
+ background: url(<%= asset_path "mediaelement_rails/controls-ted.png" %>) no-repeat -15px 0;
88
+ width: 24px;
89
+ height: 22px;
90
+ margin: 0;
91
+ padding: 0;
92
+ }
93
+ .mejs-ted .mejs-controls .mejs-unmute button {
94
+ background: url(<%= asset_path "mediaelement_rails/controls-ted.png" %>) no-repeat -40px 0;
95
+ width: 24px;
96
+ height: 22px;
97
+ margin: 0;
98
+ padding: 0;
99
+ }
100
+ .mejs-ted .mejs-controls .mejs-volume-button .mejs-volume-slider {
101
+ background: #fff;
102
+ border: solid 1px #aaa;
103
+ border-width: 1px 1px 0 1px;
104
+ width: 22px;
105
+ height: 65px;
106
+ top: -65px;
107
+ }
108
+ .mejs-ted .mejs-controls .mejs-volume-button .mejs-volume-total {
109
+ background: url(<%= asset_path "mediaelement_rails/controls-ted.png" %>) repeat-y -41px -66px;
110
+ left: 8px;
111
+ width: 6px;
112
+ height: 50px;
113
+ }
114
+ .mejs-ted .mejs-controls .mejs-volume-button .mejs-volume-current {
115
+ left: 8px;
116
+ width: 6px;
117
+ background: url(<%= asset_path "mediaelement_rails/controls-ted.png" %>) repeat-y -48px -66px;
118
+ height: 50px;
119
+ }
120
+
121
+ .mejs-ted .mejs-controls .mejs-volume-button .mejs-volume-handle {
122
+ display: none;
123
+ }
124
+
125
+ .mejs-ted .mejs-controls .mejs-time span {
126
+ color: #333;
127
+ }
128
+ .mejs-ted .mejs-controls .mejs-currenttime-container {
129
+ position: absolute;
130
+ top: 32px;
131
+ right: 100px;
132
+ border: solid 1px #999;
133
+ background: #fff;
134
+ color: #333;
135
+ padding-top: 2px;
136
+ border-radius: 3px;
137
+ color: #333;
138
+ }
139
+ .mejs-ted .mejs-controls .mejs-duration-container {
140
+
141
+ position: absolute;
142
+ top: 32px;
143
+ right: 65px;
144
+ border: solid 1px #999;
145
+ background: #fff;
146
+ color: #333;
147
+ padding-top: 2px;
148
+ border-radius: 3px;
149
+ color: #333;
150
+ }
151
+
152
+ .mejs-ted .mejs-controls .mejs-time button{
153
+ color: #333;
154
+ }
155
+ .mejs-ted .mejs-controls .mejs-captions-button {
156
+ display: none;
157
+ }
158
+ /* END: TED player */
159
+
160
+
161
+ /* WMP player */
162
+ .mejs-container.mejs-wmp {
163
+
164
+ }
165
+ .mejs-wmp .mejs-controls {
166
+ background: transparent url(<%= asset_path "mediaelement_rails/controls-wmp-bg.png" %>) center 16px no-repeat;
167
+ height: 65px;
168
+ }
169
+
170
+ .mejs-wmp .mejs-button,
171
+ .mejs-wmp .mejs-time {
172
+ position: absolute;
173
+ background: transparent;
174
+ }
175
+ .mejs-wmp .mejs-controls .mejs-time-rail .mejs-time-total {
176
+ background-color: transparent;
177
+ border: solid 1px #ccc;
178
+ height: 3px;
179
+ }
180
+ .mejs-wmp .mejs-controls .mejs-time-rail .mejs-time-loaded {
181
+ background-color: rgba(255,255,255,0.3);
182
+ width: 0;
183
+ height: 3px;
184
+ }
185
+ .mejs-wmp .mejs-controls .mejs-time-rail .mejs-time-current {
186
+ width: 0;
187
+ height: 1px;
188
+ background-color: #014CB6;
189
+ border: solid 1px #7FC9FA;
190
+ border-width: 1px 0;
191
+ border-color: #7FC9FA #fff #619FF2 #fff;
192
+ }
193
+ .mejs-wmp .mejs-controls .mejs-time-rail .mejs-time-handle {
194
+ display: block;
195
+ margin: 0;
196
+ width: 16px;
197
+ height: 9px;
198
+ top: -3px;
199
+ border: 0;
200
+ background: url(<%= asset_path "mediaelement_rails/controls-wmp.png" %>) no-repeat 0 -80px;
201
+ }
202
+ .mejs-wmp .mejs-controls .mejs-time-rail .mejs-time-float {
203
+ display: none;
204
+ }
205
+ .mejs-wmp .mejs-controls .mejs-playpause-button {
206
+ top: 10px;
207
+ left: 50%;
208
+ margin: 10px 0 0 -20px;
209
+ width: 40px;
210
+ height: 40px;
211
+
212
+ }
213
+ .mejs-wmp .mejs-controls .mejs-playpause-button button {
214
+ width: 40px;
215
+ height: 40px;
216
+ background: url(<%= asset_path "mediaelement_rails/controls-wmp.png" %>) no-repeat 0 0;
217
+ margin: 0;
218
+ padding: 0;
219
+ }
220
+ .mejs-wmp .mejs-controls .mejs-pause button {
221
+ background-position: 0 -40px;
222
+ }
223
+
224
+ .mejs-wmp .mejs-controls .mejs-currenttime-container {
225
+ position: absolute;
226
+ top: 25px;
227
+ left: 50%;
228
+ margin-left: -93px;
229
+ }
230
+ .mejs-wmp .mejs-controls .mejs-duration-container {
231
+ position: absolute;
232
+ top: 25px;
233
+ left: 50%;
234
+ margin-left: -58px;
235
+ }
236
+
237
+
238
+ .mejs-wmp .mejs-controls .mejs-volume-button {
239
+ top: 32px;
240
+ right: 50%;
241
+ margin-right: -55px;
242
+ width: 20px;
243
+ height: 15px;
244
+ }
245
+ .mejs-wmp .mejs-controls .mejs-volume-button button {
246
+ margin: 0;
247
+ padding: 0;
248
+ background: url(<%= asset_path "mediaelement_rails/controls-wmp.png" %>) no-repeat -42px -17px;
249
+ width: 20px;
250
+ height: 15px;
251
+ }
252
+ .mejs-wmp .mejs-controls .mejs-unmute button {
253
+ margin: 0;
254
+ padding: 0;
255
+ background: url(<%= asset_path "mediaelement_rails/controls-wmp.png" %>) no-repeat -42px 0;
256
+ width: 20px;
257
+ height: 15px;
258
+ }
259
+ .mejs-wmp .mejs-controls .mejs-volume-button .mejs-volume-slider {
260
+ background: rgba(102,102,102,0.6);
261
+ }
262
+
263
+ .mejs-wmp .mejs-controls .mejs-fullscreen-button {
264
+ top: 32px;
265
+ right: 50%;
266
+ margin-right: -82px;
267
+ width: 15px;
268
+ height: 14px;
269
+ }
270
+ .mejs-wmp .mejs-controls .mejs-fullscreen-button button {
271
+ margin: 0;
272
+ padding: 0;
273
+ background: url(<%= asset_path "mediaelement_rails/controls-wmp.png" %>) no-repeat -63px 0;
274
+ width: 15px;
275
+ height: 14px;
276
+ }
277
+ .mejs-wmp .mejs-controls .mejs-captions-button {
278
+ display: none;
279
+ }
280
+ /* END: WMP player */
281
+
282
+
283
+
@@ -0,0 +1,5 @@
1
+ require "mediaelement_rails/version"
2
+ require "mediaelement_rails/engine"
3
+
4
+ module MediaelementRails
5
+ end
@@ -0,0 +1,11 @@
1
+ require "rails/engine"
2
+ require "jquery-rails"
3
+
4
+ module MediaelementRails
5
+ class Engine < Rails::Engine
6
+ initializer 'mediaelement_rails', :after => "sprockets.environment" do |app|
7
+ next unless app.assets
8
+ app.assets.register_mime_type "application/x-silverlight-app", ".xap"
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,3 @@
1
+ module MediaelementRails
2
+ VERSION = '0.4.0'
3
+ end
@@ -0,0 +1,28 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "mediaelement_rails/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "rdoroshenko_mediaelement_rails"
7
+ s.version = MediaelementRails::VERSION
8
+ s.authors = ["Tobias Schlottke", "Pete Browne"]
9
+ s.email = ["tobias.schlottke@gmail.com", "me@petebrowne.com"]
10
+ s.homepage = "https://github.com/rdoroshenko/mediaelement_rails"
11
+ s.summary = %q{MediaElement.js for Rails}
12
+ s.description = %q{A MediaElement gem(engine) for Rails. Makes embedding HTML5 video easy.}
13
+
14
+ s.add_dependency "railties", ">= 3.1"
15
+ s.add_dependency "jquery-rails", ">= 1.0"
16
+
17
+ s.add_development_dependency "rails", ">= 3.1"
18
+ s.add_development_dependency "i18n"
19
+ s.add_development_dependency "turn"
20
+ s.add_development_dependency "sqlite3"
21
+ s.add_development_dependency "thor"
22
+ s.add_development_dependency "rake"
23
+
24
+ s.files = `git ls-files`.split("\n")
25
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
26
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
27
+ s.require_paths = ["lib"]
28
+ end
@@ -0,0 +1,83 @@
1
+ # encoding: utf-8
2
+
3
+ module MediaelementRails
4
+ class Updater < Thor
5
+ include Thor::Actions
6
+ namespace "mediaelement_rails"
7
+
8
+ UPDATE_FILES = {
9
+ "mediaelement.js" => "javascripts",
10
+ "mediaelementplayer.js" => "javascripts",
11
+ "mediaelementplayer.css" => "stylesheets",
12
+ "mejs-skins.css" => "stylesheets",
13
+ "*.{png,gif}" => "images",
14
+ "*.{swf,xap}" => "plugins"
15
+ }
16
+
17
+ TRANSFORMATIONS = {
18
+ "**/*.css.erb" => :add_asset_path_helper,
19
+ "**/*.js" => :remove_weird_characters
20
+ }
21
+
22
+ def self.source_root
23
+ File.expand_path("..", __FILE__)
24
+ end
25
+
26
+ desc "update", "Update the MediaElement.js files"
27
+ method_option "vendor_path",
28
+ :desc => "Path to the the MediaElement.js git repo",
29
+ :default => "vendor/mediaelement",
30
+ :aliases => %w(-v)
31
+ method_option "assets_path",
32
+ :desc => "Path to the the mediaelement_rails assets",
33
+ :default => "app/assets",
34
+ :aliases => %w(-a)
35
+ method_option "git",
36
+ :desc => "URL of the MediaElement.js git repo to clone",
37
+ :default => "http://github.com/johndyer/mediaelement.git",
38
+ :aliases => %w(-g)
39
+ method_option "tag",
40
+ :desc => "The tag to checkout in the MediaElement.js git repo",
41
+ :default => "master",
42
+ :aliases => %w(-t)
43
+ def update
44
+ assets_path = options[:assets_path]
45
+ vendor_path = options[:vendor_path]
46
+
47
+ # Update the vendored MediaElement.js
48
+ run "git clone #{options[:git]} #{vendor_path}", :capture => true unless File.directory? vendor_path
49
+ run "cd #{vendor_path} && git pull origin master", :capture => true
50
+ run "cd #{vendor_path} && git co #{options[:tag]}", :capture => true
51
+
52
+ # Then copy the files we need to their correct locations
53
+ UPDATE_FILES.each do |matcher, path|
54
+ Dir[File.join(vendor_path, "build", matcher)].each do |file|
55
+ new_name = File.join assets_path, path, "mediaelement_rails", File.basename(file)
56
+ new_name << ".erb" if file =~ /\.css$/
57
+ copy_file file, new_name
58
+ end
59
+ end
60
+
61
+ # Peform any transformations necessary to the files
62
+ TRANSFORMATIONS.each do |matcher, transformation|
63
+ Dir[File.join(assets_path, matcher)].each do |file|
64
+ content = File.binread file
65
+ content = send(transformation, content)
66
+ File.open(file, "wb") { |file| file.write(content) }
67
+ end
68
+ end
69
+ end
70
+
71
+ protected
72
+
73
+ # Replaces `url(...)` with url(<%= asset_path "..." %>) in CSS files.
74
+ def add_asset_path_helper(content)
75
+ content.gsub /url\((.*?)\)/, 'url(<%= asset_path "mediaelement_rails/\1" %>)'
76
+ end
77
+
78
+ # Removes the weird unicode character from the MediaElement source files.
79
+ def remove_weird_characters(content)
80
+ content.gsub //, ''
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ ENGINE_PATH = File.expand_path('../..', __FILE__)
5
+ load File.expand_path('../../test/dummy/script/rails', __FILE__)
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env rake
2
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
3
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4
+
5
+ require File.expand_path('../config/application', __FILE__)
6
+
7
+ Dummy::Application.load_tasks
@@ -0,0 +1 @@
1
+ //= require mediaelement_rails
@@ -0,0 +1 @@
1
+ //= require mediaelement_rails/rails
@@ -0,0 +1,3 @@
1
+ /*
2
+ *= require mediaelement_rails/mejs-skins
3
+ */
@@ -0,0 +1,3 @@
1
+ /*
2
+ *= require mediaelement_rails
3
+ */