×

Discussion Board

Page 2 of 2 FirstFirst 12
Results 16 to 19 of 19
  1. #16
    Registered User
    Join Date
    Aug 2013
    Posts
    3

    Xaml MediaElement -- WP8

    I am looking to play a Track's Sample URI returned to me from my MusicClient request of the Top song's with no success

    Code:
    // Init the client
    MusicClient client = new MusicClient(clientID);
    
    // Grab the responses async
    var responses = await client.GetTopArtistsAsync();
    
    // Loop thru and build our model for databinding
    foreach (var v in responses)
    {
      ArtistModel model = new ArtistModel();
      model.SampleUri = client.GetTrackSampleUri(v.Id);
    
      // Add them to my view model for my XAML page
      Items.Add(model);			
    }
    Nothing exciting here .. just enumerating the results from the music client's response and storing them in my view model for databinding in a long list selector on a XAML page.

    Now I have on the page created a MediaElement and when they click on one of the databound results returned from the MusicClient I do the following
    Code:
    // Set the source for our media element
    mediaElement.Source = model.SampleUri;
    
    // play the content at said URI location on the internet
    mediaElement.Play();
    The media element returns a error code of 3100 ..

    How else are we supposed to treat these returned URI's? Are they g-zip'd .. is it just a data stream I should be using WebClient to pack into a stream and use XNA's media player to play it? ..

    Any help with this would be greatly appreciated .. thanks

  2. #17
    Nokia Developer Moderator
    Join Date
    Nov 2007
    Posts
    73

    Re: Audition Tracks?

    The URI is to an MP3 file that you can give to a MediaElement - take a look at the AlbumPage in the test app: https://github.com/nokia-entertainme...sicApiTestApp/

    For the media to play, I have this media element in xaml:
    <MediaElement x:Name="Player" AutoPlay="True" />
    ...and this to play:
    internal void PlayClip(string id)
    {
    this.Player.Stop();
    if (this.Player.CurrentState != System.Windows.Media.MediaElementState.Playing)
    {
    this.Player.Source = App.ApiClient.GetTrackSampleUri(id);
    this.Player.Play();
    }
    }
    Regards,
    Steve

  3. #18
    Registered User
    Join Date
    Aug 2013
    Posts
    3

    Re: Audition Tracks?

    Ok a couple more questions here .. One document says to go to https://account.music.nokia.com which gives you a "client id" not an app id. Another document says to go to https://api.developer.nokia.com which gives you an "app id" so which do I go to .. It still seems to allow me to query the nokia music service as I do return songs/ids and the track sample URI for instance "http://api.ent.nokia.com/1.x/us/products/473592/sample/?domain=music&app_id=__AppID From api.developer.nokia.com__" which then I set as my Media Elements Source and fire off the Play to only receive on the Media Elements Failed event a "3100 An error has occurred."

    So I am lost here .. what exactly is a 3100 error?

  4. #19
    Nokia Developer Moderator
    Join Date
    Nov 2007
    Posts
    73

    Re: Audition Tracks?

    OK, you've caught us in mid transition with our app registration, so sorry for the confusion, but fundamentally, app_id == client_id as you've found - if you could let me know where the link to https://api.developer.nokia.com is I can fix that.
    Did you have the AutoPlay="True" set as suggested?
    Steve

Similar Threads

  1. recording tracks of radio N70
    By chemiefreak in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2007-04-10, 21:18
  2. Creating Race Tracks
    By rajatram in forum Mobile Java Games
    Replies: 0
    Last Post: 2006-11-29, 08:27
  3. playing multiple midi tracks
    By bubb13s in forum Symbian Media (Closed)
    Replies: 1
    Last Post: 2005-08-15, 04:40

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •