Interface IOEmbedService
Defines a service for asynchronously retrieving embeddable HTML markup for a specified resource using the oEmbed protocol.
Namespace: Umbraco.Cms.Core.Services
Assembly: Umbraco.Core.dll
Syntax
public interface IOEmbedService
Methods
View SourceGetMarkupAsync(Uri, int?, int?, CancellationToken)
Asynchronously retrieves the embeddable HTML markup for the specified resource.
Declaration
Task<Attempt<string, OEmbedOperationStatus>> GetMarkupAsync(Uri url, int? width, int? height, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| Uri | url | The URI of the resource to retrieve markup for. Must be a valid, absolute URI. |
| int? | width | The optional maximum width, in pixels, for the embedded content. If null, the default width is used. |
| int? | height | The optional maximum height, in pixels, for the embedded content. If null, the default height is used. |
| 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.