【问题标题】:HTMLAudioElement Audio Not Playing on iOS (Ionic App)HTMLAudioElement 音频未在 iOS 上播放(Ionic 应用程序)
【发布时间】:2016-07-13 16:25:14
【问题描述】:

我正在使用 Xcode 8 和 Ionic。我可以在 Android 上播放音频,但不能在 iOS 上播放。 Xcode 的日志是这样写的:

2016-07-13 18:19:44.802014 SpotShuffle[830:104683] [] <<<< FIGSANDBOX >>>> Path </private/var/mobile/Containers/Data/Application/EC634407-1752-4EE2-814E-B88353EA36B0/tmp/MediaCache> could not be converted by realpath() (requires all elements of path are present)

2016-07-13 18:19:44.803145 SpotShuffle[830:104683] [] __InternalSandboxRegisterURL_block_invoke signalled err=-12780 (kFigBaseObjectError_ParamErr) (Could not obtain realpath for specified URL) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/EmbeddedCoreMediaFramework/EmbeddedCoreMedia-1847.11.1/Prototypes/Player/ClientServer/FigSandboxSupport.c line 590

你有什么建议吗?

【问题讨论】:

  • 问题解决了吗?我也面临同样的问题。

标签: ios html ionic-framework xcode8


【解决方案1】:

我在尝试在 iOS 10 beta 2 中播放视频时遇到了类似的错误。

“无法获取指定 URL 的真实路径”

ObtainAndRegisterSandboxExtensionForPath signalled err=-12780 (kFigBaseObjectError_ParamErr) (Could not obtain realpath for specified URL) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/EmbeddedCoreMediaFramework/EmbeddedCoreMedia-1873/Prototypes/Player/ClientServer/FigSandboxSupport.c line 486

我的猜测是文件中的某处是以“//:”而不是“http//:”开头的 URL。 Web 浏览器将从页面 URL 中获取正确的 URL 协议。在 Ionic 和 Cordova 中,页面协议是“file://”,这可能会破坏 realpath 库。

【讨论】:

    【解决方案2】:

    尝试将您的音频文件转换为 base64

    mySound = new Audio("data:audio/mp3;base64,//uQBAAAAAA....    ..qq");  
    collectSound.play();
    

    它可能会起作用。但是它也可以打开系统播放器。需要找到一种方法来保留您的应用程序的上下文

    【讨论】:

      猜你喜欢
      • 2019-01-16
      • 2014-06-11
      • 1970-01-01
      • 2021-07-16
      • 2017-05-30
      • 1970-01-01
      • 2021-01-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多