src/Service/ConvertUrlVideoService.php
/**
     * Return a reader from the url
     *
     * @param Trick $trick
     * @return array
     */
Return a reader from the url
@param Trick $trick
@return array
Return a reader from the url @param Trick $trick @return array
public function VidProviderUrl2Player(Trick $trick): array
    {
        $arrayVideo = [];
        foreach ($this->videoRepository->findBy(["trick" => $trick]) as $video) {
            $v = $this->VidProviderUrl2VideoID($video->getUrl());
            switch ($v['type']) {
                case 'youtube':
                    $arrayVideo[] = [
                        "iframe" => '<iframe width="' . self::VIDEO_WIDTH . '" height="' . self::VIDEO_HEIGHT . '" src="https://www.youtube.com/embed/' . $v['videoId'] . (self::VIDEO_AUTOPLAY ? '?autoplay=1' : '') . '" frameborder="0" allowfullscreen autoplay="1"></iframe>',
                        "id" => $video->getId()
                    ];
                    break;
                case 'vimeo':
                    $arrayVideo[] = [
                        "iframe" => '<iframe src="https://player.vimeo.com/video/' . $v['videoId'] . (self::VIDEO_AUTOPLAY ? '?autoplay=1' : '') . '" width="' . self::VIDEO_WIDTH . '" height="' . self::VIDEO_HEIGHT . '" frameborder="0"  webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>',
                        "id" => $video->getId()
                    ];
                    break;
                case 'dailymotion':
                    $arrayVideo[] = [
                        "iframe" => '<iframe frameborder="0" width="' . self::VIDEO_WIDTH . '" height="' . self::VIDEO_HEIGHT . '" src="//www.dailymotion.com/embed/video/' . $v['videoId'] . (self::VIDEO_AUTOPLAY ? '?autoplay=1' : '') . '" allowfullscreen></iframe>',
                        "id" => $video->getId()
                    ];
                    break;
                default:
                    $arrayVideo[] = "";
            }
        }
        return $arrayVideo;
    }
public function VidProviderUrl2Player ( Trick $ trick ) : array { $ arrayVideo = [ ] ; foreach ( $ this -> videoRepository -> findBy ( [ " trick " => $ trick ] ) as $ video ) { $ v = $ this -> VidProviderUrl2VideoID ( $ video -> getUrl ( ) ) ; switch ( $ v [ 'type' ] ) { case 'youtube' : $ arrayVideo [ ] = [ " iframe " => '<iframe width="' . self :: VIDEO_WIDTH . '" height="' . self :: VIDEO_HEIGHT . '" src="https://www.youtube.com/embed/' . $ v [ 'videoId' ] . ( self :: VIDEO_AUTOPLAY ? '?autoplay=1' : '' ) . '" frameborder="0" allowfullscreen autoplay="1"></iframe>' , " id " => $ video -> getId ( ) ] ; break ; case 'vimeo' : $ arrayVideo [ ] = [ " iframe " => '<iframe src="https://player.vimeo.com/video/' . $ v [ 'videoId' ] . ( self :: VIDEO_AUTOPLAY ? '?autoplay=1' : '' ) . '" width="' . self :: VIDEO_WIDTH . '" height="' . self :: VIDEO_HEIGHT . '" frameborder="0"  webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>' , " id " => $ video -> getId ( ) ] ; break ; case 'dailymotion' : $ arrayVideo [ ] = [ " iframe " => '<iframe frameborder="0" width="' . self :: VIDEO_WIDTH . '" height="' . self :: VIDEO_HEIGHT . '" src="//www.dailymotion.com/embed/video/' . $ v [ 'videoId' ] . ( self :: VIDEO_AUTOPLAY ? '?autoplay=1' : '' ) . '" allowfullscreen></iframe>' , " id " => $ video -> getId ( ) ] ; break ; default : $ arrayVideo [ ] = " " ; } } return $ arrayVideo ; }
Return a reader from the url
 @param Trick $trick
 @return array
Return a reader from the url @param Trick $trick @return array