Windows phone 8: how to play background next song? - windows-phone-8

I'm programming an app which is able to play music in background. I'm using mediaplayer and Song(class xnalib), well since is not possible put file into mediaplayer.queue I can't figure out how can play next song in the "playlist".
I'll try to make this scenario more clear with an example:
I play music with mediaplayer: MediaPlayer.Play(MysongArray[CurrentIndex]);
well now user put my app in background.
but when MysongArray[CurrentIndex] song is ended how play next song if my application is in background?
thanks

That's probably because you are playing a Song not a SongCollection - once it's ended it stops playing. Source: MSDN1, MSDN2. I belive (thounght I've not tried it) that you should create SongCollection (if it's possible) or Manage existing one. But this can be a hard job as #ToniPetrina answered here.
As for me I would consider using Background Audio Player and How to play.
Maybe this will help if you decide to use BAP - example how to use playlist.

You cannot do that since background player can only stream or play from isolated storage. You cannot play songs from MediaLibrary.

Related

How can I play multiple sounds at the same time in pygame?

I have the music that is always run in the background and some activities that would play sound when triggered. The music works fine.
pygame.mixer.music.load(os.path.join(SOUND_FOLDER, 'WateryGrave.ogg'))
The problem I have is that when there are 2 or more activities triggering sounds, then only one would be played (not including the background music) and the rest are muted. Is there any solution to this?
you can add sounds to different channels using the mixer:
pygame.mixer.Channel(0).play(pygame.mixer.Sound('sound\gun_fire.wav'))
pygame.mixer.Channel(1).play(pygame.mixer.Sound('sound\enemy_hit.wav'))
Within each channel you can still only play one sound at a time, but you can group sounds into different channels if they would need to play at the same time.
You can add more channels like this:
pygame.mixer.set_num_channels(10) # default is 8
A simple example. For the docs on Channels, go to:
https://www.pygame.org/docs/ref/mixer.html#pygame.mixer.Channel

AS3: Recording sound as they are output/played

I understand how to record microphone input in AS3 from this doc.
Is it possible to record sound exactly as they are being output/played?
The reason is I applied some sound transform (via the global SoundMixer) to sounds that are currently playing; and I also want to record this sound data while it is being played.
I just saw this question, to clarify, I am not trying to record just all sounds on the user's computer (which is not possible). My flash app has a Youtube player in it (via their AS3 API), and it's playing some sounds. I applied transforms using SoundMixer.soundTransform, and I want to record what's being played when the user is playing it.
Thanks in advance.
Just a passing suggestion.. on my desktop it seems ABLE to record sound into Flash from a different tab playing Youtube (HTML5).. I don't know how it's doing that!!
I allow microphone here.. (none actually plugged in, and speaker out has in-ear headphones)
http://code.tutsplus.com/tutorials/create-a-useful-audio-recorder-app-in-actionscript-3--active-5836
PS: Anyone trying this must reduce Windows volume since anything above 10-20% is distorted audio into the Flash app.
And this HTML5 youtube trailer was recorded fine into the Wav file produced by Flash app above
http://www.youtube.com/watch?v=MVt32qoyhi0
So after a quick search it seems my Realtek Audio is classed as a Full-Duplex soundcard and also within its own control panel I have an option called "Multi-streaming" which is enabled/ticked. I think Full-Duplex is enough to do this though. Try options within your soundcard's own settings software. Don't know about your end-users. Some hardware will do it, some wont, there is no all-round solution outside of AIR (which makes desktop apps out of your AS3 code).

Is there a way to play sequence music notes by one next step when clicking a button in AS3?

I'm making an app that can load a midi file or a mml(music macro language) string to play music.
I found that SiON can easily do that. (https://sites.google.com/site/sioncenter/)
My problem is I want to write a feature that User can pause sequence. Then touch a button to play sequence step by step.
Do you have any suggest for me with SiON or whatever as3 framework?
The ipad app "Baby Loves Salsa" do the exactly what I want to do if you want a reference.

interactive video with html5

I am new to actionScript programming. I know some html and I am currently learning html5. I need to do an interactive video by putting html content in a specific time of the video. I'll be more concise:
For example, I have a video that is 5 minutes long, let's suppose that from the second 3:50 to 4:00 I need to display two boxes over the video, each one representing one choice. If at 3:50 the video shows the possibility to the viewer to select among two paths (the video told the user to select among those paths for instance) the viewer will have the possibility to select one of the paths by clicking on one of the two boxes that will appear in that time interval. I know this needs to be made with the tag and with hyperlinks.
My question is How do I tell the html5 video player to display a canvas from the minute 3:50 to the minute 4:00 in which two hyperlinks will display??
Thanks for your attention I will appreciate very much your help. I need some kind of guidance because I have been looking for many days.
For your use case it seems you want to be able to control the video flow of the user through interactions that jump to different times in the video.
Using html5 video player to seek to a different time in a video (using currentTime) you could create a click event on a box that you lay on top of the video and set the time when you click that box, using:
// Jump 30 seconds into the video
var time = '30';
var video = document.createElement('video');
video.src = "video.mp4";
// Set the time
video.currentTime = time;
video.play();
You can check out how we created an interactive video authoring tool(open source) using html5 and JS and use that.
If you don't want to spend time coding an interactive video you should check out H5Ps authoring tool through this simple example. You can test out creating your own at H5P.org as well. The tool is completely free.
I may be wrong, but I believe that you mean javascript instead of actionscript. If that is the case then I would definitely check this out Video.JS.
When you reach the current time you trigger your method/function which adds whatever you want on top of the video.
var whereYouAt = myPlayer.currentTime();
However, if you DO mean actionscript then you are working with a flash player. Therefore I suggest you take a look at this Vimeo Player
currentTime:Number [read-only] Returns the current playback time of the video.

HTML5 video - playing only a portion of a video

Is there some straightforward technique to play only a certain part of a HTML5 video? For example in a 30 second clip I would like to play only the part 5-20 sec. Additionally the rest of the video should not be accessible from the UI at all (meaning the video timeline should only show the 5-20 sec part).
I've been going through some HTML5 video players but none of them seem to be supporting this kind of functionality. If anyone knows a (good) way to implement this feature please give me a hint.
Thanks in advance!
Even though this question has already been marked as answered, here's something that may interest you and anyone else who stumbles across here: Specifying playback range.
It's part of the Media Fragment API and currently works in the latest versions of Firefox, Chrome and Safari 6+.
You can implement it there is a Player.Play() event in a players, whenever Play() called start a timer and call the Player.stop() on the specific time you want.
I got the same problem and I didn't found something that can solves this problem, what you can do is to implement your own controls and display the video with a canvas...
and if you are trying to implement this in IOS you will not be able to do it.
My thought would be to use custom controls, as I don't believe that functionality is available natively. All the functionality of html5 controls (play, pause, start at timestamp, etc.) can be called via javascript. In this case you are going to want to edit the currentTime variable.
So you may want to consider setting up your own slider, where the start of the slider represents your starting point, and the end your ending point. Set the video to not play on page load. Then on page load have a javascript function change the currentTime to your starting point. For stopping you could occasionally query the currentTime. I wouldn't use a timer as delays like slow loading could throw it off.
I am trying to implement a similar video in "Preview Mode". I am utilizing the methods stated above by adding an event listener and then pausing the video at a currentTime()=='x' postition. To prevent user from simply hitting play again, the currentTime listener wont allow playback past the 'x' time in the timeline so each time the user hits play, it is automatically instantly paused again. Furthermore, at time 'x' the video container will become hidden through CSS thus preventing interaction from the user with the video.