Created
December 1, 2015 05:52
-
-
Save anil826/0519c79e62378e067253 to your computer and use it in GitHub Desktop.
showing uploaded file in iframe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).on("input",".upload", function(){ | |
var src = $(this).val(); | |
src = src.replace("watch?v=", "v/"); | |
src = src.replace("video/", "embed/video/"); | |
var abc="<iframe src='my_source' width='452' height='345' scrolling='no' frameborder='no' target='_top' allowFullScreen></iframe>".replace(/my_source/g,src); | |
if (src.match(/(youtube|youtu|vimeo|veoh|dailymotion|kickstarter|metacafe)\.(com|be)\/((watch\?v=([-\w]+))|(video\/([-\w]+))|(projects\/([-\w]+)\/([-\w]+))|([-\w]+))/)) { | |
$(this).next('#thumbs').empty().append(abc); | |
} | |
else if( src.match(/^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))+(.mp4|.MP4|.avi|.AVI|.3gp|.3GP)$/)) { | |
$(this).next('#thumbs').empty().append(abc); | |
} | |
else{$(this).next('#thumbs').empty();} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment