Your help is amazing and greatly appreciated.This one was difficult but I got it working. You need to use some callbacks:
I did everything as instructed and when I added , all I get is a black block.
See here
Your help is amazing and greatly appreciated.This one was difficult but I got it working. You need to use some callbacks:
Your help is amazing and greatly appreciated.
I did everything as instructed and when I added , all I get is a black block.
See here
Ah, I did use the plain bbcode in my previous post so you didn't see what I used.I can see in the page source that the media key and preview image aren't making it through.
It's this video, right?
http://mitworld.mit.edu/video/870
It works for me on my forum. To add the video you can just paste the URL into your post and rely on auto media embed. Or use the media shortcut in the editor. Either approach should result in this code being inserted into your post:
[media=mitworld]mitw-01375-school-of-sci-simons-math-09dec2010|mitwstill01375schoolofscisimonsmath09dec2010.jpg[/media]
I use this [media=mitworld]870[/media] with 870 being the video id.
Can you explain the correct way topaste url anduse media shortcut?
EDIT: I see what you mean by paste the URL (btw, the visual editor will add the url tag and it will not work. I have to do it from the plain editor).
Jake,I could actually move the page scraping into the HTML callback if you want to use that format.
I would like to either use that ID and the media code or post the url directly (in the plain editor).
<see html callback>
<?php
class MediaSites_MITWorld
{
public static function buildEmbed($mediaKey, array $site)
{
// CAPTURE WEB PAGE
$pageHtml = file_get_contents('http://mitworld.mit.edu/video/' . $mediaKey);
// ISOLATE THE EMBED CODE FROM THE PAGE SOURCE
if(preg_match("/[^\w]shareCode:'(?P<embedhtml>[^']+)'/siU", $pageHtml, $match))
{
// FROM EMBED CODE, ISOLATE THE MEDIAKEY AND PREVIEWIMAGE
if(preg_match('#param name="movie" value="[^&]+&flv=(?P<mediakey>[^&]+)&preview=http://mitworld\.mit\.edu//uploads/(?P<previewimage>[^"]+)"#si', $match['embedhtml'], $info))
{
// DEFINE GENERIC EMBED HTML WITH REPLACEMENT VARIABLES, __MEDIAKEY__ AND __PREVIEWIMAGE__
$embedHtml = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="481" height="271" id="Main" align="middle">
<param name="allowScriptAccess" value="always" />
<param name="movie" value="http://mitworld.mit.edu/flash/player/Main.swf?host=cp58255.edgefcs.net&flv=__MEDIAKEY__&preview=http://mitworld.mit.edu//uploads/__PREVIEWIMAGE__" />
<param name="quality" value="high" />
<param name="bgcolor" value="#000000" />
<embed src="http://mitworld.mit.edu/flash/player/Main.swf?host=cp58255.edgefcs.net&flv=__MEDIAKEY__&preview=http://mitworld.mit.edu//uploads/__PREVIEWIMAGE__" quality="high" bgcolor="#000000" width="481" height="271" name="Main" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>';
// MAKE THE REPLACEMENTS
$finalHtml = str_replace(array('__MEDIAKEY__', '__PREVIEWIMAGE__'), array($info['mediakey'], $info['previewimage']), $embedHtml);
// RETURN THE FINISHED HTML
return $finalHtml;
}
}
// RETURN NOTHING IF NO MATCH
return '';
}
}
Also, you mentioned something about TED video 6 months ago. Is it possible to embed TED video now?
http://xenforo.com/community/threads/how-can-i-embed-ted-com-videos.14713/#post-192616
<see html callback>
<?php
class MediaSites_TED
{
public static function buildEmbed($mediaKey, array $site)
{
// CAPTURE WEB PAGE
$pageHtml = file_get_contents('http://www.ted.com/talks/' . $mediaKey . '.html');
// ISOLATE THE EMBED CODE FROM THE PAGE SOURCE
if(preg_match('/[^\w]input id="embedCode" class="copy_paste" type="text" readonly="readonly" value="(?P<embedhtml>[^"]+)"/siU', $pageHtml, $match))
{
// IT HAS HTML ENTITIES, UNDO THAT
$match['embedhtml'] = htmlspecialchars_decode($match['embedhtml']);
// FROM EMBED CODE, ISOLATE THE FLASHVARS
if(preg_match('#param name="flashvars" value="(?P<flashvars>[^"]+)"#si', $match['embedhtml'], $info))
{
// DEFINE GENERIC EMBED HTML WITH REPLACEMENT VARIABLE, __FLASHVARS__
$embedHtml = '<object width="526" height="374">
<param name="movie" value="http://video.ted.com/assets/player/swf/EmbedPlayer.swf"></param>
<param name="allowFullScreen" value="true" />
<param name="allowScriptAccess" value="always"/>
<param name="wmode" value="transparent"></param>
<param name="bgColor" value="#ffffff"></param>
<param name="flashvars" value="__FLASHVARS__" />
<embed src="http://video.ted.com/assets/player/swf/EmbedPlayer.swf" pluginspace="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" bgColor="#ffffff" width="526" height="374" allowFullScreen="true" allowScriptAccess="always" flashvars="__FLASHVARS__"></embed>
</object>';
// MAKE THE REPLACEMENT
$finalHtml = str_replace('__FLASHVARS__', $info['flashvars'], $embedHtml);
// RETURN THE FINISHED HTML
return $finalHtml;
}
}
// RETURN NOTHING IF NO MATCH
return '';
}
}
What about playlists from www.playlist.com ?
<object id="wsj_fp" width="512" height="363">
<param name="movie" value="http://s.wsj.net/media/swf/VideoPlayerMain.swf"></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param>
<param name="flashvars" value="videoGUID={{$id}}&playerid=1000&plyMediaEnabled=1&configURL=http://wsj.vo.llnwd.net/o28/players/&autoStart=false" base="http://s.wsj.net/media/swf/"name="flashPlayer"></param>
<embed src="http://s.wsj.net/media/swf/VideoPlayerMain.swf" bgcolor="#FFFFFF"flashVars="videoGUID={{$id}}&playerid=1000&plyMediaEnabled=1&configURL=http://wsj.vo.llnwd.net/o28/players/&autoStart=false" base="http://s.wsj.net/media/swf/" name="flashPlayer" width="512" height="363" seamlesstabbing="false" type="application/x-shockwave-flash" swLiveConnect="true" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed>
</object>
You are really on a roll here, Jake.No dice. The URL doesn't contain the necessary information to embed. And the embed code isn't in the page source. They are using javascript so you can't scrape it.
<object width = "512" height = "328" >
<param name = "movie" value = "http://www-tc.pbs.org/video/media/swf/PBSPlayer.swf" ></param>
<param name="flashvars" value="video={$id}&player=viral&chapter=1" />
<param name="allowFullScreen" value="true"></param >
<param name = "allowscriptaccess" value = "always" ></param>
<param name="wmode" value="transparent"></param >
<embed src="http://www-tc.pbs.org/video/media/swf/PBSPlayer.swf" flashvars="video={$id}&player=viral&chapter=1" type="application/x-shockwave-flash" allowscriptaccess="always" wmode="transparent" allowfullscreen="true" width="512" height="328" bgcolor="#000000"></embed>
</object>
<object id="cnbcplayer" height="380" width="400" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" >
<param name="type" value="application/x-shockwave-flash"/>
<param name="allowfullscreen" value="true"/>
<param name="allowscriptaccess" value="always"/>
<param name="quality" value="best"/>
<param name="scale" value="noscale" />
<param name="wmode" value="transparent"/>
<param name="bgcolor" value="#000000"/>
<param name="salign" value="lt"/>
<param name="flashVars" value="startTime=000"/>
<param name="flashVars" value="endTime=000"/>
<param name="movie" value="http://plus.cnbc.com/rssvideosearch/action/player/id/{$id}/code/cnbcplayershare" />
<embed name="cnbcplayer" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" allowfullscreen="true" allowscriptaccess="always" bgcolor="#000000" height="380" width="400" quality="best" wmode="transparent" scale="noscale" salign="lt" src="http://plus.cnbc.com/rssvideosearch/action/player/id/{$id}/code/cnbcplayershare" type="application/x-shockwave-flash" />
</object>
<object id="vid_ign" class="ign-videoplayer" width="480" height="270" data="http://media.ign.com/ev/prod/embed.swf" type="application/x-shockwave-flash">
<param name="movie" value="http://media.ign.com/ev/prod/embed.swf" />
<param name="allowfullscreen" value="true" />
<param name="allowscriptaccess" value="always" />
<param name="bgcolor" value="#000000" />
<param name="flashvars" value="url=http://uk.ign.com/videos/{$id}"/>
</object>
<PARAM NAME=wmode VALUE="opaque">
We use essential cookies to make this site work, and optional cookies to enhance your experience.