@param Video $video

@return Uploaded\Video
547420
private function storeVideo ($isPermanent, Video $video)
    {
        $endpoint = 'https://api.weixin.qq.com/cgi-bin/media/upload';
        if ($isPermanent) {
            $endpoint = 'https://api.weixin.qq.com/cgi-bin/material/add_material';
        }

        $json = $this->doMultipartUpload(
            $endpoint,
            MediaType::VIDEO,
            $this->createReadableStream($video->getPath()),
            [
                [
                    'name'     => 'description',
                    'contents' => json_encode([
                        'title'        => $video->getTitle(),
                        'introduction' => $video->getDescription(),
                    ]),
                ],
            ]
        );

        return new Uploaded\Video($json->media_id);
    }
432203
public function videosTop($options = [])
    {
        $availableOptions = ['limit', 'offset', 'game', 'period'];

        $query = [];

        //  Filter the available options
        foreach ($availableOptions as $option) {

            if (isset($options[ $option ])) {

                $query[ $option ] = $options[ $option ];
            }
        }

        $parameters = $this->getDefaultHeaders();
        $parameters[ 'query' ] = $query;

        $response = $this->client->get('/kraken/videos/top', $parameters);

        return $response->json();
    }
50830
public function getVideoInfo($url)
    {
        if (!empty($url)) {
            if (strpos($url, 'youtube')) {
                preg_match('/(?<=v(\=|\/))([-a-zA-Z0-9_]+)|(?<=youtu\.be\/)([-a-zA-Z0-9_]+)/', $url, $v);
                $provider = 'youtube';
                $url_data = sprintf($this->_youtubeVideoApi, $v[0]);
            } elseif (strpos($url, 'vimeo')) {
                preg_match('(\d+)', $url, $id);
                $provider = 'vimeo';
                $url_data = sprintf($this->_vimeoVideoApi, $id[0]);
            }

            switch ($provider) {
                case 'youtube':
                    $ch = curl_init($url_data);  
                    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
                    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/json')); 
                    $result = json_decode(curl_exec($ch), true);
                    curl_close($ch);

                    return array(
                        'title'       => $result['entry']['title']['$t'],
                        'description' => $result['entry']['media$group']['media$description']['$t'],
                        'thumbnail'   => $result['entry']['media$group']['media$thumbnail'][0]['url'],
                        'duration'    => $result['entry']['media$group']['media$content'][0]['duration'],
                        'upload_date' => $result['entry']['media$group']['yt$uploaded']['$t'],
                    );
                    break;

                case 'vimeo':
                    $ch = curl_init($url_data);  
                    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
                    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/json')); 
                    $result = json_decode(curl_exec($ch), true);
                    curl_close($ch);

                    return array(
                        'title'       => $result[0]['title'],
                        'description' => $result[0]['description'],
                        'thumbnail'   => $result[0]['thumbnail_small'],
                        'duration'    => $result[0]['duration'],
                        'upload_date' => $result[0]['upload_date']
                    );
                    break;
                
                default:
                    return false;
                    break;
            }
        }
        return false;
    }
1215129
public function getVideo(string $videoId): Video
	{
		return $this->parseData($this->getData($videoId), $videoId);
	}
1238123
public function build()
    {
        $video = [
            'originalContentUrl' => $this->originalContentUrl,
            'previewImageUrl' => $this->previewImageUrl,
            'area' => $this->areaBuilder->build()
        ];
        if ($this->externalLinkBuilder) {
            $video['externalLink'] = $this->externalLinkBuilder->build();
        }
        return $video;
    }
464132
protected function matchVideo()
    {
        return ReplyRuleKeyword::find()
            ->andFilterWhere(['type' => [ReplyRuleKeyword::TYPE_VIDEO, ReplyRuleKeyword::TYPE_SHORT_VIDEO]])
            ->wechatRule($this->getWechat()->id)
            ->limitTime(TIMESTAMP)
            ->all();
    }
1017218
private function getVideo($videoId)
    {
        if (!array_key_exists($videoId, $this->videos)) {
            $options = new VideoRequestParameters();
            $options->setIncludeCustomMetadata(true);
            $this->videos[$videoId] = $this->client->getVideo($this->vmId, $videoId, $options);
        }

        return $this->videos[$videoId];
    }
483053
public function find($videoKey) {
        if(is_null($videoKey) || empty($videoKey)) {
            throw new VideoClientException("A key is needed to fnd a video");
        }

        try {
            // Request the video from the SafeStream REST API
            $videos = $this->get(sprintf("%s?key=%s", $this->apiResourcePath, $videoKey));

            return $videos[0];
        } catch (SafeStreamHttpException $e) {
            throw new VideoClientException($e);
        }
    }
1021889
public function prepareMedia(Media $media)
    {
        if (null == $media->getUuid()) {
            $uuid = uniqid();
            $media->setUuid($uuid);
        }
        $video = new RemoteVideoHelper($media);
        $url = $video->getCode();
        //update thumbnail
        switch ($video->getType()) {
            case 'youtube':
                $code = $this->isolateYoutubeVideoCode($url);
                $video->setThumbnailUrl('http://img.youtube.com/vi/'.$code.'/0.jpg');
                break;
            case 'vimeo':
                $code = $this->isolateVimeoVideoCode($url);
                $xml = simplexml_load_file('http://vimeo.com/api/v2/video/'.$code.'.xml');
                $video->setThumbnailUrl((string) $xml->video->thumbnail_large);
                break;
            case 'dailymotion':
                $code = $this->isolateDailymotionVideoCode($url);
                $json = json_decode(file_get_contents('https://api.dailymotion.com/video/'.$code.'?fields=thumbnail_large_url'));
                $thumbnailUrl = $json->{'thumbnail_large_url'};
                /* dirty hack to fix urls for imagine */
                if (!$this->endsWith($thumbnailUrl, '.jpg') && !$this->endsWith($thumbnailUrl, '.png')) {
                    $thumbnailUrl = $thumbnailUrl.'&ext=.jpg';
                }
                $video->setThumbnailUrl($thumbnailUrl);
                break;
        }
    }
660390
public function videoToHtml()
    {
        if (in_array($this->provider, $this->providers)) {
            $caption = '';
            if (!empty($this->caption)) {
                $caption = $this->parser->toHtml($this->caption);
            }

            // View
            return $this->view(
                'video.'.$this->provider,
                [
                    'remote' => $this->remoteId,
                    'caption' => $caption,
                ],
                $this->provider
            );
        }

        return '';
    }
257335
private function ffprobeHasVideo()
	{
		if (isset($this->metadata['streams']))
		{
			foreach ($this->metadata['streams'] as $streamIndex => $stream)
			{
				if (isset($stream['codec_type']) && $stream['codec_type'] === "video" && $stream['disposition']['attached_pic'] !== 1)
				{
					return $streamIndex;
				}
			}
		}

		return false;
	}
305615
public function renderVideo(MediaInterface $video, array $params = [])
    {
        if ($video->getType() !== MediaTypes::VIDEO) {
            throw new \InvalidArgumentException('Expected media with "video" type.');
        }

        $params = array_merge([
            'responsive'   => false,
            'aspect_ratio' => '16by9',
            'attr'         => [
                'id'     => 'media-video-' . $video->getId(),
                'class'  => 'video-js vjs-default-skin vjs-big-play-centered',
                'height' => '100%',
                'width'  => '100%',
            ],
        ], $params);

        return $this->elementTemplate->renderBlock('video', [
            'responsive'   => $params['responsive'],
            'aspect_ratio' => $params['aspect_ratio'],
            'src'          => $this->getDownloadUrl($video),
            'mime_type'    => $this->getMimeType($video),
            'attr'         => $params['attr'],
        ]);
    }
1372899
public function fetchTemporaryVideo ($mediaID, $into = null)
    {
        return new Downloaded\Video($mediaID, $this->doTemporaryFetchToStream($mediaID, $into));
    }
1021157
public function isYoutube($video) {
        $playerurl = (is_string($video) ? $video :
            (isset($video['player']) ? $video['player'] : ''));
        return preg_match('~youtube\.com~i', $playerurl);
    }
1050202
public static function getVideoList() {
        if (self::$_video) {
            return self::$_video;
        }

        self::$_video = self::_getList('video');

        return self::$_video;
    }
663337
public function videoSessioncode($options=array()){

        $data = array();
        

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

        return $this->request($this->videoSessioncodeUrl, $data);
    }
274255
protected function getVideoIdFromUrl($videoUrl)
	{
		$videoId = $videoUrl;
		$urlPart = parse_url($videoUrl);
		$path = $urlPart['path'];
		if (isset($urlPart['host']) && strtolower($urlPart['host']) == 'youtu.be') {
			if (preg_match('/\/([^\/\?]*)/i', $path, $temp))
				$videoId = $temp[1];
		} else {
			if (preg_match('/\/embed\/([^\/\?]*)/i', $path, $temp))
				$videoId = $temp[1];
			elseif (preg_match('/\/v\/([^\/\?]*)/i', $path, $temp))
				$videoId = $temp[1];
			elseif (preg_match('/\/watch/i', $path, $temp) && isset($urlPart['query']))
			{
				$query = $this->decodeString($urlPart['query']);
				$videoId = $query['v'];
			}
		}

		return $videoId;
	}