3

I am trying to retrieve the duration of some songs in my project. I integrated getID3 in my app using the phansys bundle - it works fine but for some of my songs I get an error:

Undefined index: playtime_string.

Here is my source code:

        $getID3 = new getID3;
        $ThisFileInfo = $getID3->analyze($this->getFullpath());
        if (isset($ThisFileInfo['playtime_string'])){
           $len= $ThisFileInfo['playtime_string']; 
        }
        else{
            /*
            * Here i wonder what i have to do in this case
            */
        }

I am really stuck now I am in real need of getting the songs duration. In fact I must get this information in my mobile application.
Is there any other way to get mp3s duration in php?

Niels Keurentjes
  • 41,402
  • 9
  • 98
  • 136
Hadj Ali Oussama
  • 784
  • 2
  • 8
  • 29
  • What's this getID3 class? Can you show us the content of `analyze` method? If this is a third party library, you may want to read the documentation. – Touki Feb 04 '14 at 17:26
  • 1
    getID3 is a fairly popular PHP library. I've added a link in Hadj's question. – Ken Williams Apr 29 '14 at 04:28

1 Answers1

1

The problem was caused by the fact that the mp3s were broken.i tried reading them using ffmpeg but it fails and it shows that these mp3s have 0 Ko as size

Hadj Ali Oussama
  • 784
  • 2
  • 8
  • 29