Dispose player

Dispose and re-create a player with Nuevo plugin

dispose() is a public function to remove the HTML associated with a videojs player from the document. This is a helpful method to dynamically remove and recreate the player with another source(s).
An instance of the player is created using Video.js setup method to initialize a video.
Code snippet
var player = videojs("myPlayer");
Code snippet
<script>
// Find video parent element
var video_parent = document.getElementById("video_parent");
// Remove player from document
player.dispose();
// Create new video element and set appropriate attributes
var video = document.createElement('video');
video.id = "newPlayer";
video.className="video-js";
video.preload="auto";
video.controls="true";
video.style.width="100%";
video.style.height="100%";
video.setAttribute("playsinline","true");
// Append new video element to parent element
video_parent.appendChild(video);
// Initialize video.js and Nuevo plugin
player = videojs("newPlayer");
player.nuevo();
// Set video sourrce
player.src({ src:"//domain.com/video.m3u8", type:"application/x-mpegURL"});
// Start playback
player.play();
</script>