// extract submitOnDone and preventEarlySubmit settings from $settings $submitOnDone = true; $preventEarlySubmit = true; $settings = explode('|', $settings); foreach ($settings as $setting) { $settingSubmit = removeLabel($setting, 'submitOnDone'); $settingPrevent = removeLabel($setting, 'preventEarlySubmit'); if ($settingSubmit === 'false') { $submitOnDone = false; } if ($settingPrevent === 'false') { $preventEarlySubmit = false; } } // get video ID $videoId = youtubeUrlCleaner($cue, true); // get start and end time from stim file columns if (!isset($startTime) or !is_numeric($startTime)) { $startTime = 0; } if (!isset($endTime) or !is_numeric($endTime)) { $endTime = 'na'; } // set parameters to append to the URL (https://developers.google.com/youtube/player_parameters) $parameters = array('autoplay' => 1, 'modestbranding' => 1, 'controls' => 0, 'rel' => 0, 'showinfo' => 0, 'iv_load_policy' => 3, 'start' => $startTime, 'end' => $endTime); ?> <div class="textcenter"> <div id="player"></div> </div>
<?php /* @TODO JS functions for seek/start/stop to set start and stop times. */ /* @TODO JS not needed for YouTube vids, use ?start=10&end=14 */ /** * Warning! This is a very primitive version of the Video trial type. * We expect to make improvements in the future, but in the mean time, * try using the YouTube trial type instead, and load your videos to * YouTube rather than your server. **/ if (!isLocal($cue)) { // video is not a local file if (false !== strpos($cue, 'youtube') || false !== strpos($cue, 'youtu.be')) { // YouTube URL $vidSource = youtubeUrlCleaner($cue); $parameters = 'autoplay=1&modestbranding=1&controls=0&rel=0&showinfo=0&iv_load_policy=3'; } else { if (strpos($cue, 'vimeo')) { // Vimeo URL $vidSource = vimeoUrlCleaner($cue); $parameters = 'autoplay=1&badge=0&byline=0&portrait=0&title=0'; } else { // Unsupported URL throw new InvalidArgumentException('The given video source is not ' . 'supported. Please use Vimeo, YouTube, or a local file.'); } } $source = $vidSource . '?' . $parameters; } else { // video is a local file $source = "{$_PATH->experiment}/{$cue}"; }