podlove-web-player-rails 0.2.1 → 0.3.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.
data/Rakefile CHANGED
@@ -1,6 +1 @@
1
1
  require "bundler/gem_tasks"
2
- require 'rspec/core/rake_task'
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task default: :spec
@@ -1,16 +1,11 @@
1
1
  require "podlove-web-player-rails/version"
2
2
  require "podlove-web-player-rails/view_helpers"
3
3
 
4
- module Podlove
5
- module Web
6
- module Player
7
- module Rails
8
- class Engine < ::Rails::Engine
9
- initializer "podlove-web-player-rails.view_helpers" do |app|
10
- ActionView::Base.send :include, ViewHelpers
11
- end
12
- end
13
- end
4
+ module PodloveWebPlayerRails
5
+ # Loads all the needed assets and includes the View Helpers
6
+ class Engine < ::Rails::Engine
7
+ initializer "podlove-web-player-rails.view_helpers" do |app|
8
+ ActionView::Base.send :include, ViewHelpers
14
9
  end
15
10
  end
16
11
  end
@@ -1,9 +1,6 @@
1
- module Podlove
2
- module Web
3
- module Player
4
- module Rails
5
- VERSION = "0.2.1"
6
- end
7
- end
8
- end
1
+ module PodloveWebPlayerRails
2
+ # version of the gem
3
+ VERSION = "0.3.0"
4
+ # version of the podlove web player
5
+ PODLOVE_WEB_PLAYER_VERSION = "2.0.2"
9
6
  end
@@ -1,39 +1,119 @@
1
- module Podlove
2
- module Web
3
- module Player
4
- module Rails
5
- module ViewHelpers
6
- def podloveaudio(options = {})
7
- podlove("audio", options)
8
- end
9
-
10
- def podlovevideo(options = {})
11
- podlove("video", options)
12
- end
13
-
14
- private
15
-
16
- def podlove(type, options = {})
17
- id = "player_" + SecureRandom.hex(5)
18
-
19
- html = "<#{type} id='#{id}'>"
20
- html << "<source src='#{options[:src]}'"\
21
- "" + (options[:type] ? " type='#{options[:type]}'" : "") + "></source>" if options[:src]
22
- html << "<source src='#{options[:mp4]}' type='#{type}/mp4'></source>" if options[:mp4]
23
- html << "<source src='#{options[:mp3]}' type='#{type}/mpeg'></source>" if options[:mp3]
24
- html << "<source src='#{options[:ogg]}' type='#{type}/ogg; codecs=vorbis'></source>" if options[:ogg]
25
- html << "<source src='#{options[:opus]}' type='#{type}/ogg; codecs=opus'></source>" if options[:opus]
26
- html << "<source src='#{options[:webm]}' type='#{type}/webm'></source>" if options[:webm]
27
- html << "</#{type}>"
1
+ module PodloveWebPlayerRails
2
+ # View Helpers that generate the needed HTML and JS needed for the Web Player
3
+ module ViewHelpers
4
+ # Generates the HTML markup needed for the podlove audio player and calls the podlovewebplayer
5
+ # js method with given option parameters.
6
+ #
7
+ # @param [Hash] options options for the player
8
+ # @option options [String] :src The location of an audio file, local ore remote.
9
+ # @option options [String] :type The media type of the resource.
10
+ # @option options [String] :mp4 The location of an audio file with the type mp4.
11
+ # @option options [String] :mp3 The location of an audio file with the type mp3.
12
+ # @option options [String] :ogg The location of an audio file with the type ogg.
13
+ # @option options [String] :opus The location of an audio file with the type opus.
14
+ # @option options [String] :poster The location of the cover image for the rich audio player.
15
+ # @option options [integer] :width (auto) The width of the player.
16
+ # @option options [integer] :height The height of the player.
17
+ # @option options [boolean] :loop (false) Loops the audio when it ends.
18
+ # @option options [boolean] :preload (true) Start loading the audio as soon as possible,
19
+ # before the user clicks play. This might not work on all browsers.
20
+ # @option options [boolean] :autoplay (false) Start playing the audio as soon as it's ready.
21
+ # This might not work on all (mobile) devices.
22
+ # @option options [String] :duration (false) Enables display of duration without having to load the
23
+ # media file. Use seconds or timecode as a unit
24
+ # (e.g. "3522" or "00:58:42")
25
+ # @option options [boolean] :alwaysShowHours (true) Displays the time in 00:00:00 instead of 00:00.
26
+ # @option options [boolean] :alwaysShowControls (true) Defines whether the player control bar is
27
+ # permanently visible.
28
+ # @option options [boolean] :volume (true) Disables the volume slider.
29
+ # @option options [boolean] :progress (true) Disables the progress bar.
30
+ # @option options [String] :captions URL to a WebVTT captions file.
31
+ # @option options [boolean] :chapters Takes chapter string in JSON format and builds an interactive
32
+ # chapter table. Chapters must be written in the following format:
33
+ # !{'start':'00:00:00.000', 'title':'Chapter One', 'image':''}
34
+ # @option options [String] :chapterlinks (all) Option for the jumplink behaviour in chapter table.
35
+ # Options are: 'all' (all chapter links are clickable), 'buffered' (only
36
+ # buffered chapters are clickable), 'false' (chapters are not linked)
37
+ # @option options [boolean] :chaptersVisible (false) Defines the default visibility status of
38
+ # toggable chapters module.
39
+ # @option options [boolean] :timecontrolsVisible (false) Defines the default visibility status of
40
+ # toggable time controls module.
41
+ # @option options [boolean] :summaryVisible (false) Defines the default visibility status of
42
+ # toggable summary module.
43
+ # @option options [boolean] :downloadbuttonsVisible (false) Defines the default visibility of the
44
+ # download buttons.
45
+ # @return [String] HTML markup and JS call.
46
+ def podloveaudio(options = {})
47
+ podlove("audio", options)
48
+ end
28
49
 
