3 namespace Drupal\video_embed_field;
6 * Providers an interface for embed providers.
8 interface ProviderPluginInterface {
11 * Check if the plugin is applicable to the user input.
13 * @param string $input
14 * User input to check if it's a URL for the given provider.
17 * If the plugin works for the given URL.
19 public static function isApplicable($input);
24 * @param string $image_style
25 * The quality of the thumbnail to render.
26 * @param string $link_url
27 * Where the thumbnail should be linked to.
30 * A renderable array of a thumbnail.
32 public function renderThumbnail($image_style, $link_url);
35 * Get the URL of the remote thumbnail.
37 * This is used to download the remote thumbnail and place it on the local
38 * file system so that it can be rendered with image styles. This is only
39 * called if no existing file is found for the thumbnail and should not be
40 * called unnecessarily, as it might query APIs for video thumbnail
44 * The URL to the remote thumbnail file.
46 public function getRemoteThumbnailUrl();
49 * Get the URL to the local thumbnail.
51 * This method does not gartunee that the file will exist, only that it will
52 * be the location of the thumbnail after the download thumbnail method has
56 * The URI for the local thumbnail.
58 public function getLocalThumbnailUri();
61 * Download the remote thumbnail URL to the local thumbnail URI.
63 public function downloadThumbnail();
68 * @param string $width
69 * The width of the video player.
70 * @param string $height
71 * The height of the video player.
72 * @param bool $autoplay
73 * If the video should autoplay.
76 * A renderable array of the embed code.
78 public function renderEmbedCode($width, $height, $autoplay);
81 * Get the ID of the video from user input.
83 * @param string $input
84 * Input a user would enter into a video field.
87 * The ID in whatever format makes sense for the provider.
89 public static function getIdFromInput($input);
92 * Get the name of the video.
95 * A name to represent the video for the given plugin.
97 public function getName();