AutoEmbed is available as a downloadable PHP class that you can use directly. These examples show how to interface with AutoEmbed in your own projects.

PHP Class Example

Include the AutoEmbed class file

include "/path/to/libraries/AutoEmbed.class.php";

Obtain a new instance of the class

$AE = new AutoEmbed();

Parse any URL that contains a video on the page

If URL does not contain a resource, these methods will return false.

// load the embed source from a remote url
if (!$AE->parseUrl('http://www.youtube.com/watch?v=ikTxfIDYx6Q')) {
    // No embeddable video found (or supported)
}

// or alternatively, load the embed source from a local FLV file
if (!$AE->embedLocal('/public/flash/awesome-video.flv')) {
    // No embeddable video found
}

If resource is an image, you can retrieve it's URL

// PHP
$imageURL = $AE->getImageURL();
// HTML
<img src="<?=$imageURL?>" />

Inspect the flash vars from the video

var_dump($AE->getFlashParams());

Inspect the object params too

var_dump($AR->getObjectParams());

Let's change some parameters to suit our needs

$AE->setParam('wmode','transparent');
$AE->setParam('autoplay','false');

Inspect the flash vars again

var_dump($AE->getFlashParams());

Embed it on my page

echo $AE->getEmbedCode();

Parse a new URL, rinse and repeat as needed

$AR->parseUrl('http://videoplace.net/newvideo');

To examine the output returned by these methods, check out the demonstrations for yourself.