Video.Width Property (Search)

Returns the width of the video file.

public int Width { get; set; }
Remarks

The Width property contains an integer value representing the width, in pixels, of the video file, if this information is available from the Live Search Engine.

noteNote
Access to Video and Inline Answers is reserved for users having an explicit contract with Microsoft. For more information, please contact api_tou@microsoft.com.

Example

This example requests All fields and the Video field from the VideoSourceType. The example displays the name of the video file in the Title field; the URL to the page from which the video was indexed; the name of the source of the video in the Source Title field; the length, file format, width and height of the video file; the size of the video file in the File Size field; the Play URL to the URI of the original video. The code that displays the value of the Width is highlighted in bold in the example.

try
{
    MSNSearchService s = new MSNSearchService();
    SearchRequest searchRequest = new SearchRequest();
    int arraySize = 1;
    SourceRequest[] sr = new SourceRequest[arraySize];

    sr[0] = new SourceRequest();
    sr[0].Source = SourceType.Video;
    sr[0].ResultFields = ResultFieldMask.All | ResultFieldMask.Video;
    sr[0].Count = 5;

    searchRequest.Query = "trees";
    searchRequest.Requests = sr;
    // Enter the Application ID, in double quotation marks, supplied by the 
    // Developer Provisioning System, as the value of the AppID on the SearchRequest.
    searchRequest.AppID = "YOUR_APP_ID_GOES_HERE";
    searchRequest.CultureInfo = "en-US";
    SearchResponse searchResponse;

    searchResponse = s.Search(searchRequest);

    foreach (SourceResponse sourceResponse in searchResponse.Responses)
    {
        Result[] sourceResults = sourceResponse.Results;
        if (sourceResponse.Total > 0)
        {
            Console.WriteLine(sourceResponse.Source.ToString() + " - Total Results: " + sourceResponse.Total.ToString());
            Console.WriteLine();
        }
        foreach (Result sourceResult in sourceResults)
        {
            if ((sourceResult.Title != null) && (sourceResult.Title != String.Empty))
                Console.WriteLine("Title: " + sourceResult.Title);
            if ((sourceResult.Url != null) && (sourceResult.Url != String.Empty))
                Console.WriteLine("URL: " + sourceResult.Url);
                
            if (sourceResult.Video != null)
            {
                Console.WriteLine("Source Title: " + sourceResult.Video.SourceTitle.ToString());
                Console.WriteLine("Length: " + sourceResult.Video.RunTime.ToString());
                Console.WriteLine("Format: " + sourceResult.Video.Format.ToString());
                Console.WriteLine("Width: " + sourceResult.Video.Width.ToString());Console.WriteLine("Height: " + sourceResult.Video.Height.ToString());Console.WriteLine("File size: " + sourceResult.Video.FileSize.ToString());
                Console.WriteLine("Play URL: " + sourceResult.Video.PlayUrl.ToString());
                            Console.WriteLine("*****************************************************");
            }

        }
    }
    Console.WriteLine("Press any key to exit.");
    Console.ReadLine();
}
catch (System.Web.Services.Protocols.SoapException fault)
{
    Console.WriteLine(fault.Detail.InnerText.ToString());
}
catch (System.Net.WebException webx)
{
    Console.WriteLine(webx.ToString());
}

The following sample output shows results of this query. Note that, if you run the same query, your output is likely to be different due to the fact that you ran your query at a later time.

Video - Total Results: 37445

Title: Christmas trees damaged

URL: http://www.cnn.com/video/#/video/us/2007/11/16/kain.ct.christmas.trees.damaged.wfsb

Source Title: CNN

Length: 94928

Format: flv

Width: 576

Height: 336

File Size: 7295405

Play URL: http://www.cnn.com/video/#/video/us/2007/11/16/kain.ct.christmas.trees.damaged.wfsb00

*****************************************************

Title: Kicking Trees

URL: http://www.youtube.com/watch?v=4VilgP2UtsI

Source Title: YouTube

Length: 62000

Format: flv

Width: 320

Height: 240

File Size: 2531137

Play URL: http://www.youtube.com/watch?v=4VilgP2UtsI350425

*****************************************************

Title: Xmas Trees Ringing Up Profits

URL: http://video.msn.com/v/us/v.htm?g=b02d69e8-8caa-4ff4-a677-077aea6fdc8d

Source Title: MSN Video

Length: 79633

Format: wmv

Width: 320

Height: 240

File Size: 4952798

Play URL: http://video.msn.com/v/us/v.htm?g=b02d69e8-8caa-4ff4-a677-077aea6fdc8d00

*****************************************************

Press any key to exit.

Page view tracker