$(document).on("click", "[data-behavior=play_recording]", function() { clearPlayingHighlight(); $(this).parent().parent().addClass('playing-highlight'); $("#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 }); }); $(document).on("click", "[data-behavior=play_stream]", function() { // clearPlayingHighlight(); $("#broadcast_video").data('videoType', 'stream'); }); function clearPlayingHighlight() { // $(".playing-highlight").each(e => { // $(e).removeClass('playing-highlight'); // }); $(".playing-highlight").removeClass("playing-highlight"); }