Issue
I have implemented Sharing music features on WeChat.
Sharing on iOS works good. But when sharing on Android, the edge of the background are white and pixelated. I'm thinking is it caused by the low pixel of images? I’m looking for a solutions to get rid of those pixelated edges.
Code for Android:
WXMusicObject musicObj = new WXMusicObject();
musicObj.MusicUrl = link; // URL to open when the song is clicked
musicObj.MusicDataUrl = userAudioURL; // URL of actual music data
WXMediaMessage msg = new WXMediaMessage();
msg.mediaObject = musicObj;
int imgId = (int)typeof(Resource.Drawable).GetField("icon").GetValue(null);
Bitmap thumbBitmap = BitmapFactory.DecodeResource(Forms.Context.Resources, imgId);
Bitmap thBitmap = Bitmap.CreateScaledBitmap(thumbBitmap, 150, 150, true);
thumbBitmap.Recycle();
using (System.IO.MemoryStream outStream = new System.IO.MemoryStream())
{
thBitmap.Compress(Bitmap.CompressFormat.Png, 150, outStream);
msg.ThumbData = outStream.ToArray();
}
SendMessageToWX.Req req = new SendMessageToWX.Req();
req.Transaction = buildTransaction("music");
req.Message = msg;
req.Scene = SendMessageToWX.Req.WXSceneSession; //chat
mWxApi.SendReq(req);
Solution
Finally found out the root cause. For sharing music on WeChat, background will set to thumbnail images.
I solved this with using a higher pixel images, so background image wouldn't stretched and can displayed without pixelation.
Answered By - Wei Loon Wong
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.