Search the Community
Showing results for tags 'mp3'.
-
I just ran into another issue with Phaser and I'd like to know if it's a known bug – and of course if there is a solution! I am trying to play sounds (mp3) with no success. The sound plays fine on my computer using Windows browser but the same code won't produce any sound on Opera Mobile Emulator or on my actual mobile (Samsung J2). I didn't try 'ogg' format because I searched online and found other people with the same problem and that have actually tried with no success. After several frustrated tests with my own code I tried the following Phaser examples: https://phaser.io/examples/v2/audio/loop https://phaser.io/examples/v2/audio/play-music Guess what... same issue: works on computer but not on Opera Emulator neither my mobile. Since I am writing this code specifically for mobiles this is a MUST for me that sounds play on them. Any clue? Below my code... var game = new Phaser.Game(window.innerWidth, window.innerHeight, Phaser.AUTO, 'test', { preload: preload, create: create }); var aExtensions = [ ]; var aExtensions = ['.png','.mp3']; var aTypes = ['img','snd']; var aAssets = ['door','knock']; function preload() { game.load.image(aAssets[0],aTypes[0]+'/'+aAssets[0]+aExtensions[0]); game.load.audio(aAssets[1],aTypes[1]+'/'+aAssets[1]+aExtensions[1]); } function create() { var gamegroup = game.add.group(); gamegroup.inputEnableChildren = true; window[aAssets[0]] = gamegroup.create(0,0, aAssets[0]); window[aAssets[1]+'snd']= game.add.audio(aAssets[1]); window[aAssets[0]].inputEnabled = true; window['lst'+aAssets[0]] = function (me) { knocksnd.play(); me.visible = false; } window[aAssets[0]].events.onInputUp.add(window['lst'+aAssets[0]], this); } Thanks!
-
Hi All, Thanks for reading my question. I created an jumping game using phaser and upload it to app store. Game Link: https://itunes.apple.com/us/app/jump-go/id1143991571?mt=8 Now in the next version I am planning to add more good background and other game sounds (car, accident and other sounds) to make the game more real. Can someone please tell me which format is better (MP3 or WAV or OGG). When I check WAV files are too big compare to MP3 so I am thinking of using MP3 format, but worried about quality of the MP3 sound in mobile. any suggestion will be highly appreciated Thank You Joseph
-
I've just about completed my first game that I want to release to the general public. Part of that process is getting it on itch.io and using cocoonjs to package it up to make it native for mobile. The problem is that in certain circumstances the audio will not play. serving it up on my local machine (Ubuntu with a node server) it works on desktop and Android on itch.io (They put it in an iframe) it works on desktop, and iPhone but on android no audio. Tried to package it up with cocoon and tested it on Android again no audio. I don't have an iPhone handy so I'm limited in what testing I can do there. The problem seems to be just on Android though when the game is played through an iframe or packaged into an apk. The game is built around @lukewilde's awesome boilerplate. That thing has really helped my workflow so I hope it isn't part of the problem. I've looked at the build and everything appears as I would expect it. I have also used some code from the official breakout example. So that will look familiar. In the Preloader state I'm Preloading the audio like so: this.game.load.audio('beef', [ './audio/beef.ogg', './audio/beef.mp3' ]); Then in my game state I'm adding a variable for the audio. this.beef = game.add.audio('beef'); Lastly also in the game state the audio is played with: this.beef.play(); I've really been beating my head against the wall trying to figure out what is going on here. I'm hoping it is something simple that I've overlooked. I also don't know how to debug on Android so maybe I just need help with that and I'd figure this out myself. Here is a link to the game on itch.io https://motorcityrobots.itch.io/build-that-wall Here is all the code in Github https://github.com/bobonthenet/BuildThatWallGame
-
Hi, We are trying to update our HTML5/JS 2D video game engine to support Android/iOS smartphones/tablets. Our current version of our engine does not play audio on Android/iOS mobile devices. What is the best method to play audio (either MP3/OGG) on Android/iOS mobile devices? Here is our current audio initialization code: function InitSettings() { if ( navigator.userAgent.toLowerCase().indexOf('android') > -1 ) Browser = "Google Android"; else if ( navigator.userAgent.toLowerCase().indexOf('iphone') > -1 || navigator.userAgent.toLowerCase().indexOf('ipad') > -1 || navigator.userAgent.toLowerCase().indexOf('ipod') > -1 ) Browser = "Apple iOS"; else if ( navigator.userAgent.toLowerCase().indexOf('mobile') > -1 ) Browser = "Mobile Unknown"; else if ( navigator.userAgent.toLowerCase().indexOf('viera') > -1 ) Browser = "Viera Smart T.V."; else if ( navigator.userAgent.toLowerCase().indexOf('edge') > -1 ) Browser = "MS Edge"; else if ( navigator.userAgent.toLowerCase().indexOf('opera') > -1 || navigator.userAgent.toLowerCase().indexOf('opr') > -1 ) Browser = "Opera"; else if ( navigator.userAgent.toLowerCase().indexOf('chrome') > -1 ) Browser = "Chrome"; else if ( navigator.userAgent.toLowerCase().indexOf('firefox') > -1 ) Browser = "Firefox"; else if ( navigator.userAgent.toLowerCase().indexOf('ie') > -1 || navigator.userAgent.toLowerCase().indexOf('trident') > -1 ) Browser = "MS IE"; else if ( navigator.userAgent.toLowerCase().indexOf('safari') > -1 ) Browser = "Safari"; else Browser = "UNKNOWN Browser"; SoundType = "null"; var audioTest = document.createElement('audio'); if ( audioTest.canPlayType('audio/mpeg;') ) SoundType = "mp3"; else if ( audioTest.canPlayType('audio/ogg;') ) SoundType = "ogg"; Here is our sound effects and music load/play code: //-------------------------------------------------------------------------------------------------------------- function LoadSound() { var index; for (index = 0; index < NumberOfMusics; index++) MusicIsCompletelyLoaded[index] = false; if (SoundType === "ogg" || SoundType === "mp3") { for (index = 0; index < NumberOfSoundEffects; index++) SoundArray[index] = document.createElement("Audio"); SoundArray[0].src = "./data/audio/MenuClick." + SoundType; SoundArray[1].src = "./data/audio/MenuMove." + SoundType; SoundArray[2].src = "./data/audio/MovePiece." + SoundType; SoundArray[3].src = "./data/audio/PieceCollision." + SoundType; SoundArray[4].src = "./data/audio/PieceDrop." + SoundType; SoundArray[5].src = "./data/audio/PieceRotate." + SoundType; SoundArray[6].src = "./data/audio/LineCleared." + SoundType; SoundArray[7].src = "./data/audio/TetriCleared." + SoundType; SoundArray[8].src = "./data/audio/LevelUp." + SoundType; SoundArray[9].src = "./data/audio/MustThinkInRussian." + SoundType; SoundArray[10].src = "./data/audio/IncomingLine." + SoundType; SoundArray[11].src = "./data/audio/GameOver." + SoundType; SoundArray[12].src = "./data/audio/Crack." + SoundType; SoundArray[13].src = "./data/audio/ShallWePlayAGame." + SoundType; SoundArray[14].src = "./data/audio/Sword." + SoundType; for (index = 0; index < NumberOfSoundEffects; index++) { SoundArray[index].preLoad = "auto"; } for (index = 0; index < NumberOfMusics; index++) { MusicArray[index] = document.createElement("Audio"); MusicArray[index].src = ("./data/audio/Track-0"+(index+1)+"-BGM." + SoundType); MusicArray[index].volume = MusicVolume; MusicArray[index].preload = "auto"; MusicArray[index].addEventListener( "canplay", MusicLoaded.bind(window, index) ); } } } //-------------------------------------------------------------------------------------------------------------- function PlaySoundEffect(index) { if (ThinkRussianTimer > 0) return; if (SoundType === "null") return; if ( index > (NumberOfSoundEffects-1) ) return; if (SoundVolume === 0) return; SoundArray[index].volume = SoundVolume; SoundArray[index].currentTime = 0; SoundArray[index].play(); } //-------------------------------------------------------------------------------------------------------------- function PlayMusic(index) { if (SoundType === "null") return; if ( index > (NumberOfMusics-1) ) return; if (MusicVolume === 0) return; MusicArray[CurrentlyPlayingMusicTrack].pause(); CurrentlyPlayingMusicTrack = index; MusicArray[index].addEventListener("ended", LoopMusicFixForFirefox, false); MusicArray[index].currentTime = 0; MusicArray[index].volume = MusicVolume; MusicArray[index].play(); } Any help would be appreciated, thanks!
-
hI. my game is playing BGM by mp3 and using sound.js by createjs (http://www.createjs.com/soundjs) (same when i tested by howler.js ) when i play BGM my game's memory is up 100mb more.. my game has 200-300mb memory when every resource loaded except BGM. if BGM loaded, my game is 300-400MB memory my BGM has '128kb 4:12 playtime' size is 3.85MB how can i reduce memory with mp3 T-T Android platform has big memory more than 2mb if galaxy note3 or later... but IOS platform has 1GB until Iphone6 T-T.. do you have idea for this..
-
I have two sounds that I'm trying to play in a game of mine. They're both using the MP3 codec, but one of them is inexplicably not playing in Safari 9 or Firefox 41.0.1 (Mac OS X 10.10.5). It plays just fine in the most recent version of Google Chrome, 47.0.2522.0 dev, but not Safari 9 or Firefox 41.0.1. I'm not sure why one MP3 sound would play while another wouldn't, when they both load just fine and there are no errors thrown, except in Firefox where it complains about not being able to use a given encoding (which doesn't make sense since it plays one of the MP3 sounds). Here is the sound that plays just fine: http://cl.ly/3u1p3Y3v0X1cThis is the one that doesn't play in Firefox and Safari: http://cl.ly/420O3P2r1P04Here is a demo of both sounds playing: http://cl.ly/231I320F053D. When you open it with Safari 9 or Firefox 41.0.1, you can only hear the jump sound. Any ideas as to what's going wrong here? EDIT: Btw, here's the source code for the demo: var game = new Phaser.Game(800, 550, Phaser.AUTO, "game", {preload: preload, create: create});function preload () { intro_music_key = "intro_music" intro_music_path = "intro_music.mp3" game.load.audio(intro_music_key, intro_music_path) jump_key = "jump" jump_path = "jump.mp3" game.load.audio(jump_key, jump_path)}function create () { game.add.text(320, 100, "Audio Test", {fill: "white"}); intro_music = game.add.audio(intro_music_key); intro_music.play(); jump = game.add.audio(jump_key); jump.play();}
-
I would like to present a game-music ressource site I created 6 years ago: www.IndieGameMusic.com It is a free service for musicians to offer their music to game-developers. Game-developers has detailed search options available, shortening down the search time needed to find the music he needs. Music is available from many different artists, in many different filetypes, different prices etc. There's bound to be a track you like for your game. :-) One of the primary reasons for creating IndieGameMusic.com, was my personal preference regarding game-music: I feel the MOD and XM formats should be used when possible. And looking around, all I could find was mp3/ogg sound libraries. At the time, I also had a bunch of MIDI tracks I'd made, optimized for the JavaME platform for my fellow JavaME developers, so it made sense to me to make a site where all kinds of formats could be found. I'm posting here on this forum after stumbling across this post about using MOD/XM files for HTML5 games. I would love to see those formats used more. As a geeky musician, I'm much more into creating (relative) small XM files than big mp3 files. I also like trying to create the same track in many different formats, e.g. for game-developers who's targetting different platforms. Example track "Moments" available in many different formats. Example track "Moments" in a "building block" version. I hope you will find the site useful. Good luck with your games!
-
I created apk using PhoneGap, but the sound not sound (LOL). In Google Chrome (page) on my mac OK, but in Android No. I use mp3 and wav