Skip to content

Commit 026e4f1

Browse files
author
Bastian Bartmann
committed
every player now gets a random id
1 parent ef4b010 commit 026e4f1

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
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.2.0"
5+
VERSION = "0.2.1"
66
end
77
end
88
end

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ def podlovevideo(options = {})
1414
private
1515

1616
def podlove(type, options = {})
17-
html = "<#{type} id='player'>"
17+
id = "player_" + SecureRandom.hex(5)
18+
19+
html = "<#{type} id='#{id}'>"
1820
html << "<source src='#{options[:src]}'"\
1921
"" + (options[:type] ? " type='#{options[:type]}'" : "") + "></source>" if options[:src]
2022
html << "<source src='#{options[:mp4]}' type='#{type}/mp4'></source>" if options[:mp4]
@@ -26,7 +28,7 @@ def podlove(type, options = {})
2628

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

29-
script = "$('#player').podlovewebplayer(#{options.to_json});"
31+
script = "$('##{id}').podlovewebplayer(#{options.to_json});"
3032

3133
return raw html + "\n" + javascript_tag(script)
3234
end

0 commit comments

Comments
 (0)