Render a video player.

@param Garp_Db_Table_Row $video A record from a video table
@param array $options Various rendering options
@return mixed
6840
public function render($video, $options = array()) {
        $helper = $this->_getSpecializedHelper($video);
        return $helper->render($video, $options);
    }
741946
public function storePermanentVideo (Video $video)
    {
        if ($video->getTitle() === null || $video->getDescription() === null) {
            throw new InvalidArgumentException("permanent videos must have a title and description");
        }

        return $this->storeVideo(true, $video);
    }
1018345
public function setVideo(Video $video)
    {
        $this->video= $video;
        $this->setIdVideo($video->getIdVideo());
        return $this;
    }
727638
public function render($options = array())
    {
        $options = array_merge($this->defaultOptions, $options);
        if ($options['size'] === 'small')
            $options['height'] = 15;
        elseif ($options['size'] === 'large')
            $options['height'] = 24;
        else
            $options['height'] = '';

        return $this->view->make('shareable::google_plus', array('options' => $options));
    }
122939
public function render($options = array())
    {
        $options = array_merge($this->defaultOptions, $options);
        return $this->view->make('shareable::twitter', array('options' => $options));
    }
844843
public function render(array $options = array())
    {
        $url = $this->service->generateEmbedUrl($this);
        $options = array_replace(array(
            'width' => 560,
            'height' => 315,
            'frameborder' => 0,
            'allowfullscreen' => ''
        ), $options);

        $html = <<<HTML
<iframe src="$url" width="{$options['width']}" height="{$options['height']}" frameborder="{$options['frameborder']}" {$options['allowfullscreen']}></iframe>
HTML;
        return $html;
    }
627137
public function withVideos(array $videos)
    {
        Assertion::allIsInstanceOf($videos, VideoInterface::class);

        $instance = clone $this;

        $instance->videos = $videos;

        return $instance;
    }
427655
public function video($video)
    {
        $oldSource = $this->source;
        $this->source = $video;

        $parsedURL = parse_url($video);

        // 1 thing, assume video.
        if (count($parsedURL) === 1) {
            $this->type = static::TYPE_VIDEO;
            $this->id = $parsedURL['path'];

            return $this;
        }

        // Youtu.be - Video
        if (strtolower($parsedURL['host']) == 'youtu.be') {
            $this->type = static::TYPE_VIDEO;
            $this->id = substr($parsedURL['path'], 1);

            return $this;
        }

        // Assume its a YouTube URL
        // check for /watch
        if (strtolower($parsedURL['path']) == '/watch') {
            $parsedQuery = explode('&', $parsedURL['query']);
            // Find v=
            foreach ($parsedQuery as $v) {
                if (substr(strtolower($v), 0, 2) == 'v=') {
                    $this->type = static::TYPE_VIDEO;
                    $this->id = substr($v, 2);

                    return $this;
                }
            }
        }

        // check for /v/
        if (substr(strtolower($parsedURL['path']), 0, 3) == '/v/') {
            $this->type = static::TYPE_VIDEO;
            $this->id = substr($parsedURL['path'], 0, 3);

            return $this;
        }

        $this->source = $oldSource;
        throw new AudioPlayerException('Could not identify video');
    }
956115
public function renderValue($data, array $options = []) : string
    {
        $options = array_merge($this->defaultOptions, $this->fixOptions($options));
        $result = $this->getFieldValueFromData($data, $options);

        // Currently needed for blobs from the database, but might be handy later
        // for network data and such.
        // TODO: Add support for encoding (base64, et) via $options
        if (is_resource($result)) {
            $result = stream_get_contents($result);
        }

        $rendererClass = $this->config->getProvider('renderValue');
        if (!empty($options['renderAs'])) {
            $rendererClass = __NAMESPACE__ . '\\Provider\\RenderValue\\' . ucfirst($options['renderAs']) . 'Renderer';
        }

        if (!class_exists($rendererClass)) {
            throw new InvalidArgumentException("Renderer class [$rendererClass] does not exist");
        }

        $rendererClass = new $rendererClass($this->config);
        $result = (string)$rendererClass->provide($result, $options);

        return $result;
    }
1304617
protected function renderPage($page, $options = array()) {
        $this->render(__DIR__ . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . $page . '.php', $options);
    }
887385
public function media(Column\Media $column, array $row)
    {

        $media =  $column->getBindedLink($row);
        $extension = pathinfo($media, PATHINFO_EXTENSION);

        if (empty($extension)) {
            return '';
        }

        if (($pos = strpos($extension, '?')) !== false) {
            $extension = substr($extension, 0, $pos);
        }

        // Fancybox compatible Image
        if (in_array($extension, ['jpg', 'png', 'jpeg', 'gif'])) {
            $html = html('img', ['style' => 'object-fit: cover;', 'width' => $column->getMediaWidth(), 'height' => $column->getMediaHeight(), 'src' => $media]);
            return html('a', ['href' => $media, 'class' => 'fancybox'], $html);
        }elseif(in_array($extension, ['mp4'])) {
            $source  = html('source', ['src' => $media, 'type' => 'video/' . $extension]);
            return html('video', ['style' => sprintf('width:%spx;height:%spx', $column->getMediaWidth(), $column->getMediaHeight()), 'controls' => 'controls'], $source);
        } else {
            dd($extension);
            throw new \Exception('Extension pas trouvé : ' . $media);
        }

        $html = html('a', ['href' => $column->getBindedLink($row)], $column->getBindedLabel($row));

        return $this->post($html, $column, $row);
    }
451779
public function fetch(array $options = null) {
        try {
            $this->_checkAcl('fetch');
        } catch (Garp_Auth_Exception $e) {
            $this->_checkAcl('fetch_own');
        }

        if ($this->_model instanceof Garp_Model_Db) {
            $options = $options instanceof Garp_Util_Configuration
                ? $options
                : new Garp_Util_Configuration($options);
            $options
                ->setDefault('sort', array())
                ->setDefault('start', null)
                ->setDefault('limit', null)
                ->setDefault('fields', null)
                ->setDefault('query', false)
                ->setDefault('group', array())
                ->setDefault('rule', null)
                ->setDefault('bindingModel', null)
                ->setDefault('bidirectional', false)
                ->setDefault('filterForeignKeys', false);
            $options['sort']   = (array)$options['sort'];
            $options['fields'] = (array)$options['fields'];
            $tableName         = $this->_getTableName($this->_model);
            $options           = (array)$options;
            $modelInfo         = $this->_model->info();
            $referenceMap      = $modelInfo['referenceMap'];
            // SELECT
            // ============================================================
            $select = $this->_model->select();
            $select->setIntegrityCheck(false);

            // FILTER WHERES AND JOINS
            // ============================================================
            $related = array();
            if ($options['query'] && !empty($options['query'])) {
                /**
                 * Check for other model names in the conditions.
                 * These are indicated by a dot (".") in the name.
                 * If available, add these models as joins to the Select object.
                 * The format is <related-model-name>.<primary-key> => <value>.
                 */
                foreach ($options['query'] as $column => $value) {
                    if (strpos($column, '.') !== false) {
                        $related[$column] = $value;
                        unset($options['query'][$column]);
                    }
                }
            }

            // FROM
            // ============================================================
            if ($options['fields']) {
                $fields = $options['fields'];
            } elseif (count($related)) {
                // When using a join filter (used for the relationpanel), it's more performant to
                // specify only a model's list fields, otherwise the query can get pretty heavy for
                // tables with 100.000+ records.
                $primary = array_values($this->_model->info(Zend_Db_Table_Abstract::PRIMARY));
                $fields = array_merge($this->_model->getListFields(), $primary);
            } else {
                $fields = Zend_Db_Table_Select::SQL_WILDCARD;
            }
            // If filterForeignKeys is true, filter out the foreign keys
            if ($options['filterForeignKeys']) {
                $fields = $this->_filterForeignKeyColumns($fields, $referenceMap);
            }
            $select->from($tableName, $fields);

            // JOIN
            // ============================================================
            if (count($related)) {
                $this->_addJoinClause(
                    $select,
                    $related,
                    $options['rule'],
                    $options['bindingModel'],
                    $options['bidirectional']
                );
            }

            if (array_get($options, 'joinMultilingualModel')) {
                /**
                 * Note that this join is meant just to provide a table with its extended columns to
                 * allow, for instance, sorting.
                 * If you want to sort by `name`, which is often a multilingual field,
                 * you're gonna need this. MySQL would otherwise complain about unknown columns.
                 * Note that this replicates the behavior of the MySQL joint views.
                 */
                $i18nModel = $this->_model->getObserver('Translatable')
                    ->getI18nModel($this->_model);
                $lang = Garp_I18n::getDefaultLocale();
                $select->join(
                    $i18nModel->getName(),
                    $i18nModel->refmapToOnClause(get_class($this->_model)) . " AND lang = '$lang'",
                    array_map(
                        array_get('name'),
                        array_filter(
                            $this->_model->getFieldConfiguration(), array_get('multilingual')
                        )
                    )
                );
            }

            // WHERE
            // Add WHERE clause if there still remains something after
            // filtering.
            // ============================================================
            if ($options['query']) {
                $select->where($this->_createWhereClause($options['query']));
            }

            // GROUP
            // ============================================================
            $select->group($options['group']);

            // ORDER
            // ============================================================
            // Prefix native columns with the table name (e.g. "id" becomes
            // "Thing.id")
            // Note that we create a mock table object based on the joint view
            // to collect column info.
            // This should be more accurate than reading that info from the table.
            $mockTable = new Zend_Db_Table(
                array(
                Zend_Db_Table_Abstract::NAME => $tableName,
                Zend_Db_Table_Abstract::PRIMARY => $this->_model->info(
                    Zend_Db_Table_Abstract::PRIMARY
                ))
            );
            $nativeColumns = $mockTable->info(Zend_Db_Table_Abstract::COLS);

            $select->order(
                array_map(
                    function ($s) use ($tableName, $nativeColumns) {
                        $nativeColTest = preg_replace('/(ASC|DESC)$/', '', $s);
                        $nativeColTest = trim($nativeColTest);

                        if (in_array($nativeColTest, $nativeColumns) && strpos($s, '.') === false) {
                            $s = $tableName . '.' . $s;
                        }
                        return $s;
                    }, $options['sort']
                )
            );

            // LIMIT
            // ============================================================
            // Do not limit when a COUNT(*) is performed, this skews results.
            $isCountQuery = count($fields) == 1
                && !empty($fields[0])
                && strtolower($fields[0]) == 'count(*)';
            if (!$isCountQuery) {
                $select->limit($options['limit'], $options['start']);
            }
            $results = $this->_model->fetchAll($select)->toArray();
        } else {
            $results = $this->_model->fetchAll();
        }

        foreach ($results as &$result) {
            foreach ($result as $column => $value) {
                if (strpos($column, '.') !== false) {
                    $keyParts = explode('.', $column, 2);
                    $newKey = $keyParts[1];
                    $relModelKey = Garp_Util_String::strReplaceOnce(
                        $this->_model->getNameWithoutNamespace(), '', $keyParts[0]
                    );
                    $result['relationMetadata'][$relModelKey][$newKey] = $value;
                    unset($result[$column]);
                }
            }
        }
        return $results;
    }
