Keyword

YouTube HD (Allvideos 4.4)

More
12 years 8 months ago #50495 by zmaj
YouTube HD (Allvideos 4.4) was created by zmaj
If thats ok with allvideo owners, im gonna show how to add YT HD functionality in allvideos plugin.

Im gonna write lines for code in v4.4. In other versions location may change.



1. edit plugins/content/jw_allvideos/jw_allvideos.xml
add this at line 77, before transparency field name
<field name="vwidthhd" type="text" default="640" size="4" label="JW_PLG_AV_DEFAULT_HDWIDTH_IN_PX_FOR_VIDEOS" description="JW_PLG_AV_THE_PRESELECTED_HDWIDTH_OF_THE_VIDEO_IN_PIXELS_TO_SHOW_INSIDE_YOUR_CONTENT_IT_SHOULD_BE_SMALLER_THAN_THE_WIDTH_OF_THE_SURROUNDING_BOX_IF_ANY_IN_ORDER_NOT_TO_BREAK_YOUR_LAYOUT" />
<field name="vheighthd" type="text" default="360" size="4" label="JW_PLG_AV_DEFAULT_HDHEIGHT_IN_PX_FOR_VIDEOS" description="JW_PLG_AV_THE_PRESELECTED_HDHEIGHT_OF_THE_VIDEO_IN_PIXELS_TO_SHOW_INSIDE_YOUR_CONTENT" />        
save it
2. edit plugins/content/jw_allvideos/jw_allvideos.php
at line 84 add this
$vwidthhd 							= ($params->get('vwidthhd')) ? $params->get('vwidthhd') : $pluginParams->get('vwidthhd',640);
$vheighthd							= ($params->get('vheighthd')) ? $params->get('vheighthd') : $pluginParams->get('vheighthd',360);

at line 285 add this
					if($plg_tag=="youtubeHD"){						
						$tagsource = preg_replace("~(http|https):(.+?)youtube.com\/watch\?v=~s","",$tagsource);						
						$tagsourceYoutube = explode('&',$tagsource);
						$tagsource = $tagsourceYoutube[0];
						
						if(strpos($tagsource,'?')!==false){
							$tagsource = $tagsource.'&amp;rel=0&amp;fs=1&amp;wmode=transparent&amp;vq=hd720';
						} else {
							$tagsource = $tagsource.'?rel=0&amp;fs=1&amp;wmode=transparent&amp;vq=hd720';
						}
						if($final_autoplay=='true'){
							$tagsource = $tagsource.'&amp;autoplay=1';
						}

						$final_vwidth 	= (@$tagparams[1]) ? $tagparams[1] : $vwidthhd;
						$final_vheight 	= (@$tagparams[2]) ? $tagparams[2] : $vheighthd;
						$output->playerWidth = $final_vwidth;
						$output->playerHeight = $final_vheight;						
					}

save it

3. edit plugins/content/jw_allvideos//jw_allvideos/includes/sources.php
at line 286 add
"youtubeHD" => "<iframe src=\"https://www.youtube.com/embed/{SOURCE}\" width=\"{WIDTH}\" height=\"{HEIGHT}\" frameborder=\"0\" allowfullscreen title=\"JoomlaWorks AllVideos Player\"></iframe>",
save it

4. edit /administrator/language/en-gb/en-GB.plg_content_jw_allvideos
at line add
JW_PLG_AV_DEFAULT_HDHEIGHT_IN_PX_FOR_VIDEOS="Default HD height (in px) for videos"
JW_PLG_AV_DEFAULT_HDWIDTH_IN_PX_FOR_VIDEOS="Default HD width (in px) for videos"
save it


go to plugin setup, set HD player size

in article use {youtubeHD}yt id{/youtubeHD}

It should work :) It does for me ;)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum