Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function avia_html5_video_embed($path, $image = "", $types = array('webm' => 'type="video/webm"', 'mp4' => 'type="video/mp4"', 'ogv' => 'type="video/ogg"'))
- {
- preg_match("!^(.+?)(?:\.([^.]+))?$!", $path, $path_split);
- $output = "";
- if(isset($path_split[1]))
- {
- if(!$image && avia_is_200($path_split[1].'.jpg'))
- {
- $image = 'poster="'.$path_split[1].'.jpg"'; //poster image isnt accepted by the player currently, waiting for bugfix
- }
- $uid = 'player_'.get_the_ID().'_'.mt_rand().'_'.mt_rand();
- $output .= '<video class="avia_video" '.$image.' controls id="'.$uid.'" preload="metadata" >';
- foreach ($types as $key => $type)
- {
- if($path_split[2] == $key || avia_is_200($path_split[1].'.'.$key))
- {
- $output .= ' <source src="'.$path_split[1].'.'.$key.'" '.$type.' />';
- }
- }
- $output .= '</video>';
- }
- return $output;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement