Class OEmbedService
Implements IOEmbedService for retrieving embeddable HTML markup using the oEmbed protocol.
Inheritance
object
Namespace: Umbraco.Cms.Core.Services
Assembly: Umbraco.Core.dll
Syntax
public class OEmbedService : IOEmbedService
Constructors
View SourceOEmbedService(EmbedProvidersCollection, ILogger<OEmbedService>)
Initializes a new instance of the OEmbedService class.
Declaration
public OEmbedService(EmbedProvidersCollection embedProvidersCollection, ILogger<OEmbedService> logger)
Parameters
| Type | Name | Description |
|---|---|---|
| EmbedProvidersCollection | embedProvidersCollection | |
| ILogger<OEmbedService> | logger |
Methods
View SourceGetMarkupAsync(Uri, int?, int?, CancellationToken)
Asynchronously retrieves the embeddable HTML markup for the specified resource.
Declaration
public Task<Attempt<string, OEmbedOperationStatus>> GetMarkupAsync(Uri url, int? maxWidth, int? maxHeight, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| Uri | url | The URI of the resource to retrieve markup for. Must be a valid, absolute URI. |
| int? | maxWidth | |
| int? | maxHeight | |
| CancellationToken | cancellationToken | A token to monitor for cancellation requests. The operation is canceled if the token is triggered. |
Returns
| Type | Description |
|---|---|
| Task<Attempt<string, OEmbedOperationStatus>> | A task that represents the asynchronous operation. The result contains an Attempt with the HTML markup if successful, or an oEmbed operation status indicating the reason for failure. |
Remarks
The returned markup is suitable for embedding in web pages. The width and height parameters may be ignored by some providers depending on their capabilities.