S
S
sergey_fs2018-02-03 17:05:32
go
sergey_fs, 2018-02-03 17:05:32

How to get the duration of an MP3 file?

Please tell me in the question there is a task to calculate the duration of an audio file in seconds having only an HHTP link to the file
78.24.219.184/audio/hold.mp3
I found a library but this functionality is not in it Can you suggest options for solving this problem

package main

import (
  "fmt"
  "log"
  "os"

  "github.com/dhowden/tag"
)

var (
  err error
)

func main() {
  fmt.Println("MP3 Analize")
   f, err := openuri.Open("http://78.24.219.184/audio/hold.mp3")
   if err != nil {
   	fmt.Println("Error Reading")
   }
   defer f.Close()

  m, err := tag.ReadFrom(f)
  if err != nil {
    log.Fatal(err)
  }

  fmt.Println(m.Raw())
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question