$(document).on("click", "[data-behavior=play_recording]", function() { if ($(this).hasClass('active')){ return false; } $("#broadcast_video").data('videoType', 'recording'); var playback_url = $(this).attr("data-playback-url") $("#broadcast_video").empty(); new Clappr.Player({ <%= "baseUrl: 'http://cdn.clappr.io/latest'," if Rails.env.test? %> parentId: '#broadcast_video', source: playback_url, width: '100%', height: '100%', autoPlay: true }); $(".dropdown-menu").children().removeClass('active'); $(".dropdown-menu").children().children('i').remove(); $(this).siblings().removeClass('active'); $(this).siblings().children("i").remove(); $(this).addClass('active'); $(this).prepend(' '); }); $(document).on("click", "[data-behavior=play_stream]", function() { $("#broadcast_video").data('videoType', 'stream'); });