Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

getId3: Undefined index: playtime_string

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?

like image 919
Hadj Ali Oussama Avatar asked Dec 02 '25 01:12

Hadj Ali Oussama


1 Answers

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

like image 98
Hadj Ali Oussama Avatar answered Dec 03 '25 15:12

Hadj Ali Oussama



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!