Current state: I’m parsing XML feeds into the front end and/or the back end (Admin UI), but not into the DB.
Inside those feeds i place mp3- and video content, currently only as plain text (no link, no player).
Future goal: I want to change the above behavior so visitors can watch/listen to video/audio content.
What I’m searching for: builtin (wp core) function(s) that load a (wp core) player for audio and/or video files in the feed.
What I’m not searching for: A regular expression/regex to replace the current text (link).
The solution should be independent from any plugins, themes or any other third party code.
Edit: Shortly ma question, maybe you understand my problem easier
Is there a way to see \’enclosures\’ from RSS feeds? I would like to use the images as thumbnails and view a player for video and audio enclosures. Here is an example feed item with enclosure…
<item>
<title>New Ferrari FF video</title>
<link>http://www.evo.co.uk/news/evonews/264793/ferrari_ff_new_pictures_and_video.html</link>
<description>Ferrari releases a new, action-packed and undisguised video of its FF supercar. Video and new pictures here</description>
<pubDate>Fri, 25 Feb 2011 15:04:58 +0000</pubDate>
<enclosure url="http://www.evo.co.uk/images/front_picture_library_UK/dir_853/car_photo_426559_23.jpg" length="5420" type="image/jpeg"/>
</item>
3 s
I believe part of what you’re looking for is the WP_Embed class defined in wp-includes/media.php. It implements a framework for automatically replacing urls with the output of embed handlers. I’m afraid you’ll have to do the deeper research yourself (this was apparently introduces in 2.9.0, so documentation might still be thin).
I doubt WordPress core comes with a player solution or will ever do so. It would seem it installs a single default embed handler for googlevideo urls. For anything else you’ll have to write and register your own embed handler and if you want to host the files and player yourself, you’ll either need a 3rd party player (plugin) or rely on HTML5 video/audio tags.
Ahh…and the WP_Embed class seems to get added as a callback to the ‘the_content’ filters by default, so you shouldn’t need to do so manually. At least that’s what it looks like here. 😉
IF on the other hand you are not trying to replace URLs pointing to your media files, but rather complete tag enclosures like <video></video>
or <embed></embed>
and so on, then you’ll have to rely on regex or write your PHP XML manipulation functions, as i’m pretty sure WordPress doesn’t natively come with functions to do something like that.
You could, however, combine that with above, making your job a bit easier, by regex-erasing everything within those tags and the tags themselves and only leaving the url. If you regsiter the filter callback that does that with a higher priority than 10 on the ‘the_content’ filter hook, the WP_Embed filter callback will then react on these URLs and you can do the rest using the WP_Embed framework.