开发者

recognize a media url and include it in your html with javascript

开发者 https://www.devze.com 2023-03-27 18:31 出处:网络
I know that some sites like youtube or grooveshark allow to include an iFrame or an swf to reproduce a media开发者_运维问答 link playing it from the same page where code were injected (something like

I know that some sites like youtube or grooveshark allow to include an iFrame or an swf to reproduce a media开发者_运维问答 link playing it from the same page where code were injected (something like facebook). Is already something that someone has already written to detect which is the site you are going to include and then load into page a related preview object? thanks


I assume you're referring to something like the WPAudio Wordpress plugin, which lets you put a link to an MP3 file, and it will automatically render a nice audio player.

If so, you probably just need to look into Regular Expressions. You will need to write a number of regular expressions to detect the specific media types you're interested in supporting. When you load your content, run the regexes against the content, and if found, replace it with the appropriate embed/object tags, or whatever your preview object is.

0

精彩评论

暂无评论...
验证码 换一张
取 消