Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User EngDev's Avatar
    Join Date
    Aug 2012
    Posts
    1
    I want to get the duration time (length) of the song in wp7 by c#

  2. #2
    Nokia Developer Moderator wizard_hu_'s Avatar
    Join Date
    Feb 2006
    Location
    Mallorca, Holiday
    Posts
    27,683
    Have you tried MediaElement.NaturalDuration? Based on the docs I would assume that it will be available after the MediaOpened event.

  3. #3
    Nokia Developer Moderator joaocardoso's Avatar
    Join Date
    Feb 2011
    Location
    Portugal
    Posts
    510
    Quote Originally Posted by wizard_hu_ View Post
    Have you tried MediaElement.NaturalDuration? Based on the docs I would assume that it will be available after the MediaOpened event.
    And you are correct. In fact you should not try to get it until you have that event raised. Unfortunally these is no way, afaik, to get the length of a song until its opened. The you can do something like:
    using c#
    double songLength = mySoundObject.NaturalDuration.TimeSpan.Seconds;

    using vb.net
    dim songLength as Double = mySoundObject.NaturalDuration.TimeSpan.Seconds
    Cheers

    João Cardoso

  4. #4
    Nokia Developer Champion amlimonet's Avatar
    Join Date
    May 2012
    Posts
    23
    Have you check if mp3 duration is included on TAG information?

Similar Threads

  1. SMS Max Length
    By computerxt in forum Symbian C++
    Replies: 4
    Last Post: 2010-03-16, 05:50
  2. Replies: 3
    Last Post: 2009-09-16, 16:08
  3. How to calculate audio data's length in seconds
    By eekisa in forum Symbian User Interface
    Replies: 1
    Last Post: 2004-05-14, 02:29
  4. URL Length....?
    By Nokia_Archive in forum Mobile Web Site Development
    Replies: 1
    Last Post: 2002-05-17, 15:07
  5. Replies: 0
    Last Post: 1970-01-01, 02:00

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved