/**
  * @param string $videoId The video ID to play.
  *
  * @return ehough_curly_Url The URL of the data for this video.
  */
 public final function getDataUrlForVideo($videoId)
 {
     $context = tubepress_impl_patterns_sl_ServiceLocator::getExecutionContext();
     $link = new ehough_curly_Url('https://www.youtube.com/embed/' . $videoId);
     $qss = tubepress_impl_patterns_sl_ServiceLocator::getQueryStringService();
     $url = new ehough_curly_Url($qss->getFullUrl($_SERVER));
     $origin = $url->getScheme() . '://' . $url->getHost();
     $autoPlay = $context->get(tubepress_api_const_options_names_Embedded::AUTOPLAY);
     $loop = $context->get(tubepress_api_const_options_names_Embedded::LOOP);
     $showInfo = $context->get(tubepress_api_const_options_names_Embedded::SHOW_INFO);
     $autoHide = $context->get(tubepress_addons_youtube_api_const_options_names_Embedded::AUTOHIDE);
     $enableJsApi = $context->get(tubepress_api_const_options_names_Embedded::ENABLE_JS_API);
     $fullscreen = $context->get(tubepress_addons_youtube_api_const_options_names_Embedded::FULLSCREEN);
     $modestBranding = $context->get(tubepress_addons_youtube_api_const_options_names_Embedded::MODEST_BRANDING);
     $showRelated = $context->get(tubepress_addons_youtube_api_const_options_names_Embedded::SHOW_RELATED);
     $link->setQueryVariable('wmode', 'opaque');
     $link->setQueryVariable('autohide', $this->_getAutoHideValue($autoHide));
     $link->setQueryVariable('autoplay', tubepress_impl_embedded_EmbeddedPlayerUtils::booleanToOneOrZero($autoPlay));
     $link->setQueryVariable('enablejsapi', tubepress_impl_embedded_EmbeddedPlayerUtils::booleanToOneOrZero($enableJsApi));
     $link->setQueryVariable('fs', tubepress_impl_embedded_EmbeddedPlayerUtils::booleanToOneOrZero($fullscreen));
     $link->setQueryVariable('loop', tubepress_impl_embedded_EmbeddedPlayerUtils::booleanToOneOrZero($loop));
     $link->setQueryVariable('modestbranding', tubepress_impl_embedded_EmbeddedPlayerUtils::booleanToOneOrZero($modestBranding));
     $link->setQueryVariable('rel', tubepress_impl_embedded_EmbeddedPlayerUtils::booleanToOneOrZero($showRelated));
     $link->setQueryVariable('showinfo', tubepress_impl_embedded_EmbeddedPlayerUtils::booleanToOneOrZero($showInfo));
     $link->setQueryVariable('origin', $origin);
     return $link;
 }
 public function onEmbeddedTemplate(tubepress_api_event_EventInterface $event)
 {
     $context = tubepress_impl_patterns_sl_ServiceLocator::getExecutionContext();
     $environment = tubepress_impl_patterns_sl_ServiceLocator::getEnvironmentDetector();
     $template = $event->getSubject();
     $dataUrl = $event->getArgument('dataUrl');
     $videoId = $event->getArgument('videoId');
     $providerName = $event->getArgument('providerName');
     $autoPlay = $context->get(tubepress_api_const_options_names_Embedded::AUTOPLAY);
     $embedWidth = $context->get(tubepress_api_const_options_names_Embedded::EMBEDDED_WIDTH);
     $embedHeight = $context->get(tubepress_api_const_options_names_Embedded::EMBEDDED_HEIGHT);
     $vars = array(tubepress_api_const_template_Variable::EMBEDDED_DATA_URL => $dataUrl->toString(true), tubepress_api_const_template_Variable::TUBEPRESS_BASE_URL => $environment->getBaseUrl(), tubepress_api_const_template_Variable::EMBEDDED_AUTOSTART => tubepress_impl_embedded_EmbeddedPlayerUtils::booleanToString($autoPlay), tubepress_api_const_template_Variable::EMBEDDED_WIDTH => $embedWidth, tubepress_api_const_template_Variable::EMBEDDED_HEIGHT => $embedHeight, tubepress_api_const_template_Variable::VIDEO_ID => $videoId, tubepress_api_const_template_Variable::VIDEO_DOM_ID => $this->_getVideoDomId($providerName, $dataUrl), tubepress_api_const_template_Variable::EMBEDDED_IMPL_NAME => $event->getArgument('embeddedImplementationName'), tubepress_api_const_template_Variable::VIDEO_PROVIDER_NAME => $providerName);
     foreach ($vars as $key => $value) {
         $template->setVariable($key, $value);
     }
     return $template;
 }
 /**
  * @param string $videoId The video ID to play.
  *
  * @return ehough_curly_Url The URL of the data for this video.
  */
 public final function getDataUrlForVideo($videoId)
 {
     $context = tubepress_impl_patterns_sl_ServiceLocator::getExecutionContext();
     $autoPlay = $context->get(tubepress_api_const_options_names_Embedded::AUTOPLAY);
     $showInfo = $context->get(tubepress_api_const_options_names_Embedded::SHOW_INFO);
     $loop = $context->get(tubepress_api_const_options_names_Embedded::LOOP);
     $jsApi = $context->get(tubepress_api_const_options_names_Embedded::ENABLE_JS_API);
     $color = $context->get(tubepress_addons_vimeo_api_const_options_names_Embedded::PLAYER_COLOR);
     /* build the data URL based on these options */
     $link = new ehough_curly_Url("http://player.vimeo.com/video/{$videoId}");
     $link->setQueryVariable(self::$_URL_PARAM_AUTOPLAY, tubepress_impl_embedded_EmbeddedPlayerUtils::booleanToOneOrZero($autoPlay));
     $link->setQueryVariable(self::$_URL_PARAM_COLOR, $color);
     $link->setQueryVariable(self::$_URL_PARAM_LOOP, tubepress_impl_embedded_EmbeddedPlayerUtils::booleanToOneOrZero($loop));
     $link->setQueryVariable(self::$_URL_PARAM_PORTRAIT, tubepress_impl_embedded_EmbeddedPlayerUtils::booleanToOneOrZero($showInfo));
     $link->setQueryVariable(self::$_URL_PARAM_BYLINE, tubepress_impl_embedded_EmbeddedPlayerUtils::booleanToOneOrZero($showInfo));
     $link->setQueryVariable(self::$_URL_PARAM_TITLE, tubepress_impl_embedded_EmbeddedPlayerUtils::booleanToOneOrZero($showInfo));
     if ($jsApi) {
         $link->setQueryVariable(self::$_URL_PARAM_JS_API, 1);
         $link->setQueryVariable(self::$_URL_PARAM_PLAYER_ID, 'tubepress-video-object-' . mt_rand());
     }
     return $link;
 }