我試圖添加到Xamarin.iOS中的AVQueuePlayer採訪列表,這對我來說。然而,我需要能夠得到一些性質關閉I類用於創建AVPlayerItems屬性與AVQueuePlayer
我的訪談類:
public class Interview
{
public int Id { get; set; }
public Topic Topic { get; set; }
public Person Person { get; set; }
public string VideoURL { get; set; }
public int AudioID { get; set; }
public Interview()
{
}
public Interview (int id, Topic t, Person p, string videoUrl, int audioId)
{
Id = id;
Topic = t;
Person = p;
VideoURL = videoUrl;
AudioID = audioId;
}
我在PlayerClass的方法,看起來像這樣:
void AudioPlayWithAVQueuePlayer()
{
Console.WriteLine ("AVPlayer");
var center = NSNotificationCenter.DefaultCenter;
//int pointer = 0;
List<AVPlayerItem> playeritems = new List<AVPlayerItem>();
foreach (Interview i in appDelegate.currentlyPlaying.Interviews) {
AVAsset _asset;
AVPlayerItem _playerItem;
_asset = AVAsset.FromUrl (new NSUrl ("https://api.soundcloud.com/tracks/" + i.AudioID + "/stream?client_id=clientID&oauth_token=token"));
_playerItem = new AVPlayerItem (_asset);
playeritems.Add (_playerItem);
}
appDelegate.avPlayer = new AVQueuePlayer (playeritems.ToArray());
appDelegate.avPlayer.Play();
}
}
這將播放我的音頻文件(存儲在SoundCloud上),但我需要使用Interview.Person.PersonName和Interview.Topic.TopicName更新一些標籤。在Interview中從AudioID創建AVPlayerItem後,有什麼方法可以訪問這些屬性? 我唯一能找到的是MetaData,但我的音頻文件不包含任何元數據。
很酷。具有很大的意義,而且很容易做到。非常感謝。 – catu