标签: audio-player

Delphi:启动 MCI 时出现 EMCIDeviceError

我使用 TMediaPlayer 组件来播放音乐。

它适用于我的大部分曲目。但它不适用于某些曲目。当我想播放它们时,会显示以下错误消息:

替代文字

这是德语,但大致意思是:

在项目 pMusicPlayer.exe 中,发生了类 EMCIDeviceError 的异常。消息:“启动 MCI 时出错。”。进程已停止。继续“单个命令/语句”或“开始”。

程序调用TMediaPlayer的“Play”程序后直接退出。

例如,以下文件发生此错误:

  • 文件大小:7.40 MB
  • 持续时间:4:02 分钟
  • 比特率:256 kBit/s

我用 128 kBit/s 的比特率编码了这个文件,因此文件大小为 3.70 MB:它工作正常!

第一个文件有什么问题?Windows Media Player 或其他程序可以毫无问题地播放它。

Delphi 的 TMediaPlayer 是否可能无法处理大文件(例如 > 5 MB)或具有高比特率(例如 > 128 kBit/s)的文件?

我能做些什么来解决问题?

附加问题: 为什么我不能使用 try/except 来阻止消息窗口?

  try
    Player.Play;
  except
    showmessage('Cannot be played');
  end;
Run Code Online (Sandbox Code Playgroud)

这不起作用。

delphi mp3 windows-media-player audio-player

7
推荐指数
1
解决办法
9403
查看次数

我想阻止我的音乐播放器应用程序每次应用程序启动时扫描目录中的音频文件.我怎样才能做到这一点?

我想阻止我的音乐播放器应用程序在每次应用程序启动时扫描目录中的音频文件.我怎样才能做到这一点?

我一直在使用以下代码来扫描音频文件.