630295
public function withVideo($videoPath, $data = [], $endpoint = 'me/videos')
    {
        $this->video = new video($videoPath, $endpoint);

        if (isset($data['title'])) {
            $this->video->setTitle($data['title']);
        }

        if (isset($data['description'])) {
            $this->video->setDescription($data['description']);
        }

        return $this;
    }
1126430
public function youtube($id, array $options = [])
    {
        $options = optionsParser($options, [
            'allowfullscreen' => 'allowfullscreen',
            'height' => 480,
            'ratio' => '16by9',
            'width' => 640,
        ]);

        return self::iframe(sprintf('https://www.youtube.com/embed/%s', $id), $options->toArray());
    }
663337
public function videoSessioncode($options=array()){

        $data = array();
        

        $data = array_merge($data, $options);

        return $this->request($this->videoSessioncodeUrl, $data);
    }
1286913
protected function render_items($videosdata) {

        if (!$videosdata || empty($videosdata->items)) {
            if (!empty($videosdata->error)) {
                debugging('Error fetching data from youtube: ' . $videosdata->error->message, DEBUG_DEVELOPER);
            }
            return '';
        }

        // If we reach that point we already know that the API key is set.
        $service = $this->get_service();

        $text = html_writer::start_tag('ul', array('class' => 'yt-video-entry unlist img-text'));
        foreach ($videosdata->items as $video) {

            // Link to the video included in the playlist if listing a playlist.
            if (!empty($video->snippet->resourceId)) {
                $id = $video->snippet->resourceId->videoId;
                $playlist = '&list=' . $video->snippet->playlistId;
            } else {
                $id = $video->id->videoId;
                $playlist = '';
            }

            $thumbnail = $video->snippet->getThumbnails()->getDefault();
            $url = 'http://www.youtube.com/watch?v=' . $id . $playlist;

            $videodetails = $service->videos->listVideos('id,contentDetails', array('id' => $id));
            if ($videodetails && !empty($videodetails->items)) {

                // We fetch by id so we just use the first one.
                $details = $videodetails->items[0];
                $start = new DateTime('@0');
                $start->add(new DateInterval($details->contentDetails->duration));
                $seconds = $start->format('U');
            }

            $text .= html_writer::start_tag('li');

            $imgattrs = array('class' => 'youtube-thumb', 'src' => $thumbnail->url, 'alt' => $video->snippet->title);
            $thumbhtml = html_writer::empty_tag('img', $imgattrs);
            $link = html_writer::tag('a', $thumbhtml, array('href' => $url));
            $text .= html_writer::tag('div', $link, array('class' => 'clearfix'));

            $text .= html_writer::tag('span', html_writer::tag('a', $video->snippet->title, array('href' => $url)));

            if (!empty($seconds)) {
                $text .= html_writer::tag('div', format_time($seconds));
            }
            $text .= html_writer::end_tag('li');
        }
        $text .= html_writer::end_tag('ul');

        return $text;
    }
184083
public function display($content, $options = [])
    {
        if (!empty($content)) {
            $videoInfo = $this->_cache($content);
            if (!($videoInfo || empty($options['alwaysRender']))) {
                return 'Video does not exist, it may have been removed from youtube';
            }
            return $this->_renderDisplayView($options, $videoInfo);
        } else {
            return '';
        }
    }