How to get and set (change) ID3 tag (metadata) of audio files?

后端 未结 4 911
轻奢々
轻奢々 2020-12-04 13:57

I am working to change ID3 tags, the metadata in audio files, such as:

  • Artist
  • Title
  • Album
  • etc.

And the core point,

4条回答
  •  自闭症患者
    2020-12-04 14:22

    Actually, FasteKerinns's code is quite good. You should just change

    new MyID3().write(src, dst, src_set, meta);

    to

    new MyID3().update(src, src_set, meta);

    which means you don't need dst variable at all.

    Additionaly, I have this piece of code which refreshes song that is modified in MediaStore:

     scanner=new MediaScannerConnection(getApplicationContext(),  
                new MediaScannerConnectionClient() {    
    
          public void onScanCompleted(String path, Uri uri) {
                  scanner.disconnect(); 
          }
    
          public void onMediaScannerConnected() {
                  scanner.scanFile(path, "audio/*");    
          }
      });
    
      scanner.connect();
    

提交回复
热议问题