diff --git a/app/assets/javascripts/.music_player.js.swo b/app/assets/javascripts/.music_player.js.swo index 193c93e3a4cf5249702f8e9d0d3a895f5a1ce0e7..3923fc6d4a7152bd70fd678cf79b994730b4b4b1 100644 Binary files a/app/assets/javascripts/.music_player.js.swo and b/app/assets/javascripts/.music_player.js.swo differ diff --git a/app/assets/javascripts/music_player.js b/app/assets/javascripts/music_player.js index 6b6df22528e47dca607a69a77150ba0a2c1f410f..851c1f7cd2ac774962108df7cb9c58ee6e760ecc 100644 --- a/app/assets/javascripts/music_player.js +++ b/app/assets/javascripts/music_player.js @@ -87,12 +87,16 @@ function soundcloud_listener() { function soundcloud_player() { player_destroy(); - var music_url = "https://soundcloud.com/"+music_info.data().url; - SC.oEmbed(music_url, { auto_play: true , maxheight: 120, maxwidth: 1000 }, function(oEmbed) { - player = oEmbed.html.replace('visual=true&',''); - player = $('#player_block').html(player); + var music_url = "https://www.soundcloud.com/"+music_info.data().url; + SC.oEmbed(music_url, { auto_play: true , maxheight: 120, maxwidth: 1000 }, function(oEmbed, error) { + if (error) { + next_music(); + } + else { + player = oEmbed.html.replace('visual=true&',''); + player = $('#player_block').html(player); + setTimeout(soundcloud_listener, 2000 ); + } }); - setTimeout(soundcloud_listener, 2000 ); - } diff --git a/app/views/channels/show_channel.html.erb b/app/views/channels/show_channel.html.erb index ea696e17c28985de21b758915355fd658c6b94d0..edc617ad50a51eeae96717816c69898356a23730 100644 --- a/app/views/channels/show_channel.html.erb +++ b/app/views/channels/show_channel.html.erb @@ -7,7 +7,7 @@ if music.type == "youtube" track = music.url.sub(/.*v=/,'') elsif music.type == "soundcloud" - track = music.url.sub(/https:\/\/soundcloud\.com\//,'') + track = music.url.sub(/https:\/\/(www\.)?soundcloud\.com\//,'') end %>"> <span class="music_id"><%= music.id %></span> <span class="music_chan"><%= music.channel.chan %></span> diff --git a/app/views/channels/show_user.html.erb b/app/views/channels/show_user.html.erb index ea696e17c28985de21b758915355fd658c6b94d0..edc617ad50a51eeae96717816c69898356a23730 100644 --- a/app/views/channels/show_user.html.erb +++ b/app/views/channels/show_user.html.erb @@ -7,7 +7,7 @@ if music.type == "youtube" track = music.url.sub(/.*v=/,'') elsif music.type == "soundcloud" - track = music.url.sub(/https:\/\/soundcloud\.com\//,'') + track = music.url.sub(/https:\/\/(www\.)?soundcloud\.com\//,'') end %>"> <span class="music_id"><%= music.id %></span> <span class="music_chan"><%= music.channel.chan %></span> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 38a32316351339f2fe6a2a66fdb6dcf26f81e679..280a7392794d25710dab6189579e9f3752689cb1 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -14,7 +14,7 @@ </body> <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> <script src="https://www.youtube.com/iframe_api"></script> -<script src="https://connect.soundcloud.com/sdk.js"></script> +<script src="https://connect.soundcloud.com/sdk-2.0.0.js"></script> <script src="https://w.soundcloud.com/player/api.js"></script> </html> diff --git a/app/views/musics/.index.html.erb.swo b/app/views/musics/.index.html.erb.swo deleted file mode 100644 index a7022bc50a3d652a8beb4988133347be7f1ba119..0000000000000000000000000000000000000000 Binary files a/app/views/musics/.index.html.erb.swo and /dev/null differ diff --git a/app/views/musics/index.html.erb b/app/views/musics/index.html.erb index ea696e17c28985de21b758915355fd658c6b94d0..edc617ad50a51eeae96717816c69898356a23730 100644 --- a/app/views/musics/index.html.erb +++ b/app/views/musics/index.html.erb @@ -7,7 +7,7 @@ if music.type == "youtube" track = music.url.sub(/.*v=/,'') elsif music.type == "soundcloud" - track = music.url.sub(/https:\/\/soundcloud\.com\//,'') + track = music.url.sub(/https:\/\/(www\.)?soundcloud\.com\//,'') end %>"> <span class="music_id"><%= music.id %></span> <span class="music_chan"><%= music.channel.chan %></span> diff --git a/app/views/musics/show.html.erb b/app/views/musics/show.html.erb index 78e787c3b9d22a9187c001b7617ac6fa793031df..c7b3e6a771342f7359b47ac652c9e8cbc49da5ae 100644 --- a/app/views/musics/show.html.erb +++ b/app/views/musics/show.html.erb @@ -6,7 +6,7 @@ if music.type == "youtube" track = music.url.sub(/.*v=/,'') elsif music.type == "soundcloud" - track = music.url.sub(/https:\/\/soundcloud\.com\//,'') + track = music.url.sub(/https:\/\/(www\.)?soundcloud\.com\//,'') end %>"> <span class="music_id"><%= @music.id %></span> <span class="music_title"><%= @music.title%></span> diff --git a/app/views/tags/.show.html.erb.swp b/app/views/tags/.show.html.erb.swp deleted file mode 100644 index 84869f8ddadad2521ef884c44e34ea0f13766bf8..0000000000000000000000000000000000000000 Binary files a/app/views/tags/.show.html.erb.swp and /dev/null differ diff --git a/app/views/tags/show.html.erb b/app/views/tags/show.html.erb index 18488d206f6d5a31a2fe004dbbf54b29894f4f6c..08e0be1f283f22051153389af621b8bce8c16012 100644 --- a/app/views/tags/show.html.erb +++ b/app/views/tags/show.html.erb @@ -7,7 +7,7 @@ if music.type == "youtube" track = music.url.sub(/.*v=/,'') elsif music.type == "soundcloud" - track = music.url.sub(/https:\/\/soundcloud\.com\//,'') + track = music.url.sub(/https:\/\/(www\.)?soundcloud\.com\//,'') end %>"> <span class="music_id"><%= music.id %></span> <span class="music_chan"><%= music.channel.chan %></span>