Player::get_embed_url()
Generates options
Return
(string)
Source
File: includes/libs/player/player.class.php
public function get_embed_url(){
$options = [
'title' => $this->options['title'],
'byline' => $this->options['byline'],
'portrait' => $this->options['portrait'],
'color' => str_replace( '#', '', $this->options['color'] ),
'dnt' => $this->options['dnt'],
'background' => $this->options['background'],
'transparent' => $this->options['transparent']
];
/**
* Background mode loads video on autoplay, muted and with loop; no need to set the options as they
* might interfere with the player's default functionality.
*/
if( !$this->options['background'] ){
$options = array_merge(
[
'autoplay' => $this->options['autoplay'],
'muted' => $this->options['muted'],
'loop' => $this->options['loop']
],
$options
);
}
/**
* Filter to allow extra parameters to be put on the embed URL in iframe
*
* @param array $options The extra options
* @param \WP_Post|false|null $post The WordPress post object
* @param array $video_details The video details array attached to the post
* @param array $manual_options An array of manual options that might have been apssed to the player.
*/
$extra = apply_filters(
'vimeotheque\player\embed-parameters',
[],
$this->post->get_post(),
$this->post->get_video_data(),
$this->manual_options
);
if( $extra && is_array( $extra ) ){
$options = array_merge( $extra, $options );
}
$start_time = $this->get_start_time( $this->options['start_time'] );
return sprintf(
'%s?%s%s',
$this->post->get_embed_url(),
http_build_query( $options, '', '&' ),
( $start_time ? '#t=' . $start_time : '' )
);
}
Changelog
| Version | Description |
|---|---|
| 2.0.14 | Introduced. |
