Extension talk:VideoFlash

Latest comment: 12 years ago by Cfrisch in2l in topic Support for Screencast.com Videos?

Is placement possible?

edit

Is there a way to specify if the video is placed left, center or right like a regular mediawiki image? Thanks67.169.112.215 07:50, 8 May 2010 (UTC)Reply

Did this ever get answered?

How do I see which pages have a VideoFlash video embedded?

edit

Similar to templates, I'd like to see a list of pages which use <videoflash>. How? Thanks. --Torley 18:56, 7 October 2009 (UTC)Reply

support for Revver?

edit

What about adding support for --Bshaw 14:53, 12 March 2011 (UTC)Revver? I tried to tweak it on my own but I was having some difficulty. Any suggestions?Reply

I have Added Revver support to VideoFlash extension --Args 11:36, 24 March 2007 (UTC)Reply

A quick and dirty solution to display videos from Revver (Example):

Copy the following code into extensions/revverflash.php :

  <?php

/*******************************************************************************
*                                                                              *
* RevverFlash Extension by Daniel Hüttenmeister, based on VideoFlash extension *
* http://www.mediawiki.org/wiki/Extension:VideoFlash                           *
*                                                                              * 
*                                                                              * 
* Tag :                                                                        *
*   <revverflash>v</revverflash>                                               * 
*                                                                              *
* Ex :                                                                         *
*   http://one.revver.com/watch/89072                			       *
*   <revverflash>89072</revverflash>                                             *
*                                                                              *
*                         						       *				*                                                                              *
********************************************************************************/ 

$wgExtensionFunctions[] = 'wfRevverFlash';
$wgExtensionCredits['parserhook'][] = array(
        'name' => 'RevverFlash',
        'description' => 'RevverFlash (based on VideoFlash from Alberto Sarullo)',
        'author' => 'Daniel Hüttenmeister',
        'url' => 'http://www.mediawiki.org/wiki/Extension:VideoFlash'
);

function wfRevverFlash() {
        global $wgParser;
        $wgParser->setHook('revverflash', 'renderRevverFlash');
}


# The callback function for converting the input text to HTML output
function renderRevverFlash($input, $args) {
        $type = "revver";
        $params = explode ("|", $input);
        $id = $params[0];
        $width = 480;
        $height = 392;
        $style = '';
        
		  $url['revver']		 = 'http://flash.revver.com/player/1.0/player.swf';
		  
  
        if(count($args)>0 && $args['type'] && $url[$args['type']]){
           $type = $args['type'];
        }        

        if (count($params) > 1) {
           $width = $params[1];
           if (count($params) > 2) {
              $height = $params[2];
              if (count($params) > 3) {
                 $style = $params[3];
              }
           }
        }
    
        $output='<embed type="application/x-shockwave-flash" src="'.$url[$type]
        .'" pluginspage="http://www.mac392romedia.com/go/getflashplayer" scale="noScale" salign="TL" bgcolor="#ffffff" flashvars="mediaId='.$id
        .'&affiliateId=0" wmode="transparent" height="'.$height.'" width="'.$width.'"></embed>';

       
        return $output;
 }

?>

Add the following lines at the end of LocalSettings.php:

require_once("extensions/revverflash.php");


Standalone .flv files

edit

There are many free .swf players for .flv files.

I find the lack of

<videoflash type="flv">somefileuploadedtomediawiki.flv</videoflash>

and

<videoflash type="flv">http://whatever.com/foo.flv</videoflash>

annoying to the point where I may much likely add something which does that. --Xiando 19:52, 13 March 2007 (UTC)Reply

hold tight, I'll commit Extension:Player in a few hours. -- Duesentrieb 20:23, 13 March 2007 (UTC)Reply
Sweet. Perhaps you should take a look and see if there's any interesting code in anarchy media player, then. It works great for wordpress sites. Perhaps there's something you can borrow from there. --Xiando 20:47, 13 March 2007 (UTC)Reply


Love the extension! --Lolade 20:42, 2 April 2007 (UTC)Reply

XSS Vulnerability Explained

edit

Consider this snippet of code (unrelated lines have been removed):

 $params = explode ("|", $input);
 $id = $params[0];
 
 // ...
 
 $url['youtube']     = 'http://www.youtube.com/v/'.$id;
 
 // ...
 
 $output= '<object width="'.$width.'" height="'.$height.'" style="' . $style . '">'
       .'<param name="movie" value="'.$url[$type].'"> &t;param name="allowfullscreen" value="true" />'

If the $id contains a doublequote followed by a close tag, the editor can effectively break out of the <param> tag and insert a <script> tag like so:

<videoflash>4lhyH5TsuPg" />
<script type="text/javascript">
alert('evil code here');
</script>
<param class="</videoflash>

This happens because the $id field is never urlencoded on the way to becoming part of the <param> tag's value attribute.

Hope this makes sense. --Jimbojw 21:00, 6 April 2007 (UTC)Reply

Since version 1.1 (2007-03-24), the entire $input is parsed (inluding any '<' or '>' tags). --Args 17:28, 10 April 2007 (UTC)Reply
You're right - sorry for the confusion. The call to htmlspecialchars takes care of the quotes. The only other thing I can find that's abusable is that it's possible to hijack the url to a degree by inserting a leading '../' vis a vis:
<videoflash>../img/pic_youtubelogo_123x63.gif</videoflash>
More of annoyance vector rather than an actual attack vector though. --Jimbojw 18:52, 10 April 2007 (UTC)Reply

godtube

edit

Does someone mind adding GodTube to this? --12.219.111.23 16:15, 16 April 2007 (UTC)Reply

FramedVideo now supports GodTube, if you still need it. (FaithTube uses YouTube streaming.) Ruiz 13:54, 17 August 2008 (UTC)Reply

faithtube

edit

or faithtube www.faithtube.com

Yahoo video

edit

It would be helpful if Yahoo video is added to this extension. I tried the obvious way and it didn't work. Thanks.

Megavideo

edit

Megavideo works well adding this: $url['megavideo' ] = 'http://www.megavideo.com/v/%1$s';

Bug

edit

Using this extension as part of a template seems to break it.
Example template:

<videoflash type="googlevideo">{{{video}}}|400|326</videoflash>

If you use this as part of a template and insert the correct video ID, it will not correctly insert the ID. It leaves the URL with {{{video}}} in the address. Any fix possible?

This isn't a bug in VideoFlash - it's a symptom of the fact that it's an extension tag. Extension tags cannot interpret the parameters as you'd like. --Jimbojw 05:24, 15 June 2007 (UTC)Reply

submitting patch

edit

Reposting here: I've modified Extension:VideoFlash a little, and added support for blip.tv- what would be the best way to go about submitting a patch for consideration ? -SignpostMarv 22:06, 1 July 2008 (UTC)Reply

It was requested that I make the modification available for consideration on the Second Life Wiki, so the modification is available here
SignpostMarv 10:50, 12 August 2008 (UTC)Reply

I am getting "Undefined offset" notices running under IIS 6.0/PHP 5.2.9-2 when I do a "Show Preview". Rather than disabling E_NOTICE, I recommend the following changes to the current code (as of the current date):

Replace

   list($id,$width,$height,$style) = explode('|',htmlspecialchars($input));
   $width = is_numeric($width) ? $width : 425;
   $height = is_numeric($height) ? $height : 350;
   $style = is_string($style) ? $style : '';

with

   $args = explode('|',htmlspecialchars($input));
   $id = $args[0];
   $width = (count($args) > 1 && is_numeric($args[1])) ? $args[1] : 425;
   $height = (count($args) > 2 && is_numeric($args[2])) ? $args[2] : 350;
   $style = (count($args) > 3 && is_string($args[3])) ? $args[3] : '';

I also recommend adding some type of version identifier, even if just in the comments, to the extension so that future reports can be against a particular version rather than "the code I grabbed at some point".

Thanks! --MobiGeek 03:19, 20 May 2009 (UTC)Reply

Programmatically include fullscreen support

edit

I wasn't sure if I should simply hacque the code or suggest the change here, so I'll suggest first, then you can decide. This also probably qualifies as a patch, but I wasn't sure where to submit?

It is really trivial to add an option (possibly as an argument to the function itself) so that the full screen display option is incorporated in the main branch of the code. The changes are simple, and require (1) initializing the boolean "$fullscreen_enabled = 0;" at the top. Here is the code:

function renderVideoFlash($input, $args) {
  $input = htmlspecialchars($input);
  $fullscreen_enabled = 0;              // set to 1 (or True) to enable full screen viewing

  // [ ... no more changes until before "return $output;" ... ]

  if ($fullscreen_enabled) {
    /****************************************************************************
    * Simple "View in fullscreen" addon by xiandos.info.                        *
    * At the end, before the output is returned, add:                           *
    *****************************************************************************/
    if (strstr($type, "googlevideo")) {
      $output .= '<p><a href="javascript:void(window.open('
        . "'http://video.google.com/googleplayer.swf?docid="
        . $id
        . "','GooglePlayer','location=no,menubar=no,scrollbars=auto,status=no,"
        . "toolbar=no,fullscreen=yes,dependent=no,left=1,top=1'))"
        . '">View the video in fullscreen</a></p>';
      }
    }
  return $output;
  }

--Fjb 02:28, 4 August 2008 (UTC)Reply

problem report

edit

i use Mediawiki 1.13.1. i installed the extension but it gives me at the top of every wiki page a line full of questionmarks like this: ???????????????????? when i desinstall the extension the problem disappears. maybe some problem with the code? thank you i give you the link to the forum wheree i reported the problem with the related screenshots http://www.mwusers.com/forums/showthread.php?p=30086#post30086 --Biris 08:56, 7 October 2008 (UTC)Reply

I don't see the problem in 1.13.2- I just upgraded my personal install to this version. Can you pastebin a copy of the extension code that you have installed, in case you have inadvertently copied the code incorrectly ?
SignpostMarv 22:38, 21 October 2008 (UTC)Reply

Vimeo, Blip.TV

edit

It seems like it would be easy to add Vimeo support. Their URLs are like this: http://www.vimeo.com/5297531

You can turn that into a SWF like this: http://vimeo.com/moogaloop.swf?clip_id=5297531

Use that as the src of the embed tag.

Regarding blip.tv, I noticed this note on the main page:

note: I don't know why Blip.tv uses different ID's in it's embed code as opposed to it's url. I suspect it may be changing over or something, which is why I haven't suggested editing the code of this extension to use the 'file' rather than the 'play' url for Blip.

I was dealing with this recently and figured out a solution. If you have this URL: http://blip.tv/file/1490573

Then the location of the SWF to use in the embed code is: http://blip.tv/scripts/flash/showplayer.swf?file=http://blip.tv/file/1490573%3Fskin%3Drss (notice it's the same file ID)

Basically, adding ?skin=rss to the regular URL gives you an RSS version, and blip has a player that reads RSS. I confirmed with blip.tv support that this works / is acceptable.

Just thought I'd throw that out there. Maybe it's not important to you guys now that it's already being done the one way (which I think would be more difficult to use).

--Orangebus 01:13, 27 June 2009 (UTC)Reply


Error on mediaWiki 1.15

edit

When saving a change to a wiki page (with the videoflash tag in) you get the following errors:

PHP Notice:  Undefined index:  vid in <path>\extensions\videoflash.php on line 62
PHP Notice:  Undefined offset:  3 in <path>\extensions\videoflash.php on line 72
PHP Notice:  Undefined offset:  2 in <path>\extensions\videoflash.php on line 72
PHP Notice:  Undefined offset:  1 in <path>\extensions\videoflash.php on line 72

The page is still updated if you navigate back and view the page manually.
Does anyone have a solution to this issue?

Quick Fix

edit

I had the same problem, I'm not sure why it has started happening on my set up as it always used to be fine. The problem occurs when the script expects 4 parameters in the shortcode but only one, the ID, is supplied. If you only ever use 1 parameter and never change the style then you can just default the values in videoflash.php, for example:

 $tmp    = explode('|',htmlspecialchars($input));
 $id     = $tmp[0];
 $width  = 425;
 $height = 350;
 $style  = '';

Someone who understands why this error is shown can prob give you a better solution! Something to do with PHP error reporting levels?

A more robust fix

edit

Replace

 list($id,$width,$height,$style) = explode('|',htmlspecialchars($input));
       $width = is_numeric($width) ? $width : 425;
       $height = is_numeric($height) ? $height : 350;
       $style = is_string($style) ? $style : '';

which causes the above error messages when the higher indexes are undefined, with

$temp =  explode('|',htmlspecialchars($input));                 
      $id     = $temp[0];
      $width  = (isset($temp[1]) and is_numeric($temp[1])) ? $temp[1] : 425; 
      $height = (isset($temp[2]) and is_numeric($temp[2])) ? $temp[2] : 350;
      $style  = (isset($temp[3]) and is_string($temp[3]))  ? $temp[3] : '';

which just checks the values are set before using them. Ten lines above this, change the first of these lines to the second (for the same reason).

