StreamDuration Property

Summary
Gets the duration of the current stream in the source media file in seconds.
Syntax
C#
C++/CLI
public double StreamDuration { get; } 
public: 
property double StreamDuration { 
   double get(); 
} 

Property Value

A value representing the duration in seconds of the current stream in the source media.

Remarks

This duration time is based on normal playback speed. Changing the playback rate does not affect the duration. This property is updated automatically when the CurrentStream property is set to the current stream. The number of the current stream can be found in the CurrentStream property. To change the current stream, set the CurrentStream property to the new value. Once the current stream has been set, other MediaInfo properties are updated with information about the current stream.

Example
C#
using Leadtools; 
using Leadtools.Multimedia; 
using LeadtoolsMultimediaExamples.Fixtures; 
 
 
public PlayCtrlForm _form = new PlayCtrlForm(); 
public bool _result = false; 
 
public void ResetSourceExample() 
{ 
   // reference the play control 
   PlayCtrl playctrl = _form.PlayCtrl; 
 
   // input file 
   string inFile = Path.Combine(LEAD_VARS.MediaDir, "MediaInfo_Source.avi"); 
   string info = string.Empty; 
 
   try 
   { 
      // create a new media info object 
      MediaInfo mi = new MediaInfo(); 
 
      // set the input and output files 
      mi.SourceFile = inFile; 
 
      // set the info string 
      info = string.Format("Source File={0}\nSource File Size={1}\nSource BitRate={2}\nDuration={3}\nVideoBitRate={4}\nVideoBitCount={5}\n\nAre these values correct?", 
         // AudioBitsPerSample={5}\nAudioChannels={6}\n  
         mi.SourceFile, mi.SourceFileSize, mi.SourceBitRate, mi.SourceDuration, mi.VideoBitRate, mi.VideoBitCount); //, mi.AudioBitsPerSample, mi.AudioChannels); 
 
      // verify the values 
      _result = (MessageBox.Show(_form, info, "Media Info", MessageBoxButtons.YesNo) == DialogResult.Yes); 
 
      // reset the source 
      mi.ResetSource(); 
 
      // set the result to what we expect 
      _result = (mi.SourceFile == null); 
   } 
   catch (Exception) 
   { 
      _result = false; 
   } 
} 
 
static class LEAD_VARS 
{ 
   public const string MediaDir = @"C:\LEADTOOLS22\Media"; 
} 
Requirements

Target Platforms

Help Version 22.0.2022.12.7
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Multimedia Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.