3 namespace Drupal\media\OEmbed;
6 * Defines the interface for the oEmbed URL resolver service.
8 * The URL resolver is responsible for converting oEmbed-compatible media asset
9 * URLs into canonical resource URLs, at which an oEmbed representation of the
10 * asset can be retrieved.
12 interface UrlResolverInterface {
15 * Tries to determine the oEmbed provider for a media asset URL.
18 * The media asset URL.
20 * @return \Drupal\media\OEmbed\Provider
21 * The oEmbed provider for the asset.
23 * @throws \Drupal\media\OEmbed\ResourceException
24 * If the provider cannot be determined.
25 * @throws \Drupal\media\OEmbed\ProviderException
26 * If tne oEmbed provider causes an error.
28 public function getProviderByUrl($url);
31 * Builds the resource URL for a media asset URL.
34 * The media asset URL.
35 * @param int $max_width
36 * (optional) Maximum width of the oEmbed resource, in pixels.
37 * @param int $max_height
38 * (optional) Maximum height of the oEmbed resource, in pixels.
41 * Returns the resource URL corresponding to the given media item URL.
43 public function getResourceUrl($url, $max_width = NULL, $max_height = NULL);