How can I let the user load/play their own songs in XNA? - xna

I made a song player program using XNA 4.0 and I was wondering if there is a way to allow the user to play/load their own songs. I can play songs from a list that I make but I want the user to be able to play their own songs.

Have the user select a file. The song class can be instantiated using the file name:
Song usersSong= Song.FromUri(#"file:///" + openFileDialogue.FileName);
If you want them to have options for more than one song, you will have to manage the playlist yourself. Try getting them to identify a folder, getting all of the file names from that folder, and loading those file names into a list. You can then iterate through the list every time the xna mediaplayer raises the event that a song has finished playing.
With some elbow grease and creativity you can come up with some interesting ways of using a users music.

Related

Azure Media Player - Continue the Playback Where Left Off

I was wondering does Azure Media Player has some Netflix-like continue the playback where left off feature or plugin, do implement into the my MVC app?
you need to record the previous time somewhere(*) and then by setting currentTime after the playing event (after the source is set) you should have what you want.
Correct, you can simply make a plugin or script it up to cache the current position for the user by Video ID into a cloud database. When user logs back in or returns to the video, just request the video-id, user-id combination and check the last known position value. Move the current position of the player ahead if it exists.

Rails best way to record lots of client side events

I want to record a whole lot of Vimeo events, by using their JS API, and AJAX posts. The data will be saved in Postgres via a Rails app. I want to record events like 'play', 'pause', seek', '1% played', '50% played' along with where in the video they are, all in chronological order. This is so that I can then piece together exactly what is happening in each video (e.g. does the user keep rewinding, then the video is not explaining concepts properly, are they skipping to the end - is the video boring them etc.).
I would like the system to be able to scale to handle 5 000 customers, not all obviously watching the videos at once. Will Postgres and Rails be able to handle this barrage of http posts, without bringing the site to a standstill and use no more than a few gigs ram?
Is there an alternative way of saving this data?

MVC music store I can't find any update for the album table to adjust the inventory

I am using the MVC music store example to create a web store but I can't find anywhere in the example some code to substract the article I have chosen in the cart from the Album table. Do you know if this code exist or it was never created ?
Example, I bought 3 disk of ABBA, The table Album should be substract from 3 somewhere which I can't find.
Normally when you create the CART you should check if the inventory of the article is greater than the item count. Also when you are create the checkout you should subtract the article count from the Album table.
Anyone will have an example to share to see this part ?
Thanks
As far as I can tell, there is no Inventory Tracking feature in the Music Store source. This is the source I looked at: https://mvcmusicstore.codeplex.com/
The Album table only stores specs, not inventory counts.
However, Inventory Tracking would be trivial to add. Give it a try.

Core Data entity relationship hierarchy

I would like to setup entities and relationships in core data to handle this situation:
There are teams, and each team can have multiple photos of the team and multiple players on the team...but also each player can have multiple photos. (Sorry, it looks like I need more reputation points before I can post the image of the relationship.)
If this is possible, I'm not sure I know how to set it up properly. In the Photo entity, I believe I can setup the "forPlayer" and "forTeam" relationships to be optional. Doing so would allow me to set one or the other so that a photo is associated with either a Team or a Player.
Will this work?
Now what if I associate a photo with a Player and a Team? If I do that, and if I have cascade delete enabled, will that present any problems if a Team or Player is removed?
I would distinguish between PlayerPhoto and TeamPhoto as separate entities. This is logical also because in the real world these photos would be something quite different. (When modelling entities it is always advisable to try to get as concrete as possible.)
Both PlayerPhoto and TeamPhoto could inherit from a Photo entity that encapsulate the data of photos. Presumably you would have something like a fileName or url attribute that denotes the location of the photo. (Do not store the photos as NSData in the database, as this is only advisable for small images, such as thumbnails.).
If you want to use the same actual photo for both team and player, you could still have two separate entities, even if they refer to the same physical photo in terms of name/url. Cascading should just work as expected while leaving all photo files intact.
As for deleting unneeded photos, you could either account for this when deleting the photo entity, or alternatively have a cleanup method that removes photos not referenced in your object graph.

Is there is any way to directly access files from video gallery?

I want to know is there are any way to doing this (talking about iOS): Choose video from Video gallery, store its 'URI'. And then access this video using this URI directly?
For example, on Android I can pick video, remember its filename, and with file system load it using this filename.
I don't want to store it is in my application cache folder or something else, that will duplicate data on device.
Is there is a way to do such thing on iOS?
Take a look at all of the "Bookmark" methods of NSURL
They give you the ability to find the underlying file, even if it's moved around when your app is closed.
From the docs:
A bookmark provides a persistent reference to a file-system resource. When you resolve a bookmark, you obtain a URL to the resource’s current location. A bookmark’s association with a file-system resource (typically a file or folder) usually continues to work if the user moves or renames the resource, or if the user relaunches your app or restarts the system.

Resources