public void getSongList() {

  ContentResolver contentResolver=getContentResolver();
  Uri musicUri=android.provider.MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
  Cursor musicCursor = contentResolver.query(musicUri, null, null, null, null);
  if(musicCursor!=null && musicCursor.moveToFirst()) {
    //get columns
    int titleColumn = musicCursor.getColumnIndex
                (android.provider.MediaStore.Audio.Media.TITLE);
    int idColumn = musicCursor.getColumnIndex
                (android.provider.MediaStore.Audio.Media._ID);
    int artistColumn = musicCursor.getColumnIndex
                (android.provider.MediaStore.Audio.Media.ARTIST);

    int albumIDColumn = musicCursor.getColumnIndex(MediaStore.Audio.Media.ALBUM_ID);

    //add songs to list
    do {
       long thisId = musicCursor.getLong(idColumn);
       String thisTitle = musicCursor.getString(titleColumn);
       String thisArtist = musicCursor.getString(artistColumn);
       long thisAlbumID=musicCursor.getLong(albumIDColumn);
       Uri sArtworkUri = Uri.parse("content://media/external/audio/albumart");
       Bitmap albumArtBitMap=null;
       Uri albumArtUri = ContentUris.withAppendedId(sArtworkUri, thisAlbumID);
       try {
         albumArtBitMap = MediaStore.Images.Media.getBitmap(this.getContentResolver(), albumArtUri); …
Run Code Online (Sandbox Code Playgroud)

audio android audio-player android-mediaplayer

7
推荐指数
1
解决办法
623
查看次数

MPMusicPlayer错误域= MPErrorDomain代码= 4?

我有音乐播放器的问题,大多数歌曲都给出了错误

错误域= MPErrorDomain代码= 4

测试设备有Apple音乐订阅,并且曲目在他们在Apple音乐应用程序中正常工作的应用程序上出错!

这是代码:

let applicationMusicPlayer = MPMusicPlayerController.systemMusicPlayer()
 applicationMusicPlayer.setQueueWithStoreIDs([ID])

      if #available(iOS 10.1, *)
      {

        applicationMusicPlayer.prepareToPlay { (error) in

            if (error != nil)
            {
                print("[MUSIC PLAYER] Error preparing : \(String(describing: error))")
                return
            }else
            {
                self.start_timer();
                self.applicationMusicPlayer.play()
            }

        }

      }else
      //Play directly ios below version 10.1
      {
        self.applicationMusicPlayer.play()
      }

    }
Run Code Online (Sandbox Code Playgroud)

但是我试过,当轨道出现这个错误时,我去了Apple音乐播放器并从那里播放它的工作,然后我回到我的应用程序并从我的应用程序播放它工作也很好,所以我需要去Apple音乐应用程序播放不在我的应用程序中播放的曲目,使它们在我的应用程序中工作!这有点奇怪为什么?

PS:测试设备有Apple音乐订阅

audio-player mpmusicplayercontroller ios swift

7
推荐指数
1
解决办法
422
查看次数

YouTube 使用什么算法来改变播放速度而不影响音频音调?

YouTube 可以选择更改视频的播放速度,从而加快或减慢视频的音频而不影响其音高。我知道有许多不同的算法可以做到这一点,但我很好奇Youtube 使用哪种特定算法,因为它似乎工作得相当好。

另外,有没有实现这个算法的开源库?

youtube signal-processing audio-player pitch-shifting

7
推荐指数
1
解决办法
3229
查看次数

在网站上的不间断的背景音乐

我正在建立一个音乐乐队的网站,我想知道在网站上播放背景音乐的最佳方式,而不会中断音乐的流动(即使是一瞬间).

目前,我正在考虑使用框架,但这不应该是好的做法.请有人告诉我如何做到这一点.我更喜欢使用HTML来编码网站,因为我还没有掌握flash中的编码.

background audio-player

6
推荐指数
2
解决办法
8619
查看次数

Node.js 音频播放器

我基本上想依次播放一系列 mp3 文件。这应该不难,但我正在努力保持解码器和扬声器通道打开,以便在播放歌曲后输入新的 mp3 数据。这是我目前所拥有的压缩版本,播放一个 mp3 文件。

var audioOptions = {channels: 2, bitDepth: 16, sampleRate: 44100};

// Create Decoder and Speaker
var decoder = lame.Decoder();
var speaker = new Speaker(audioOptions);

// My Playlist
var songs = ['samples/Piano11.mp3','samples/Piano12.mp3','samples/Piano13.mp3'];

// Read the first file
var inputStream = fs.createReadStream(songs[0]);

// Pipe the read data into the decoder and then out to the speakers
inputStream.pipe(decoder).pipe(speaker);

speaker.on('flush', function(){
  // Play next song
});
Run Code Online (Sandbox Code Playgroud)

我正在使用 TooTallNate 的模块node-lame(用于解码)和node-speaker(用于通过扬声器输出音频)。

javascript audio-player node.js

6
推荐指数
1
解决办法
7162
查看次数

在服务中更新MusicPlayer SeekBar

我正在尝试更新音乐播放器SeekBar,但没有任何反应.服务在我的活动中启动正常并正确绑定(因为我可以使用我服务中的一些方法和音乐播放正常).这是我的服务代码:

public class MusicPlayerService extends Service {

MediaPlayer myMusicPlayer;
String path;
Intent getMusicId = new Intent();

// Binder given to clients
private final IBinder mBinder = new LocalBinder();

/**
 * Class used for the client Binder.  Because we know this service always
 * runs in the same process as its clients, we don't need to deal with IPC.
 */
public class LocalBinder extends Binder {
    MusicPlayerService getService() {
        // Return this instance of LocalService so clients can call public methods …
Run Code Online (Sandbox Code Playgroud)

service android seekbar audio-player android-music-player

6
推荐指数
1
解决办法
5848
查看次数

在Android Lollipop 5.x上使用NuPlayer阻止我的音频应用程序?

我有一个音频应用程序,可以同时播放多个曲目,每个曲目都有自己的曲目mediaPlayer.每条赛道都相当长,超过两分钟.

只要将曲目编码为ogg文件,一切都在Android 4.x上运行良好.我还没有遇到运行stock 4.x的设备,这个设置有任何音频问题.

但是在Lollipop 5.x上有各种各样的音频问题 - 口吃,音轨切断,蓝牙音频几乎从来没有用过.

我发现进入5.x中的Developer选项并取消选中"使用Nuplayer(实验)"可以立即解决这些问题,并恢复到4.x级别的性能.

有没有办法我可以编程强制我的应用程序使用4.x媒体堆栈(我相信它被称为Awesomeplayer?)而不是使用新的Nuplayer系统?至少在我能发现Nuplayer问题的根源之前?

audio android audio-player

6
推荐指数
1
解决办法
7201
查看次数

xcode - iOS 8上不显示MPNowPlayingInfoCenter信息

我正在开发一个应该在后台播放音乐的音乐应用程序.

我用它MPMoviePlayerController来播放音乐.我的代码启动MPMoviePlayerController:

NSString* resourcePath = [[NSBundle mainBundle] resourcePath];
resourcePath = [resourcePath stringByAppendingString:@"/music.m4a"];
NSError* err;
self.player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:resourcePath]];
if (err) {
    NSLog(@"ERROR: %@", err.localizedDescription);
}
AVAudioSession *session = [AVAudioSession sharedInstance];
[session setCategory:AVAudioSessionCategoryPlayback withOptions:AVAudioSessionCategoryOptionMixWithOthers error:nil];
[session setActive:YES error:nil];
[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
[self.player setShouldAutoplay:NO];
[self.player setControlStyle: MPMovieControlStyleEmbedded];
self.player.view.hidden = YES;
[self.player prepareToPlay];
Run Code Online (Sandbox Code Playgroud)

当我执行[self.player play];音乐开始.但我还想在LockScreen和ControlCenter中显示歌曲名称,专辑名称和专辑插图.我正在使用以下代码:

Class playingInfoCenter = NSClassFromString(@"MPNowPlayingInfoCenter");
    if (playingInfoCenter) {
        NSMutableDictionary *songInfo = [[NSMutableDictionary alloc] init];
        MPMediaItemArtwork *albumArt = [[MPMediaItemArtwork alloc] initWithImage: [UIImage …
Run Code Online (Sandbox Code Playgroud)

xcode mpmovieplayercontroller audio-player lockscreen ios

6
推荐指数
2
解决办法
7141
查看次数

如何使我的应用程序的控制中心上的下一个和上一个音轨按钮消失?

我正在制作一个处理音乐播放和暂停的iPhone音乐应用程序并维护自己的播放列表.此应用程序不提供next/prev歌曲功能,因此我不希望这些按钮显示在iOS的控制中心(向上滑动屏幕)上.

我尝试了以下代码,使它们从那里消失:

MPRemoteCommandCenter *commandCenter = [MPRemoteCommandCenter sharedCommandCenter];

// Do not allow next/prev song command on remote control since this is not supported in app either
commandCenter.nextTrackCommand.enabled = NO;
commandCenter.previousTrackCommand.enabled = NO;
[commandCenter.nextTrackCommand addTarget:self action: @selector(emptyFunction)];
[commandCenter.previousTrackCommand addTarget:self action: @selector(emptyFunction)];
Run Code Online (Sandbox Code Playgroud)

这不起作用:应用程序的音乐是否正在播放,这两个按钮仍然显示在上滑屏幕中,并且它们不会显示为灰色,并且它们确实起作用(虽然不正确,但这是无关的).

我应该如何让它们消失?

iphone remote-control audio-player mpmusicplayercontroller ios

6
推荐指数
0
解决办法
732
查看次数