$url['metacafe'] = 'http://www.metacafe.com/fplayer/%1$d/' . $args['vid'] . '.swf';
$url['metacafe'] = 'http://www.metacafe.com/fplayer/%1$d/' . (isset($args['vid']) ? $args['vid'] : '') . '.swf';

PrimeMogul 01:15, 13 May 2010 (UTC)Reply

Needs a new active maintainer

edit

Rather than leaving things ambiguous as with the previous maintainer, I'm going to state that I don't have the time to actively maintain this extension, so if anyone wants to take responsibility for it, say so :-P

SignpostMarv 15:25, 15 January 2010 (UTC)Reply

We actively use these extensions - I'm game for maintaining it --Axelseaa 17:37, 2 March 2010 (UTC)Reply

I have made some few changing on the source, to add vimeo on, and te dailymotion usage was not correct...--88.165.52.38 21:47, 22 March 2010 (UTC)Reply

Hey guys, I noticed the YouTube embeds don't have a full-screen button? I wonder why this is? Could someone savvy please add it? --Torley 20:18, 8 April 2010 (UTC)Reply
fixxorz
SignpostMarv 16:57, 30 June 2010 (UTC)Reply

Videoflash in template

edit

As per one previous post, when I do this:

<videoflash>{{{youtubevideo}}}</videoflash>

It doesnt work. Only the text is shown in the output. The {{{youtubevideo}}} is the video ID of a youtube video retrieved through a form. Only the ID shows up and not the actual video. I wonder whether, after 2 years, this functionality has been provided yet. Any ideas on how I should get a video input through a form into the template and finally, into the final page?

Thanks! Veryhuman 17:37, 21 June 2010 (UTC)Reply

I don't know if it's fixed yet but I would like to use a Template for the videoflash Widget in order to not display the parameters for each page.

Original code:

<videoflash type="">qpHzzxPvrT0</videoflash>  <-- In the first parameter if I let it blank it works by default for a Youtube video

Template code: (I called it Template:Videos)

<videoflash type="{{{1}}}">{{{2}}}</videoflash>

Page:

{{Videos||190774701X}}

This doesn't work !

Thank you for your help.

Bad encoding on mediawiki 1.16.0

edit

I've enabled the plugin as per the instructions but it breaks my installation. With the code (taken on July 30, 2010) installed the response encoding is broken.

Using safari I get the error message "Safari can’t open the page “http://www.ultipedia.org/wiki/Main_Page”. The error is: “cannot decode raw data” (NSURLErrorDomain:-1015)

Using firefox 4.0B2 I get the error message "Content Encoding Error- The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression."

Any help appreciated - ivar 07:18, 30 July 2010 (UTC)Reply

This kind of error typically occurs when gzip compression is used and some error occurs that messes up the output, making it invalid. Turn off gzip compression then poke around for errors.
SignpostMarv 17:22, 30 July 2010 (UTC)Reply

Questions and Concerns

edit

The above listed video sources are not functional. I am running the latest version of absolutely everything, including Windows 7 (not that it matters), in addition to the latest XAMPP, the latest MySQL, the latest MediaWiki, the latest Firefox and latest IE browsers, the latest Java, Flash, etc. I am fully up-to-date.

The videos on Dailymotion, Sevenload, Revver and Google do not function. The flash player for Sevenload doesnt even render in the browser (leaves an ugly gap), while the other four renders but does not play.

Currently there is no support for videos on:

The parser extension tag breaks after several days

edit

Hello to all and thanks to the extension authors!

We're having a very strange issue with this extension over at WikID. The extension performs perfectly when it has just been implemented, but on the majority of pages the videoflash parser extension tag breaks after several (two?) days. At this point no video is loaded anymore: the parser tag displays on the page just as it has been typed on the edit page instead of being parsed and loading the video object. Since an extended web search has not yielded any others who are experiencing this problem, I'm guessing that something strange has happened to our MediaWiki install. Occasionally I've noticed the same problem with the cite parser tag, but it seems to occur less often. Could someone point me in the right direction of solving this problem? Many thanks in advance!

Convergencenl 22:24, 15 February 2011 (UTC)Reply

Update: The video syntax keeps being wrapped in paragraph tags. I've tried the workaround to get raw HTML out of the extension, but this just results in an empty paragraph. Convergencenl 15:50, 10 April 2011 (UTC)Reply

Google video dont work anymore

edit

Google video do not work since the last upgrade but all of the other video services are working. Only google-video is affected.

The video window appears correctly but the clip do not begins to play.
It worked nice at the past before the update to the new wiki-version.
But if I insert the same code at
http://portlandwiki.org/PortlandWiki
and take a preview...
The video works!
It is the same Mediawiki version 1.16.2. But PHP and MySQL are newer versions than in the portland-wiki.

This extension works instead: Extension:GoogleVideo

What can be the reason why? Regards

Does not work under IE8

edit

Under Windows 7, IE8 YouTube video does not render. Fine under IE7, Firefox 3.6.13, Chrome 10.0.648.143 --Bshaw 14:54, 12 March 2011 (UTC)Reply

MyVideo

edit

If anyone needs MyVideo support, adding

$url['myvideo'] = 'http://www.myvideo.de/movie/%1$s';

to videoflash.php seems to work fine. Cheers, --Till Kraemer 12:13, 3 September 2011 (UTC)Reply

HTML5 video controls

edit

I changed the video tag output by HTML5 to $output = '<video controls'; which makes the web browsers controls appear when the video is first shown and then they are shown when the mouse is moved over the video. I do not see why anyone would not want this. Documented at http://www.w3.org/TR/html5/video.html#attr-media-controls and used on pages like http://dikt.org/Han_er_så_søt --oyvinds.

livestream.com

edit

Can someone who knows what she/he is doing explain how to adapt this extension so that it can also be used to embed livestream.com? Thanks! --Davydog 05:31, 9 October 2011 (UTC)Reply

Poster image

edit

Is it possible to add a poster image that is displayed before a user press play so that it's not a white background?

Include Local Mediawiki Video File

edit

Hi, Thanks for the extension, work quite well. I would like to know if it's possible to include local mediawiki video file: Like this: <videoflash type="localfile" style="width:400px;height:250px;">File:Video file.webm</videoflash> Thanks in advance. --Vincent G 12:33, 3 April 2012 (UTC)

This thing did not suit my needs, and I hate flash based things anyway

edit

I just changed the whole thing into this:


<?php
$wgExtensionFunctions[] = 'wfHTMl5Video';
$wgExtensionCredits['parserhook'][] = array(
        'name' => 'HTMl5Video',
        'description' => 'HTMl5Video',
        'author' => 'oyvinds',
        'url' => 'http://oyvinds.livelyblog.com/'
);

function wfHTMl5Video() {
        global $wgParser;
        $wgParser->setHook('HTMl5Video', 'renderHTMl5Video');
}

# The callback function for converting the input text to HTML output
function renderHTMl5Video($input, $args) {
        $width = isset($args['width']) ? $args['width'] : '480';
        $height = isset($args['height']) ? $args['height'] : '360';
        $poster = isset($args['poster']) ? $args['poster'] : '';
        $mp4 = isset($args['mp4']) ? $args['mp4'] : '';
        $webm = isset($args['webm']) ? $args['webm'] : '';
        $ogv = isset($args['ogv']) ? $args['ogv'] : '';
        $ogg = isset($args['ogg']) ? $args['ogg'] : '';

        $output = '<video controls="controls" preload="metadata" width="'.$width.'" height="'.$height.'"';
        if ($poster) $output  .= ' poster="'.$poster.'"';
        $output .= '>';

        if ($mp4) $output  .= "\n".'<source src="'.$mp4.'" type="video/mp4" />';
        if ($webm) $output .= "\n".'<source src="'.$webm.'" type="video/webm" />';
        if ($ogv) $output  .= "\n".'<source src="'.$ogv.'" type="video/ogg" />';
        if ($ogg) $output  .= "\n".'<source src="'.$ogg.'" type="video/ogg" />';
        $output .= '</video>';
        return $output;
}
?>

and I just put videos on pages like http://immortalpoetry.com/The_Banker with stuff like this:

<html5video 
 mp4="http://static.everdot.org/video/Poetry/Banking/The_Banker_by_Craig-James_Moncur.mp4" 
 ogv="http://static.everdot.org/video/Poetry/Banking/The_Banker_by_Craig-James_Moncur.ogv" 
 webm="http://static.everdot.org/video/Poetry/Banking/The_Banker_by_Craig-James_Moncur.webm" 
width="480" height="360"></html5video>

It even supports putting in poster="url/something.jpg".

I'll just leave all of this here in the public domain and say Good Luck if you use it. -oyvinds.everdot.org

Support for Screencast.com Videos?

edit

Awesome extension! Is there any way you can add support for screencast.com videos?

--Cfrisch in2l (talk) 22:53, 22 June 2012 (UTC)Reply

Return to "VideoFlash" page.