3 namespace Drupal\video_embed_field;
4 use Drupal\Component\Plugin\PluginInspectionInterface;
7 * Providers an interface for embed providers.
9 interface ProviderPluginInterface extends PluginInspectionInterface {
12 * Check if the plugin is applicable to the user input.
14 * @param string $input
15 * User input to check if it's a URL for the given provider.
18 * If the plugin works for the given URL.
20 public static function isApplicable($input);
25 * @param string $image_style
26 * The quality of the thumbnail to render.
27 * @param string $link_url
28 * Where the thumbnail should be linked to.
31 * A renderable array of a thumbnail.
33 public function renderThumbnail($image_style, $link_url);
36 * Get the URL of the remote thumbnail.
38 * This is used to download the remote thumbnail and place it on the local
39 * file system so that it can be rendered with image styles. This is only
40 * called if no existing file is found for the thumbnail and should not be
41 * called unnecessarily, as it might query APIs for video thumbnail
45 * The URL to the remote thumbnail file.
47 public function getRemoteThumbnailUrl();
50 * Get the URL to the local thumbnail.
52 * This method does not gartunee that the file will exist, only that it will
53 * be the location of the thumbnail after the download thumbnail method has
57 * The URI for the local thumbnail.
59 public function getLocalThumbnailUri();
62 * Download the remote thumbnail URL to the local thumbnail URI.
64 public function downloadThumbnail();
69 * @param string $width
70 * The width of the video player.
71 * @param string $height
72 * The height of the video player.
73 * @param bool $autoplay
74 * If the video should autoplay.
77 * A renderable array of the embed code.
79 public function renderEmbedCode($width, $height, $autoplay);
82 * Get the ID of the video from user input.
84 * @param string $input
85 * Input a user would enter into a video field.
88 * The ID in whatever format makes sense for the provider.
90 public static function getIdFromInput($input);
93 * Get the name of the video.
96 * A name to represent the video for the given plugin.
98 public function getName();