Need to play video online in mvc , but video path is from another domain, itried html5 video tag for this, but not working. pls help me.
You can easily do using IFRAME.
<input type="text" id="txtUrl" style="width:300px"/> <input type="button" id="btnPlay" value="Play" /> <hr /> <iframe id="video" width="420" height="315" frameborder="0" style="display:none" allowfullscreen></iframe> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <script type="text/javascript"> $("body").on("click", "#btnPlay", function () { var url = $("#txtUrl").val(); url = url.split('v=')[1]; $("#video")[0].src = "//www.youtube.com/embed/" + url; $("#video").show(); }); </script>
Demo
IFRAME would work. And I have given you solution. HTML Video Tag will not work for other domains.
https://stackoverflow.com/questions/13516345/howto-play-youtube-videos-via-html5-video-tag
© COPYRIGHT 2024 ASPSnippets.com ALL RIGHTS RESERVED.