7 Replies - 3284 Views - Last Post: 18 July 2011 - 03:53 PM

#1 pryogene  Icon User is offline

  • if (Leif.IsAwake) { Leif.Sleep(1/0f); }
  • member icon

Reputation: 35
  • View blog
  • Posts: 653
  • Joined: 30-June 09

Accessing the inaccessable - music

Posted 17 July 2011 - 01:50 PM

Hi all.

Not like me to do a "gimmetehcodez" style-of-post, but hell, I need help.
I'm trying to create an app that will take a users media, allow them to cut it down, chop and change bits etc, and then save the result as a ringtone.

Funny thing is, while I can do all the rest (in theory, I'll need to port my libraries first), I can't work out how to access the media directory in order to list all of the users media.

Don't really have much code to post, as it's all pretty secretive till I get it working to a marketplaceable point.

I've tried isolated storage, but that only gives access to the app's storage. So question is, can anyone shed any light on how I access the media directory. [I'LL LOVINGLY POST ALLLL OF MY CODE IN A TUTORIAL WHEN THIS IS DONE GUYS :D]

{edit} I have done a lot of google'ing and no banana ¬¬
{edit2} Just a load of stuff about playing media. Nothing about actually listing the files. Going to try an XNA based approach in a moment.
{edit3}
        public MainPage()
        {
            InitializeComponent();
            _task = new SaveRingtoneTask();
            _library = new MediaLibrary();
            _collection = _library.Songs;
            foreach (Song s in _collection)
            {
                ListBoxItem i = new ListBoxItem();
                i.Content = s.Name.ToString();
                i.Tap += new EventHandler<GestureEventArgs>(i_Tap);
                ListBoxOne.Items.Add(i);
            }
        }

        void i_Tap(object sender, GestureEventArgs e)
        {
            FrameworkDispatcher.Update();
            if (MediaPlayer.State == MediaState.Stopped)
                MediaPlayer.Play(_collection[ListBoxOne.SelectedIndex]);
            else
            {
                MediaPlayer.Stop();
                MediaPlayer.Play(_collection[ListBoxOne.SelectedIndex]);
            }
            FrameworkDispatcher.Update();

        }

Listing and displaying in XNA, BUT I now can't get the source location, and can't work out a way to convert between XNA Song to a file on the fs.

This post has been edited by pryogene: 17 July 2011 - 02:11 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Accessing the inaccessable - music

#2 Core  Icon User is offline

  • using System.Linq;
  • member icon

Reputation: 773
  • View blog
  • Posts: 5,097
  • Joined: 08-December 08

Re: Accessing the inaccessable - music

Posted 18 July 2011 - 03:33 PM

The simple and the most straightforward response would be - you can't. The OS is built in such a way that you can only access media through the system layer. Licensing issues are the one of the factors - it would be quite unacceptable to let people grab media content they don't own through a third-party application.

There are ways to do this through the direct Zune API but this is not one of the documented methods and will certainly block the application from being approved in the Windows Phone Marketplace.
Was This Post Helpful? 0
  • +
  • -

#3 pryogene  Icon User is offline

  • if (Leif.IsAwake) { Leif.Sleep(1/0f); }
  • member icon

Reputation: 35
  • View blog
  • Posts: 653
  • Joined: 30-June 09

Re: Accessing the inaccessable - music

Posted 18 July 2011 - 03:36 PM

View PostCore, on 18 July 2011 - 04:33 PM, said:

The simple and the most straightforward response would be - you can't. The OS is built in such a way that you can only access media through the system layer. Licensing issues are the one of the factors - it would be quite unacceptable to let people grab media content they don't own through a third-party application.

There are ways to do this through the direct Zune API but this is not one of the documented methods and will certainly block the application from being approved in the Windows Phone Marketplace.


Hmm, okay.

This makes me question why they gave us access to the new ringtones API in the Mango B2 then...

[Edit] This said, I only really need to access the location of the file, i.e being able to read that the file exists at "C:/Media/" style of thing. With that I can provide an input to the SaveRingtoneTask api, that or read the file into my framework, make adjustments, save it to isolated storage, save it again with the SaveRingtoneTask api, and then delete it from isolated storage. Nom.

This post has been edited by pryogene: 18 July 2011 - 03:40 PM

Was This Post Helpful? 0
  • +
  • -

#4 Core  Icon User is offline

  • using System.Linq;
  • member icon

Reputation: 773
  • View blog
  • Posts: 5,097
  • Joined: 08-December 08

Re: Accessing the inaccessable - music

Posted 18 July 2011 - 03:40 PM

Ringtones are a bit of a different component. You are not exactly altering system ringtones but rather loading your own based on the media provided by the application.
Was This Post Helpful? 0
  • +
  • -

#5 pryogene  Icon User is offline

  • if (Leif.IsAwake) { Leif.Sleep(1/0f); }
  • member icon

Reputation: 35
  • View blog
  • Posts: 653
  • Joined: 30-June 09

Re: Accessing the inaccessable - music

Posted 18 July 2011 - 03:42 PM

View PostCore, on 18 July 2011 - 04:40 PM, said:

Ringtones are a bit of a different component. You are not exactly altering system ringtones but rather loading your own based on the media provided by the application.


Creating my own based on the media stored on the phone.
Was This Post Helpful? 0
  • +
  • -

#6 Core  Icon User is offline

  • using System.Linq;
  • member icon

Reputation: 773
  • View blog
  • Posts: 5,097
  • Joined: 08-December 08

Re: Accessing the inaccessable - music

Posted 18 July 2011 - 03:48 PM

Notice the usage limitations - a ringtone that will be used only on your own phone. Also, not really. Through code, you have to use SaveRingtoneTask, which will require a custom URL for media content fetched from your app and not the OS.
Was This Post Helpful? 0
  • +
  • -

#7 pryogene  Icon User is offline

  • if (Leif.IsAwake) { Leif.Sleep(1/0f); }
  • member icon

Reputation: 35
  • View blog
  • Posts: 653
  • Joined: 30-June 09

Re: Accessing the inaccessable - music

Posted 18 July 2011 - 03:52 PM

View PostCore, on 18 July 2011 - 04:48 PM, said:

Notice the usage limitations - a ringtone that will be used only on your own phone. Also, not really. Through code, you have to use SaveRingtoneTask, which will require a custom URL for media content fetched from your app and not the OS.


That's the general intention of my app. Take the specific users media, allow them to shorten it if they wish, then create a ringtone from it - I do know that there's a size limit of 1Mb, but I can counteract that by compressing the audio.

Suppose if it can't be done, it can't be done. *sadface*.
Was This Post Helpful? 0
  • +
  • -

#8 Core  Icon User is offline

  • using System.Linq;
  • member icon

Reputation: 773
  • View blog
  • Posts: 5,097
  • Joined: 08-December 08

Re: Accessing the inaccessable - music

Posted 18 July 2011 - 03:53 PM

Bottom line - not with the user's media. Not at this time, anyway.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1