Skip to content

ShareMusicVideo

Parameters

PropertyTypeDefault ValueRequiredDescription
titlestring-YesWebpage title
descriptionstring-YesWebpage description
musicUrlstring-YesAudio link
musicDataUrlstring-YesAudio data link
singerNamestring-YesSinger name
songLyricstring-NoLyrics
albumNamestring-NoAlbum name
musicGenrestring-NoMusic genre
durationnumber-YesSong duration in milliseconds
issueDatelong-NoRelease date as Unix timestamp in seconds
identificationstring-NoMusic identifier; suggested for unique identification of a song; used when returning to the app from the WeChat music player
messageExtstring-NoAdditional information
hdAlbumThumbFilePathstring-NoLocal file path for high-definition album cover
thumbPathstring-YesThumbnail for the music card, must be less than 64KB
scenenumber-YesTarget scene for sharing, 0=share to chat, 1=share to Moments, 2=share to favorites

Example

javascript
window.Wechat.shareMusicVideo({
  		title: '分享音乐视频',
  		description: '这是一个音乐视频',
  		singerName: '张学友',
  		musicUrl: '',
  	  musicDataUrl: '',
  		duration: 120000,
  		thumbPath: 'www/img/logo.png',
      scene: 0, 
  }, function(res){
    console.log("share success");
  }, function(err) {
    console.error(err);
  }
);

Apache 2.0 License.