Yii 1.1: yiitube

widget to render youtube, megavideo, vimeo and veoh videos into your page
28 followers

This widget simply renders videos from youtube, megavideo, veoh and vimeo inside your pages.

Requirements

works with Yii 1.1.5 or above.
Other versions were not tested.

Usage

just put the extension inside your application extension directory and that's it.
Inside any of your view files just use this code:

$this->widget('ext.Yiitube', array('v' => 'fYa0y4ETFVo'));

You can set up to 3 parameters in this widget:

  • player: is the player you want to use. Possible values are: youtube, megavideo, vimeo, veoh. Defaults to youtube.
  • v: is the video code on the player. You can either put just the video code or the whole url. The widget will take care of parsing the entire string looking for the video code.
  • hd: is a boolean value. This parameter is ignored by every player but youtube. With this value you can decide if you want youtube to display the video in high definition or not. Defaults to false.
  • size: you can decide the size of your video thanks to this parameter. Size supports 4 different values: small, normal, big, huge. Defaults to normal.

Youtube size values meaning:

  • small 560x349
  • normal 640x390
  • big 853x510
  • huge 1280x750

Megavideo size values meaning:

  • small 450x330
  • normal 640x344
  • big 800x430
  • huge 1024x551

Vimeo size values meaning:

  • small 400x225
  • normal 640x360
  • big 800x450
  • huge 1024x576

Veoh size values meaning:

  • small 410x340
  • normal 615x510
  • big 820x680
  • huge 1025x850

Total 8 comments

#16653 report it
sganz at 2014/03/16 03:58am
Specify width and height

Any chance for an update to allow specification of the width and height directly vs. using the sizes?

Thanks

Sandy

#10350 report it
mrs at 2012/10/22 05:50am
Good extension to embed youtube, vimeo video

Really helpful to embed video on website. But one issue need to fix and that is downloading extension using Firefox browser. When I downloaded using Crome then extension extracted without showing any error.

Thanks nickcv for your approach.

#10314 report it
seb7 at 2012/10/19 06:18am
shared on github

I downloaded the extension and put it on github. So any registred user can contribute.

yiitube on github

I'll make some modifications next week probably.

#8087 report it
nickcv at 2012/05/09 09:04am
thanks

thanks a lot for the comments guys, unfortunately lately i've been in development hell... asap i'll add your useful correction to the extension!

#7989 report it
Fan_Of_Yii at 2012/05/01 07:18pm
is file corrupted ?

UPDATE :- I am able to download it using chrome , somehow firefox I was getting that error .

Thanks

Hi I am downloading it using my windows 7 laptop and see the file size is 2.2 KB and after downloading it , I am not able to open it using winzip . I am able to open other tgz files whatever I have .

Could you please help me on this ?

Thanks for your help

Regards Yii Fan

#6232 report it
Junior - df9 at 2011/12/20 07:47pm
Please, fix VIMEO rendering

Hello!

Thanks for such useful extension.

Please, take a look at the VIMEO rendering function, it contains a fixed string point to a video. That should be fixed to something like

<iframe src="http://player.vimeo.com/video/{$this->v}?byline=0&amp;portrait=0" width="{$this->_width[self::VIMEO][$this->size]}" height="{$this->_height[self::VIMEO][$this->size]}" frameborder="0"></iframe>

Thanks and regards!

#5325 report it
Joblo at 2011/10/04 01:08pm
z-index problem

I had a problem with the z-index of a youtube video. The video stays in front of a fancybox ...

The solution: Added the param 'wmode=transparent' to the youtube url in the method youtubeVideoURL:

protected function youtubeVideoURL()
    {
        $url = "http://www.youtube.com/embed/{$this->v}?rel=0&wmode=transparent";
        if ($this->hd)
            $url .= '&amp;hd=1';
        return $url;
    }
#5217 report it
DryKillLogic at 2011/09/22 09:36pm
thanks

Thanks, it's a useful extension. I just had problems with the youtube url parser, maybe you can try this one:

preg_match("#(?<=v=)[a-zA-Z0-9-]+(?=&)|(?<=v\/)[^&\n]+|(?<=v=)[^&\n]+|(?<=youtu.be/)[^&\n]+#", $this->v, $matches);
return $matches[0];

This will account for

  • youtube.com/v/{vidid}
  • youtube.com/vi/{vidid}
  • youtube.com/?v={vidid}
  • youtube.com/?vi={vidid}
  • youtube.com/watch?v={vidid}
  • youtube.com/watch?vi={vidid}
  • youtu.be/{vidid}

http://stackoverflow.com/questions/3392993/php-regex-to-get-youtube-video-id

Tested on v1.1.8

see ya!.

Leave a comment

Please to leave your comment.

Create extension