29
- [:src, :type, :mp4, :mp3, :ogg, :opus, :webm].each{ |key| options.delete(key) }
50
+ # Generates the HTML markup needed for the podlove video player and calls the podlovewebplayer
51
+ # js method with given option parameters.
52
+ #
53
+ # @param [Hash] options options for the player
54
+ # @option options [String] :src This location of an video file, local ore remote.
55
+ # @option options [String] :type The media type of the resource.
56
+ # @option options [String] :mp4 The location of an audio file with the type mp4.
57
+ # @option options [String] :webm The location of an audio file with the type webm.
58
+ # @option options [String] :ogg The location of an audio file with the type ogg.
59
+ # @option options [String] :poster The location of the poster frame for the video.
60
+ # @option options [integer] :width (auto) The width of the player.
61
+ # @option options [integer] :height The height of the player.
62
+ # @option options [boolean] :loop (false) Loops the video when it ends.
63
+ # @option options [boolean] :preload (true) Start loading the video as soon as possible,
64
+ # before the user clicks play. This might not work on all browsers.
65
+ # @option options [boolean] :autoplay (false) Start playing the video as soon as it's ready.
66
+ # This might not work on all (mobile) devices.
67
+ # @option options [boolean] :fullscreen (true) Disables the fullscreen button for video.
68
+ # @option options [string] :duration (false) Enables display of duration without having to load the
69
+ # media file. Use seconds or timecode as a unit
70
+ # (e.g. "3522" or "00:58:42")
71
+ # @option options [boolean] :alwaysShowHours (true) Displays the time in 00:00:00 instead of 00:00.
72
+ # @option options [boolean] :alwaysShowControls (true) Defines whether the player control bar is
73
+ # permanently visible. It might be suitable to fade the
74
+ # controls out when not hovering the video.
75
+ # @option options [boolean] :volume (true) Disables the volume slider.
76
+ # @option options [boolean] :progress (true) Disables the progress bar.
77
+ # @option options [String] :captions URL to a WebVTT captions file.
78
+ # @option options [boolean] :chapters Takes chapter string in JSON format and builds an interactive
79
+ # chapter table. Chapters must be written in the following format:
80
+ # !{'start':'00:00:00.000', 'title':'Chapter One', 'image':''}
81
+ # @option options [String] :chapterlinks (all) Option for the jumplink behaviour in chapter table.
82
+ # Options are: 'all' (all chapter links are clickable), 'buffered' (only
83
+ # buffered chapters are clickable), 'false' (chapters are not linked)
84
+ # @option options [boolean] :chaptersVisible (false) Defines the default visibility status of
85
+ # toggable chapters module.
86
+ # @option options [boolean] :timecontrolsVisible (false) Defines the default visibility status of
87
+ # toggable time controls module.
88
+ # @option options [boolean] :summaryVisible (false) Defines the default visibility status of
89
+ # toggable summary module.
90
+ # @option options [boolean] :downloadbuttonsVisible (false) Defines the default visibility of the
91
+ # download buttons.
92
+ # @return [String] HTML markup and JS call.
93
+ def podlovevideo(options = {})
94
+ podlove("video", options)
95
+ end
30
96
 
31
- script = "$('##{id}').podlovewebplayer(#{options.to_json});"
97
+ private
32
98
 
