Skip to content

Commit 68f4af6

Browse files
author
Bastian Bartmann
committed
refactored private view_helper pod love
1 parent 29a94ab commit 68f4af6

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

lib/podlove-web-player-rails/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module Podlove
22
module Web
33
module Player
44
module Rails
5-
VERSION = "0.3.0"
5+
VERSION = "0.2.0"
66
end
77
end
88
end

lib/podlove-web-player-rails/view_helpers.rb

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,11 @@ def podlove(type, options = {})
1717
html = "<#{type} id='player'>"
1818
html << "<source src='#{options[:src]}'"\
1919
"" + (options[:type] ? " type='#{options[:type]}'" : "") + "></source>" if options[:src]
20-
html << "<source src='#{options[:mp3]}' type='audio/mpeg'></source>" if options[:mp3]
21-
html << "<source src='#{options[:opus]}' type='audio/ogg; codecs=opus'></source>" if options[:opus]
22-
if type == 'audio'
23-
html << "<source src='#{options[:mp4]}' type='audio/mp4'></source>" if options[:mp4]
24-
html << "<source src='#{options[:ogg]}' type='audio/ogg; codecs=vorbis'></source>" if options[:ogg]
25-
end
26-
html << "<source src='#{options[:opus]}' type='video/webm'></source>" if options[:webm]
27-
if type == 'video'
28-
html << "<source src='#{options[:mp4]}' type='video/mp4'></source>" if options[:mp4]
29-
html << "<source src='#{options[:ogg]}' type='video/ogg'></source>" if options[:ogg]
30-
end
20+
html << "<source src='#{options[:mp4]}' type='#{type}/mp4'></source>" if options[:mp4]
21+
html << "<source src='#{options[:mp3]}' type='#{type}/mpeg'></source>" if options[:mp3]
22+
html << "<source src='#{options[:ogg]}' type='#{type}/ogg; codecs=vorbis'></source>" if options[:ogg]
23+
html << "<source src='#{options[:opus]}' type='#{type}/ogg; codecs=opus'></source>" if options[:opus]
24+
html << "<source src='#{options[:opus]}' type='#{type}/webm'></source>" if options[:webm]
3125
html << "</#{type}>"
3226

3327
[:src, :type, :mp4, :mp3, :ogg, :opus, :webm].each{ |key| options.delete(key) }

0 commit comments

Comments
 (0)