w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Detect when song stops playing
When you receive the notification you can look up the playbackState property of the MPMusicPlayerController. As for executing a function 10 seconds before the song ends, you could set up a timer to execute in the future based on the length of the song minus 10 seconds, you would need to cancel that timer if the user changes the playbackState or selects a different song.

Categories : Iphone

video playing in portrait only if I click on full screen tab its stops playing (Xcode 4.6) ios6.1
I know this is a very old post to answer. But i thought it might be helpfull to other. As myself reach to this question while searching the same answer. Instead of just putting [videoPlayer stop]; in viewWillDissappear method, put below code if (!videoPlayer.fullscreen) { [videoPlayer stop]; }

Categories : Iphone

playing a song on another device using bluetooth
GameKit is meant for inter-device games. For this, you'd probably want to look at CBPeripheralManager or CBCentralManager depending on the device you're interacting with. It's lower level, so you'll have to do more work to set up the connection, but there's tons of tutorials and sample code to help you out.

Categories : Iphone

Playing song using service class
public ArrayList<HashMap<String, String>> getPlayList4(Context resolver){ Cursor cursor = resolver.getContentResolver().query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, new String [] {"ARTIST", "DURATION", "TITLE", "_DATA", "ALBUM"}, null, null, null); while(cursor.moveToNext()) { HashMap<String, String> song = new HashMap<String, String>(); song.put("artist", cursor.getString(0)); song.put("duration", cursor.getString(1)); song.put("songTitle", cursor.getString(2)); song.put("songPath",cursor.getString(3)); song.put("album",cursor.getString(4)); // Adding each song to SongList songsList.add(song); } return songsList; }

Categories : Android

How to get the volume of a playing song continuously?
have you try this : value = audioManager.getStreamVolume(audioManager.STREAM_MUSIC); and this is the info link http://developer.android.com/reference/android/media/AudioManager.html

Categories : Android

html5 Audio song only playing first 2 in array?
The basic code for playing HTML5 audio also with controls: var i = 0; // song index var songList = [ 'songs/loop1.mp3', 'songs/loop2.mp3', 'songs/loop3.mp3', 'songs/loop4.mp3', 'songs/loop5.mp3', 'songs/loop6.mp3', 'songs/loop7.mp3', 'songs/loop8.mp3' ]; // create audio element var ae = document.createElement('audio'); ae.id = 'audioplayer'; ae.src = songList[0]; document.body.appendChild(ae); // create controls var btnPlay = document.createElement('button'); var btnPrev = document.createElement('button'); var btnNext = document.createElement('button'); var testDiv = document.createElement('div'); btnPlay.innerHTML = 'Play/Pause'; btnPrev.innerHTML = 'Previous song'; btnNext.innerHTML = 'Next song'; testDiv.id = "test"; document.body.appendChild(btnPlay); document.body.appendCh

Categories : Javascript

Append code to toggle image when song is playing
You could add to your CSS: .playback.playing { background: url('images/pausebutton.gif'); } This style will now refer to elements with the classes playback and playing. Then in your JavaScript: $(".playback").click(function(e) { e.preventDefault(); var song = $(this).next('audio').get(0); if (song.paused) { song.play(); $(this).addClass("playing"); } else { song.pause(); $(this).removeClass("playing"); } }); Within the function set to occur on click, $(this) will refer specifically to the element (with class playback) that was clicked. So the addClass method would apply the playing class only to the link for the song that was played. (In this example I also used removeClass to remove the playing class when the song is paused

Categories : Jquery

Java Music Player: Song information and playing
I'll provide information on a JavaFX related solution for a Java music player as I think it is a good technology to use for this task. Supported Platforms and Formats they may be of any audio filetype. Supported audio types for JavaFX are documented in the javafx.scene.media javadoc. Supported formats for JavaFX 2.2 are MP3, AAC and PCM in various containers such as mp3, mp4 and wav files. Other formats such as Ogg Theora are not supported - so if you need such formats you will need a different solution than JavaFX 2.2. I have seen people mentioning JavaFX, however this does not seem to be installed with the JVM by default and thus my program would no longer be cross-platform JavaFX is installed with the Oracle Java runtime by default since Java 7 update 6 and JavaFX 2.2 run

Categories : Java

Java jLayer application freezes while playing song
It happens because the song-playing happens in the same thread as the GUI, or more specifically the EDT. Therefore, the GUI does not response, when the song is playing. To fix this, do something like this: new Thread(){ run(){ //Your play code } }.start(); This will play your stuff in a seperate Thread. However, you have to regard that since the GUI is responsive, you can start songs while songs are still playing. For more information, see this

Categories : Java

Write name of current song playing in mpg123 to file
Run on one file at a time in a loop, and keep track of where you are in the loop. for f in /mnt/usbflash/mp3/*; do echo "$f" >/tmp/currently-playing mpg123 -Z "$f" # maybe redirect stdout / stderr? done &

Categories : Linux

Text stops showing unless not playing
Try this: function fileLoaded(e:Event):void { loader_ul.removeEventListener("complete", fileLoaded); xmlData = new XML(loader_ul.data); if (xmlData.SONGTITLE && xmlData.SERVERTITLE) { show_txt.text = xmlData.SERVERTITLE; song_txt.text = xmlData.SONGTITLE; } else { show_txt.text = "Untitled artist"; song_txt.text = "Untitled song"; } } Note: In order to prevent memory leaks, always call removeEventListener("someEvent", someMethod); after your event gets dispatched. There are some exclusions, but generally you should do it all the time.

Categories : Actionscript

How to call a method when AVAudioPlayer stops playing
I've never done it myself, but I would expect that you need to set the AVAudioPlayerDelegate delegate class and implement the following method: - (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag

Categories : Objective C

Music suddenly stops playing in application
You should create instance of WindowsMediaPlayer in class level scope (not inside OtworzPlikButton_Click event handler scope). WMPLib.WindowsMediaPlayer wplayer; private void OtworzPlikButton_Click(object sender, RoutedEventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.ShowDialog(); string directory = ofd.FileName; wplayer = new WMPLib.WindowsMediaPlayer(); wplayer.URL = directory; wplayer.controls.play(); }

Categories : C#

Listen for when an HTML5 Audio element stops playing
It is because you are using getElementById and passing audio when I think you mean to use getElementsByTagName, either that or you have the wrong id for the audio element.

Categories : Javascript

Music stops when playing in background.I don't want to use it as a service..what are my alternatives?
You have to use a foreground Service for this. The probability that a background Activity or a background Service gets killed by Android is very high. This is the problem you observe.

Categories : Android

iOS AVAudioPlayer sound stops playing when screen is locked
Thanks holex: I got "App plays audio" from http://mobile.tutsplus.com/tutorials/iphone/ios-sdk_background-audio/. If you add a row with UIBackgroundModes to the plist, it's automatically populated and includes this and six other background modes. If you Google "App plays audio" and UIBackgroundModes you'll see plenty of hits. [I would have replied via a Comment rather than an Answer, but alas, I don't have the reputation.]

Categories : IOS

How to detect if music is playing on iOS in AIR app
Will be necessary to create a custom ANE (I don't know if already exist one with this feature). I believe will be quite simple. Try to follow these steps Include the AVFoundation framework Import: #import Create a method to check. Follow just an example FREObject isMusicPlaying(FREContext ctx, void* funcData, uint32_t argc, FREObject argv[]) { BOOL retunValue; AVAudioPlayer *audioplayer; returnValue = (audioplayer.playing) ? YES : NO; FREObject retStr = NULL; FRENewObjectFromBool(returnValue, retStr); return retStr; }

Categories : Actionscript

player stops playing , but player rate doesn't change
Got this now. The key was that AVQueuePlayer was already removing the playeritem as it finished playing and i was removing the first item again assuming it didnt remove the item . This made the item count 0

Categories : IOS

Detect if browser / device can play HTML5 video inline before playing
I know this is an old question, but it's a big issue for me and there isn't a lot of information online. But I can answer your question after I found Alexey's answer in this thread: Detect if client allows inline media playback for HTML5 video. No, you can't detect if the browser/device supports inline video before playing it. That's the bad news. The problem is that the only reliable check for browsers like iOS Safari on iPhone is to start the video playing and then sniff if it instantly went to full screen native mode. Even that would fail if you made a player that automatically went to fullscreen on when the play event was triggered. The okay news, at least for me, is that by detecting it as soon as it starts playing along with using CSS media queries to detect screen size I should

Categories : Iphone

Building custom mp3 player for website - can't figure out how to write play last song, play next song functions
This is fully working code (for compatibility with old browsers you can use some flash fallback): HTML: <div class="mp3Player"> <audio id="music"></audio> <a id="last" class="last" class="button">◄◄</a> <a id="play" class="play" class="button">►</a> <a id="pause" class="pause" class="button">ll</a> <span id="info"></span> <a id="next" class="next" class="button">►►</a> </div> JS: function run() { var i = 0; // current song index var songList = [ 'a.mp3', 'b.mp3', 'c.mp3', 'd.mp3']; var audiocontainer = document.getElementById('mp3Player'); var ae = document.getElementById('music'); ae.src = songList[0]; var info

Categories : Javascript

Text to Speech not playing sound for first time, but playing for the next time
That's because you are clicking the button before the engine is ready. You have to check if the TTS engine has successfully initialized on your onInit() method and enable/disable the play button accordingly. Assuming that bt in your code is some sort of View that has setEnabled(boolean) method: @Override public void onInit(int status) { bt.setEnabled(status == TextToSpeech.SUCCESS); } You always have to assume that the engine has not been initialized and hence keep your play button disabled by default.

Categories : Android

WP7 how to get current song
to play a song MediaPlayer.Play(SongCollection songs); MediaPlayer.Play(SongCollection songs,int index); and to get songs MediaLibrary mLibrary = new MediaLibrary(); songs = mLibrary.Songs; to check current state if(MediaPlayer.State == MediaState.Playing || MediaPlayer.State == MediaState.Paused) and to check active song Microsoft.Xna.Framework.Media.MediaPlayer.Queue.ActiveSong.Name;

Categories : C#

Regex get song h:m:s when h and m is optional
The following seems to work for all of your examples, replace matches of: (.*?) (d+:)?(d+):(d+) with: the song "$1" is $3min and $4sec

Categories : Regex

Resume song in Android
To prevent this you should use a service for playing sounds while your activity goes to background. Refer to the android's documentation about the life-cycle of an activity to see what actually happens: https://developer.android.com/training/basics/activity-lifecycle/index.html

Categories : Java

How to play a song when mouseover?
You need to declare your soundChannel variable with the var keyword. Try adding this near the top of your file, after your import statements. var soundChannel:SoundChannel;

Categories : Actionscript

Getting song meta data
First, you can download the mp3 file to local using this: WebClient Client = new WebClient (); Client.DownloadFile("http://myserver.com/indie/band1.mp3", "band1.mp3"); Then, use TagLibSharp https://github.com/mono/taglib-sharp //Local reference to the file TagLib.File file = TagLib.File.Create("band1.mp3"); //Get the file metadata Console.WriteLine("Tags on disk: " + file.TagTypesOnDisk); Console.WriteLine("Tags in object: " + file.TagTypes); Write ("Grouping", file.Tag.Grouping); Write ("Title", file.Tag.Title); Write ("Album Artists", file.Tag.AlbumArtists); Write ("Performers", file.Tag.Performers); Write ("Composers", file.Tag.Composers); Write ("Conductor", file.Tag.Conductor); Write ("Album", file.Tag.Album); Write ("Genres", file.Tag.Genres); Write ("BPM", file.Tag.BeatsPerMin

Categories : C#

How to add a song progress bar in SoundManager2?
The logic seems to be fine - what you need to is to call the modify width snippet while the track is playing, using the whileplaying method (I think): soundManager.setup({ url: '/swf', preferFlash: false, waitForWindowLoad: true, onready: function() { var myTrack1 = soundManager.createSound({ id: 'trackOne', url: 'msamples/beep-1.mp3', volume: 80, autoPlay: false,}); $("li.a5 a").click(function(event){soundManager.play('trackOne');}); }, whileplaying: function() { $(".progBar").css('width', ((this.position/this.duration) * 100) + '%'); }, ontimeout: function() { // Uh-oh. SWF missing, Flash blocked or other issue } });

Categories : Javascript

Play specific song
You don't have to do this by looping through all the items in the library. It can be done via MPMediaQuery, something like this: NSNumber *persistentIDNumber = [NSNumber numberWithInteger:4238475234]; MPMusicPlayerController *player = [MPMusicPlayerController applicationMusicPlayer]; MPMediaPropertyPredicate *predicate = [MPMediaPropertyPredicate predicateWithValue:persistentIDNumber forProperty:MPMediaEntityPropertyPersistentID]; MPMediaQuery *query = [[MPMediaQuery alloc] init]; [query addFilterPredicate: predicate]; [player setQueueWithQuery:query]; [player prepareToPlay]; [player play];

Categories : IOS

Play song from computer during runtime
System.IO.FileStream fs = new System.IO.FileStream(@"C:Myfile.wav", System.IO.FileMode.Open); SoundEffect mysound = SoundEffect.FromStream(fs); fs.Dispose(); @"C:Myfile.wav" can be a relative or absolute path. Not sure about MP3's or others. Worst case scenario, just embed the FMod Ex soundsystem into your XNA game.

Categories : C#

JSON Serialization song information
For every MPMediaItem, create an NSDictionary with key/value pairings equivalent to title, artist, etc. Then add each one to a mutable array. Finally, serialize the array to JSON. For example: NSMutableArray *mutableSongsToSerialize = [NSMutableArray array]; NSArray *songs = [playlist items]; for (MPMediaItem *song in songs){ NSString *title =[song valueForProperty: MPMediaItemPropertyTitle]; NSString *artist =[song valueForProperty: MPMediaItemPropertyAlbumArtist]; NSString *album =[song valueForProperty: MPMediaItemPropertyAlbumTitle]; NSString *length =[song valueForProperty: MPMediaItemPropertyPlaybackDuration]; NSDictionary *songDictionary = @{@"title": title, @"artist": artist, @"album":album, @"length":length}; [mutableSongsTo

Categories : IOS

Couldn't find Song with id=edit
You have a routing conflict: resources :songs get "songs/index" get "songs/show" get "songs/new" get "songs/edit" I'm guessing that you received the error when trying to follow the songs/edit path. Well, the resources :songs declaration above it overrides it, calling show with the id "path", matching the error message. Delete all of those get declarations because they are unnecessary; resources :songs overrides them with RESTful routes.

Categories : Ruby On Rails

How I get the song of image using MediaPicker iPhone
try this: NSMutableArray *arr = [NSMutableArray arrayWithArray:mediaItemCollection.items]; for (int i =0; i<=[arr count]-1; i++) { MPMediaItem *selectedSong = [[mediaItemCollection items] objectAtIndex:i]; titleString = [selectedSong valueForProperty:MPMediaItemPropertyTitle]; MPMediaItemArtwork *artWorkItem = [selectedSong valueForProperty:MPMediaItemPropertyArtwork]; UIImage *coverImage = NULL; if(artWorkItem) coverImage = [artWorkItem imageWithSize:CGSizeMake(100, 100)]; if(coverImage) myImageView.image = coverImage; else { NSLog(@"No album Artwork!!!"); myImageView.image = [UIImage imageNamed:@"default"]; } }

Categories : Iphone

onListItemClick() Start/Stop Song
try setDataSource(""+s.getSoundResourceId()); instead of setDataSource(s.getSoundResourceId()); PS. also initialize mPlayer like MediaPlayer mPlayer=new MediaPlayer(); instead of MediaPlayer mPlayer; and remove this mPlayer = new MediaPlayer(); from your if condition !

Categories : Android

Using RegEx in VB.Net to get song information from filename
I believe this will work for you: ^(?<drive>[^:]+):\(?<folder>Music)\(?<subfolder>[^\]+)\(?<group>[^(]+)\((?<year>[^)]+))s+(?<album>[^\]+)\(?<track>[^.]+).s*(?<artist>.+?) - (?<title>[^.]+).mp3$ Breaking it down for an explanation: ^ 'start of string (?<drive>[^:]+) 'named capture group "drive", captures any character except : :\ 'finds : followed by "" ("" has to be escaped to be a literal "", so \ is needed here) (?<folder>Music) 'named capture group "folder", captures Music \ 'finds "" (?<subfolder>[^\]+) 'named capture group "subfolder", captures any character except "" \ 'finds "" (?<group>[^(]+)

Categories : Regex

What is the sequence to be followed to play a song using gstreramer?
Please look at the examples shipped with gstreamer. A few points: You need to set the state of the pipeline back to ready to be able to change the uri State-changes are asynchronous. Please read about The GstBus and make use of it. In particullar don't attach to the bus after playing. Create your playbin pipeline and attach to the bus. Then you can go to PLAYING, the bus will inform you about when the playback started and when in finished (among other things). Also consider using 1.0 for a new application, 0.10 is in maintenance mode.

Categories : C

How to identify AVAudioPlayer is streaming the song
Your problem is this: NSData *data = [NSData dataWithContentsOfURL:url]; This is one of the worst possible ways to download data on iOS, for a number of reasons. Firstly, it's synchronous, so if you're calling it on the main thread it's a blocking operation (meaning your entire UI will freeze). What only takes a few seconds on a fast WiFi connection could take a minute or longer on a cellular connection. It's also bad because it doesn't provide you with any sort of progress or status update. If the download fails you won't know why it's gone wrong. You'll be in the dark as to whether it's your user's network connection, the server, something completely different... So even if you were running dataWithContentsOfURL on a background thread, it's still far from ideal since it doesn't provi

Categories : IOS

how to show genres through associatin in the song controller?
You need to get rid off gendre_name method, as it doesn't give you what you want. You've assigned @songs to some list of songs, hence most likely somewhere in your view you have sth like: <% @songs.each do |song| %> # display song row <% end %> if so, use sth like below inside this each "loop": (<%= song.genres.map(&:names).join(', ') %>)

Categories : Ruby On Rails

How can I show the progress of a song on a SHOUTcast stream?
It seems that it cannot be done: SHOUTcast streams were never intended to indicate per-song position as it can be done but requires protocol changes and everything from the source software to the client player to cope with and support it.

Categories : Misc

Unable to re setDatasource the second time when i try to play the next song
The problem is that you are trying to reuse a MediaPlayer object after it has been released. so remove mp.release() if(mp.isPlaying()) { mp.stop(); // mp.release(); } and release the media player when yoyr activity finishes using onDestroy callback: @Override public void onDestroy(){ super.onDestroy(); if(mp !=null){ if (mp.isPlaying()){ mp.stop(); } mp.release(); } }

Categories : Android

How to start a song from a specific time in spotify
try something simpler: var player = new views.Player(); player.PlayTrack('spotify:track:0blzOIMnSXUKDsVSHpZtWL', 60000, 10000); This plays 10 seconds of the track starting at the 1minute mark.

Categories : Javascript



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.