33
- return raw html + "\n" + javascript_tag(script)
34
- end
35
- end
36
- end
99
+ def podlove(type, options = {})
100
+ id = "player_" + SecureRandom.hex(5)
101
+
102
+ html = "<#{type} id='#{id}'>"
103
+ html << "<source src='#{options[:src]}'"\
104
+ "" + (options[:type] ? " type='#{options[:type]}'" : "") + "></source>" if options[:src]
105
+ html << "<source src='#{options[:mp4]}' type='#{type}/mp4'></source>" if options[:mp4]
106
+ html << "<source src='#{options[:mp3]}' type='#{type}/mpeg'></source>" if options[:mp3]
107
+ html << "<source src='#{options[:ogg]}' type='#{type}/ogg; codecs=vorbis'></source>" if options[:ogg]
108
+ html << "<source src='#{options[:opus]}' type='#{type}/ogg; codecs=opus'></source>" if options[:opus]
109
+ html << "<source src='#{options[:webm]}' type='#{type}/webm'></source>" if options[:webm]
110
+ html << "</#{type}>"
111
+
112
+ [:src, :type, :mp4, :mp3, :ogg, :opus, :webm].each{ |key| options.delete(key) }
113
+
114
+ script = "$('##{id}').podlovewebplayer(#{options.to_json});"
115
+
116
+ return raw html + "\n" + javascript_tag(script)
37
117
  end
38
118
  end
39
119
  end
@@ -5,7 +5,7 @@ require 'podlove-web-player-rails/version'
5
5
 
6
6
  Gem::Specification.new do |gem|
7
7
  gem.name = "podlove-web-player-rails"
8
- gem.version = Podlove::Web::Player::Rails::VERSION
8
+ gem.version = PodloveWebPlayerRails::VERSION
9
9
  gem.authors = ["Bastian Bartmann"]
10
10
  gem.email = ["xarfai27@gmail.com"]
11
11
  gem.description = %q{Podlove Web Player for Rails 3.}
@@ -17,7 +17,5 @@ Gem::Specification.new do |gem|
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ["lib"]
19
19
 
20
- gem.add_development_dependency "rspec"
21
- gem.add_development_dependency "coveralls"
22
20
  gem.add_dependency "railties", "~> 3.1"
23
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: podlove-web-player-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,38 +11,6 @@ bindir: bin
11
11
  cert_chain: []
12
12
  date: 2013-05-15 00:00:00.000000000 Z
13
13
  dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: rspec
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: '0'
22
- type: :development
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: '0'
30
- - !ruby/object:Gem::Dependency
31
- name: coveralls
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ! '>='
36
- - !ruby/object:Gem::Version
37
- version: '0'
38
- type: :development
39
- prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: '0'
46
14
  - !ruby/object:Gem::Dependency
47
15
  name: railties
48
16
  requirement: !ruby/object:Gem::Requirement
@@ -67,7 +35,6 @@ extensions: []
67
35
  extra_rdoc_files: []
68
36
  files:
69
37
  - .gitignore
70
- - .rspec
71
38
  - .travis.yml
72
39
  - Gemfile
73
40
  - LICENSE.txt
@@ -77,8 +44,6 @@ files:
77
44
  - lib/podlove-web-player-rails/version.rb
78
45
  - lib/podlove-web-player-rails/view_helpers.rb
79
46
  - podlove-web-player-rails.gemspec
80
- - spec/podlove-web-player-rails/view_helpers_spec.rb
81
- - spec/spec_helper.rb
82
47
  - vendor/assets/fonts/podlovefont.eot
83
48
  - vendor/assets/fonts/podlovefont.otf
84
49
  - vendor/assets/fonts/podlovefont.pfa
@@ -111,7 +76,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
111
76
  version: '0'
112
77
  segments:
113
78
  - 0
114
- hash: -423875662606043562
79
+ hash: 2864029755991511410
115
80
  required_rubygems_version: !ruby/object:Gem::Requirement
116
81
  none: false
117
82
  requirements:
@@ -120,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
85
  version: '0'
121
86
  segments:
122
87
  - 0
123
- hash: -423875662606043562
88
+ hash: 2864029755991511410
124
89
  requirements: []
125
90
  rubyforge_project:
126
91
  rubygems_version: 1.8.24
@@ -128,6 +93,4 @@ signing_key:
128
93
  specification_version: 3
129
94
  summary: Integrates the needed javascript and css in the asset pipeline and provides
130
95
  a handy helper method to integrate the player in the view.
131
- test_files:
132
- - spec/podlove-web-player-rails/view_helpers_spec.rb
133
- - spec/spec_helper.rb
96
+ test_files: []
data/.rspec DELETED
@@ -1 +0,0 @@
1
- --color
@@ -1,5 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Podlove::Web::Player::Rails::ViewHelpers do
4
-
5
- end
@@ -1,6 +0,0 @@
1
- require 'coveralls'
2
- Coveralls.wear!
3
-
4
- require 'action_controller/railtie'
5
- require 'rails/test_unit/railtie'
6
- require 'podlove-web-player-rails'