0
wp7의 BackgroundAudioAgent에서 노래를 재생할 때 음악 및 비디오에서 이미지를 설정하려고합니다!WP의 BackgroundAudioAgent에서 음악 및 비디오 이미지
곡의 이미지를 다운로드하려면 코드는 다음과 같습니다
AudioTrack audiotrack1 = new AudioTrack(new Uri(file_i + ".mp3", UriKind.Relative), name_i, album_name, string.Empty, new Uri(file_in + ".jpg", UriKind.Relative), byte_i, EnabledPlayerControls.All);
노래 :
는WebClient client = new WebClient();
client.CancelAsync();
client.Headers[HttpRequestHeader.UserAgent] = "Mozilla/4.0 (Compatible; Windows NT 5.1; MSIE 6.0)" + " (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)";
client.Headers[HttpRequestHeader.Referer] = constant.referer;
client.Headers[HttpRequestHeader.CacheControl] = "no-cache";
client.Headers[HttpRequestHeader.Pragma] = "no-cache";
client.OpenReadAsync(new Uri(constant.viewit3_start + file_in + constant.viewit3_stop));
//Stream Completed
client.OpenReadCompleted += (s, ex) =>
{
if (ex.Error == null)
{
try
{
//Get mp3 stream data
long file_bytes = ex.Result.Length;
//Check clever rules
if (file_bytes >= constant.bit)
{
//Isolated file
using (IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication())
{
using (IsolatedStorageFileStream fileStream = new IsolatedStorageFileStream(file_in + ".jpg", FileMode.Create, myIsolatedStorage))
{
try
{
using (BinaryWriter writer = new BinaryWriter(fileStream))
{
int readCount = 0;
byte[] buffer = new byte[32];
using (BinaryReader reader = new BinaryReader(ex.Result))
{
//Read file in chunks in order to reduce memory consumption and increase performance
while (readCount < file_bytes)
{
int actual = reader.Read(buffer, 0, buffer.Length);
readCount += actual;
writer.Write(buffer, 0, actual);
}
}
}
}
catch { if (show) { MessageBox.Show(constant.tile_again); } callback(false); }
}
}
callback(true);
}
else { callback(false); }
}
catch { callback(false); }
}
};
나는 내 기능 작동 및 다운로드 이미지 다음 내가 AudioTrack 클래스의 AlbumArt로 설정하려면이 코드를 사용하여 생각 재생 및 제목 이름과 앨범 이름을 보여 주지만 음악과 비디오에 이미지가없는 이유는 무엇입니까? 공유 미디어가 분리되어있는 상황이 생겼을 가능성이 있습니까?
좋아, 내 함수가 이미지를 다운로드하고, 스트림으로로드하면 지금 검사 해 보겠습니다. xaml 요소에 비트 맵 이미지로 이미지를 설정할 수 있지만 BackgroundAudioAgent에서는 어떻게 표시합니까? –