Vine.php in Video 8        
                          
                  
                        
  
  
  
  
File
  src/Plugin/video/Provider/Vine.php
  
    View source  
  <?php
namespace Drupal\video\Plugin\video\Provider;
use Drupal\video\ProviderPluginBase;
class Vine extends ProviderPluginBase {
  
  public function renderEmbedCode($settings) {
    $file = $this
      ->getVideoFile();
    $data = $this
      ->getVideoMetadata();
    return [
      '#type' => 'html_tag',
      '#tag' => 'iframe',
      '#attributes' => [
        'width' => $settings['width'],
        'height' => $settings['height'],
        'frameborder' => '0',
        'allowfullscreen' => 'allowfullscreen',
        'src' => sprintf('https://vine.co/v/%s/embed/simple?autoPlay=%d', $data['id'], $settings['autoplay']),
      ],
    ];
  }
  
  public function getRemoteThumbnailUrl() {
    $data = $this
      ->getVideoMetadata();
    $id = $data['id'];
    $vine = file_get_contents("http://vine.co/v/{$id}");
    preg_match('/property="og:image" content="(.*?)"/', $vine, $matches);
    return $matches[1] ? $matches[1] : false;
  }
}
 
Classes
        
  
  
      
      
         
      
                  
            Name            | 
                  
            Description           | 
              
    
    
          
                  | 
            Vine           | 
                  
            Plugin annotation
@VideoEmbeddableProvider(
  id = "vine",
  label = @Translation("Vine"),
  description = @Translation("Vine Video Provider"),
  regular_expressions = {
    "@(?<=vine.co/v/)(?<id>[0-9A-Za-z]+)@i",
  },
  mimetype =…           |