Exemplo n.º 1
0
 /// <summary>
 ///     Get duration of an MP4 in milliseconds
 /// </summary>
 /// <param name="stream">Stream containing the MP4 file.</param>
 /// <returns>Duration in milliseconds or -1 if duration is unknown.</returns>
 /// <remarks>
 ///     Throws an exception if the file is not .mp4 format.
 /// </remarks>
 public static long GetDuration(Stream stream)
 {
     using (var mp4 = new Mp4VideoUtility(stream))
     {
         return(mp4.GetDuration());
     }
 }
Exemplo n.º 2
0
 /// <summary>
 ///     Get duration of an MP4 file in milliseconds.
 /// </summary>
 /// <param name="filename">Name of the MP4 file.</param>
 /// <returns>Duration in milliseconds or -1 if duration is unknown.</returns>
 /// <remarks>
 ///     Throws an exception if the file is not .mp4 format.
 /// </remarks>
 public static long GetDuration(string filename)
 {
     using (var mp4 = new Mp4VideoUtility(filename))
     {
         return(mp4.GetDuration());
     }
 }