Skip to main content
A newer version of this page is available.
All docs
V18.2
Tab

ASPxObjectContainer.ObjectType Property

Gets or sets the object’s type.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v18.2.dll

Declaration

[DefaultValue(ObjectType.Auto)]
public ObjectType ObjectType { get; set; }

Property Value

Type Default Description
ObjectType **Auto**

An ObjectType enumeration value that represents the object’s type.

Available values:

Name Description
Auto

To automatically determine the type of a media object.

Image

An image is used.

Supported formats: GIF, JPEG, PNG, BMP, TIFF, ICO

Flash

A Macromedia Shockwave Flash (SWF) object is used.

Video

A video object is used.

Supported formats: MPE, MPEG, MPG, ASF, ASX, AVI, MP4, WM, WMV, WMX, WVX

Audio

An audio object is used.

Supported formats: MID, MIDI, MP3, MP3, MPEGA, MPGA, M4A, WAV, WAX, WMA

QuickTime

A Quick Time object is used.

Html5Video

An HTML5 video object is used.

Supported formats: MP4

Html5Audio

An HTML5 audio object is used.

Supported formats: MP3

Remarks

To access the container object’s settings use the ASPxObjectContainer.ObjectProperties property.

Example

This demo shows how to display or play back a file in a multimedia format (flash, audio, video) when the file’s filename extension is not specified. In this case, you need to know the file’s MIME type and manually set the ASPxObjectContainer.ObjectType property to a corresponding value (Audio, Video, Flash, or Image).

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;

public class EmbedHttpHandler : IHttpHandler {
    public bool IsReusable {
        get { return false; }
    }

    public void ProcessRequest(HttpContext context) {
        context.Response.Clear();
        context.Response.ContentType = "application/x-shockwave-flash";
        context.Response.BinaryWrite(GetByteFile(context.Server.MapPath("~/Files/FlashClocks.swf")));
        context.Response.End();
    }

    public static byte[] GetByteFile(string filePath) {
        using(Stream fileStream = File.OpenRead(filePath)) {
            byte[] bytes = new byte[fileStream.Length];
            fileStream.Read(bytes, 0, (int)fileStream.Length);
            return bytes;
        }
    }
}
See Also