【问题标题】:NativeScript, Play sound mixed in with other app playing in backgroundNativeScript,播放与后台播放的其他应用程序混合的声音
【发布时间】:2019-01-21 12:51:54
【问题描述】:

如何让我的标签 NativeScript 应用程序与后台播放的其他应用程序混合播放?

我到处找,请帮忙!

【问题讨论】:

  • 您必须将 AVAudioSession 类别设置为 AVAudioSessionCategorySoloAmbient。如果您使用的是音频插件,则必须覆盖 these lines
  • 甜甜的!你能告诉我如何覆盖这些行吗?请
  • 我猜,你将不得不采取一个 fork 并将其作为可以在 AudioPlayerOptions 中传递的选项。
  • 哦..现在你在我头上说..哈哈。你能帮我解决这个问题吗?
  • 我迷路了,伙计。请帮助我更准确地做些什么

标签: ios audio webview nativescript


【解决方案1】:

我的解决方案。在 app.js 中添加这一行

  var audioSession = AVAudioSession.sharedInstance();
  try {
    audioSession.setCategoryError(AVAudioSessionCategoryAmbient);
    audioSession.setActiveError(true);
  } catch(err) {
    console.log("setting audioSession category failed");
  }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-04-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多