Quantcast
Channel: Cocos中文社区 - 最新主题
Viewing all articles
Browse latest Browse all 88737

playMusic 在Android环境不能播放

$
0
0

@fzroad 写道:

使用cc.audioEngine.playMusic()播放:
1.播放一个mp3文件(这个文件在模拟器环境都是可以播放的)
V/AudioPlayerProvider: (/storage/emulated/0/1.mp3) file size: 5478072
11-09 17:39:15.293 6485-6525/org.cocos2d.WanJuMJ V/UrlAudioPlayer: Current UrlAudioPlayer instance count: 1
11-09 17:39:15.293 6485-6525/org.cocos2d.WanJuMJ V/UrlAudioPlayer: UrlAudioPlayer::prepare: /storage/emulated/0/1.mp3, -2147481668, 0, 0, 5478072
11-09 17:39:15.296 6485-6525/org.cocos2d.WanJuMJ E/libOpenSLES: SfPlayer::setDataSource: invalid offset
11-09 17:39:15.297 6485-6525/org.cocos2d.WanJuMJ D/cocos2d-x debug info: >>>playMusic start
11-09 17:39:15.299 6485-6615/org.cocos2d.WanJuMJ E/libOpenSLES: no data locator for MediaPlayer object
11-09 17:39:15.299 6485-6615/org.cocos2d.WanJuMJ E/libOpenSLES: Error (-2147483648) encountered while prefetching

2.播放一个我自己录制的音频文件(这个文件如果我反射回调android的SoundPool是可以播放的)

11-09 17:41:21.926 8926-8968/org.cocos2d.WanJuMJ V/AudioPlayerProvider: (/storage/emulated/0/wjmj/KHKKSSAQLGXX14786844809791500320714) file size: 344
11-09 17:41:21.926 8926-8968/org.cocos2d.WanJuMJ V/AudioPlayerProvider: FileInfo (0xd9781de0), Waiting preload (/storage/emulated/0/wjmj/KHKKSSAQLGXX14786844809791500320714) to finish ...
11-09 17:41:21.926 8926-9113/org.cocos2d.WanJuMJ V/AudioPlayerProvider: AudioPlayerProvider::preloadEffect: (/storage/emulated/0/wjmj/KHKKSSAQLGXX14786844809791500320714)
11-09 17:41:21.928 8926-9113/org.cocos2d.WanJuMJ V/AudioDecoder: Play callback registered

                                                             [ 11-09 17:41:21.928  8926: 9113 I/         ]
                                                             counter >= 5, send pause/stop state to pg, counter: 0

11-09 17:41:21.941 8926-9117/org.cocos2d.WanJuMJ I/FFMPEGExtractor: Users across the process calls!
11-09 17:41:21.941 8926-9117/org.cocos2d.WanJuMJ V/HwExtendedExtractor: Sniff Failed
11-09 17:41:21.945 8926-9117/org.cocos2d.WanJuMJ V/MediaExtractor: Autodetected media content as 'audio/3gpp' with confidence 0.50
11-09 17:41:21.945 8926-9117/org.cocos2d.WanJuMJ D/AMRExtractorEx: AMRExtractor--is streaming flag=0, pData:0x0xd4ee3800
11-09 17:41:21.945 8926-9117/org.cocos2d.WanJuMJ D/AMRExtractorEx: AMRExtractor--constructor out -
11-09 17:41:21.945 8926-9117/org.cocos2d.WanJuMJ D/HwExtendedExtractor: extended extractor not needed, return default
11-09 17:41:21.947 8926-9117/org.cocos2d.WanJuMJ W/ServiceManager: Permission failure: android.permission.ALLOW_ANY_CODEC_FOR_PLAYBACK from uid=10489 pid=8926
11-09 17:41:21.947 8926-9117/org.cocos2d.WanJuMJ E/libOpenSLES: AudioSfDecoder::onPrepare: Could not find a supported audio track.
11-09 17:41:21.947 8926-9117/org.cocos2d.WanJuMJ E/libOpenSLES: Error (-1010) encountered while prefetching
11-09 17:41:21.947 8926-9117/org.cocos2d.WanJuMJ V/AudioDecoder: PrefetchEventCallback: Error while prefetching data, exiting
11-09 17:41:21.948 8926-9113/org.cocos2d.WanJuMJ E/AudioDecoder: Failure to prefetch data in time, exiting
11-09 17:41:21.948 8926-9113/org.cocos2d.WanJuMJ E/AudioDecoder: Failure to prefetch data in time
11-09 17:41:21.948 8926-9113/org.cocos2d.WanJuMJ E/AudioDecoder: decodeToPcm (/storage/emulated/0/wjmj/KHKKSSAQLGXX14786844809791500320714) failed!
11-09 17:41:21.948 8926-9113/org.cocos2d.WanJuMJ V/AudioDecoder: start returns false, decode (/storage/emulated/0/wjmj/KHKKSSAQLGXX14786844809791500320714)
11-09 17:41:21.948 8926-9113/org.cocos2d.WanJuMJ E/AudioPlayerProvider: decode (/storage/emulated/0/wjmj/KHKKSSAQLGXX14786844809791500320714) failed!
11-09 17:41:21.948 8926-9113/org.cocos2d.WanJuMJ V/AudioPlayerProvider: decode succeed.
11-09 17:41:21.948 8926-9113/org.cocos2d.WanJuMJ V/AudioPlayerProvider: preload (/storage/emulated/0/wjmj/KHKKSSAQLGXX14786844809791500320714) callback count: 1
11-09 17:41:21.948 8926-9113/org.cocos2d.WanJuMJ V/AudioPlayerProvider: FileInfo (0xd9781de0), Set isSucceed flag: 0, path: /storage/emulated/0/wjmj/KHKKSSAQLGXX14786844809791500320714
11-09 17:41:21.948 8926-9113/org.cocos2d.WanJuMJ V/AudioDecoder: ~AudioDecoder() 0xd147f740
11-09 17:41:21.948 8926-8968/org.cocos2d.WanJuMJ V/AudioPlayerProvider: FileInfo (0xd9781de0), Waitup preload (/storage/emulated/0/wjmj/KHKKSSAQLGXX14786844809791500320714) ...
11-09 17:41:21.948 8926-8968/org.cocos2d.WanJuMJ E/AudioPlayerProvider: FileInfo (0xd9781de0), preloadEffect (/storage/emulated/0/wjmj/KHKKSSAQLGXX14786844809791500320714) failed
11-09 17:41:21.948 8926-8968/org.cocos2d.WanJuMJ V/AssetFd: ~AssetFd: 0
11-09 17:41:21.948 8926-8968/org.cocos2d.WanJuMJ V/AudioPlayerProvider: getAudioPlayer, 199 return nullptr
11-09 17:41:21.948 8926-8968/org.cocos2d.WanJuMJ E/cocos2d-x debug info: Oops, player is null ...
11-09 17:41:21.948 8926-9113/org.cocos2d.WanJuMJ V/AudioDecoder: After destroying SL play object

另外使用playEffect()也失败,和上面差不多的错误信息
求帮助!!!!

帖子: 2

参与者: 1

阅读整个主题


Viewing all articles
Browse latest Browse all 88737

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>