Class MediaShape
Represents an embedded audio or video object on a slide.
Implements
Inherited Members
Namespace: DRIT.Presentation.Drawing
Assembly: DRIT.Presentation.dll
Syntax
public class MediaShape : AbstractShape, IDrawingObject
Properties
Bookmarks
Gets media bookmark offsets in milliseconds.
Declaration
public IList<int> Bookmarks { get; }
Property Value
| Type | Description |
|---|---|
| IList<int> |
Captions
Gets the collection of caption/subtitle tracks for this media shape.
Use Add(Stream, string) to add
a caption track with a label and data stream. Maps to p:subTitles.
Declaration
public CaptionCollection Captions { get; }
Property Value
| Type | Description |
|---|---|
| CaptionCollection |
FadeInMilliseconds
Gets or sets fade-in duration in milliseconds.
Declaration
public int? FadeInMilliseconds { get; set; }
Property Value
| Type | Description |
|---|---|
| int? |
FadeOutMilliseconds
Gets or sets fade-out duration in milliseconds.
Declaration
public int? FadeOutMilliseconds { get; set; }
Property Value
| Type | Description |
|---|---|
| int? |
HasExternalSource
Indicates whether media content is linked via an external source URI.
Declaration
public bool HasExternalSource { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Kind
Gets or sets whether this shape holds audio or video content.
Declaration
public MediaKind Kind { get; set; }
Property Value
| Type | Description |
|---|---|
| MediaKind |
Loop
Gets or sets whether playback loops continuously.
Declaration
public bool Loop { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Rewind
Gets or sets whether playback rewinds to the beginning after finishing.
Declaration
public bool Rewind { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
TrimEndMilliseconds
Gets or sets the trim end offset in milliseconds.
Declaration
public int? TrimEndMilliseconds { get; set; }
Property Value
| Type | Description |
|---|---|
| int? |
TrimStartMilliseconds
Gets or sets the trim start offset in milliseconds.
Declaration
public int? TrimStartMilliseconds { get; set; }
Property Value
| Type | Description |
|---|---|
| int? |
Methods
GetBytes()
Returns the embedded media bytes, or null if none have been set.
Declaration
public byte[] GetBytes()
Returns
| Type | Description |
|---|---|
| byte[] |
GetPreviewBytes()
Returns the preview image bytes, or null if none have been set.
Declaration
public byte[] GetPreviewBytes()
Returns
| Type | Description |
|---|---|
| byte[] |
GetSourceUri()
Returns the external source URI when media is linked (not embedded), otherwise null.
Declaration
public string GetSourceUri()
Returns
| Type | Description |
|---|---|
| string |
SetContent(byte[], string)
Embeds the media content from the supplied byte array.
Declaration
public void SetContent(byte[] bytes, string extension)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | bytes | Raw audio or video bytes. |
| string | extension | File extension including leading dot (e.g. ".mp3", ".mp4"). |
SetContentFromUri(string)
Sets an external web URI source for this media without embedding binary media bytes.
Declaration
public void SetContentFromUri(string sourceUri)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sourceUri | Absolute HTTP/HTTPS URI to the media resource. |
SetPreviewImage(byte[], string)
Sets the thumbnail/poster frame shown before the media plays.
Declaration
public void SetPreviewImage(byte[] bytes, string extension)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | bytes | Image bytes (PNG or JPEG recommended). |
| string | extension | File extension including leading dot (e.g. ".png", ".jpg"). |