JPlayer圈播放器不显示第一圈与VOX制作wav文件阵子 [英] JPlayer Circle Player does not show circle first time around with wav files made from vox

查看:292
本文介绍了JPlayer圈播放器不显示第一圈与VOX制作wav文件阵子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用JPlayer圈Player播放音频短为了转录应用程序。每个音频的源自作为已转换通过使用SoX为.wav一个.vox文件。当播放按钮是pressed,音频播放,但绿色圆圈不会显示。一旦剪辑发挥,pressing再次发挥确实显示绿色圆圈前进。

我认为这是因为无论是原来的VOX格式或WAV格式不包含任何长度的数据,这样的球员不知道,直到它试图播放。一旦学会了长度,圆可显示。

怎么可能这样被克服?可以圆玩家莫名其妙preLOAD音频播放之前,以确定它的长度?是否有不同的东西,我可以在红袜转换做?将转换为WAV比更好地工作以外的东西? JPlayer劝告反对使用WAV但没有说为什么,它起着除了这不够好。

还是有别的东西,我做错了吗?

更新1:读取原始.vox文件并soxi转换的.wav文件后,它会出现在两个地方的时间数据存在,因此没有理由提前玩家可以不知道此事。因此,转换似乎是摆脱困境的罪魁祸首。

更新2:
我加了一些JPlayer的事件处理程序等待load​​edmetadata和娱乐事件,显示了上面清楚地描述问题pretty。

  $(#jquery_jplayer)。绑定($。jPlayer.event.loadedmetadata,函数(事件){//添加一个监听器日志上载时间
    的console.log(等待load​​edmetadata:该音频存在的持续时间+ event.jPlayer.status.duration +秒);
    });$(#jquery_jplayer)。绑定($。jPlayer.event.play,函数(事件){//添加一个监听器登录游戏时间
    的console.log(玩:该音频具有的持续时间+ event.jPlayer.status.duration +秒);
    });

这产生在日志下面的输出:

 等待load​​edmetadata:该音频具有0秒的持续时间。
玩法:这个声音具有0秒的持续时间。
玩法:这个声音有10.72秒的持续时间。

指示的持续时间是未知的,直到第一个通关

更新3:回缩更新1:虽然soxi在某种程度上能够从文件,这并不一定意味着HTML5的浏览器能够做到持续提取数据。不同的算法可以是在那里发生。转换回来上了钩。我看不出它如何能成为其他东西。

我想这可能是因为圈球员住一个模态对话框里面,但是当调用模式对话框的页面加载和仅在显示模式对话框被媒体加载的实例化。我改变了一个更清洁的设计,其中圆播放器实例显示模态对话框每次和那个时候加载的介质(当模态消失破坏),但问题仍然存在。

样本文件

测试

下载示例文件。这是一个10秒的剪辑中的前几秒钟有些隐隐的随机噪声,然后在大约7或8秒大关,一个女声说第一个和最后一个名字。


解决方案

  

原因


有为何播放机无法播放.WAV文件多种原因。根据您的描述,玩家的可以播放.wav文件后第二次点击,看来你可能加载您.WAV太早球员被初始化之前的文件。


  

注意


按照文档


  

WAV格式是由许多HTML5的浏览器支持。我们建议您避免它虽然为对应的格式。推荐的编码选项:


  
  

      
  • 8位和16位线性PCM

  •   
  • 只有codeC1(PCM)的支持。

  •   

如果可能,我会建议使用.MP3格式,而不是因为它有通过桌面/移动浏览器更广泛的支持。

同时请注意,你需要指定供应:WAV以播放.wav文件


  

DEMO


请参阅本的jsfiddle ,在jPlayer圈玩家玩你已经.WAV文件示范上传。

我是能够发挥在Firefox,Chrome和Safari中的.wav文件,而不是IE浏览器。这表明,这个问题是不与文件格式。

I have an application that is using the JPlayer Circle Player to play short audios for transcription purposes. Each of these audios originates as a .vox file that has been converted to .wav by SoX. When the Play button is pressed, the audio plays but the green circle does not display. Once the clip has played, pressing play again does show the green circle advancing.

I assume that this is because either the original vox format or the wav format does not contain any length data so that player doesn't know this until it tries to play it. Once it learns the length, the circle can display.

How might this be overcome? Can the circle player somehow preload the audio to determine its length before playing? Is there something different I could be doing in the SoX conversion? Would converting to something other than WAV work better? JPlayer counsels against using WAV but doesn't say why, and it plays well enough except for this.

Or is there something else I'm doing wrong?

UPDATE 1: after reading the original .vox file and the converted .wav file with soxi, it appears that duration data exists in both places, thus no reason the player cannot know this in advance. So conversion would seem to be off the hook as the culprit.

UPDATE 2: I added some JPlayer event handlers for the loadedmetadata and play events which shows pretty clearly the problem described above.

$("#jquery_jplayer").bind($.jPlayer.event.loadedmetadata , function(event) { // Add a listener log the duration on load
    console.log("loadedmetadata: this audio has a duration of " + event.jPlayer.status.duration + " seconds.");
    });

$("#jquery_jplayer").bind($.jPlayer.event.play , function(event) { // Add a listener log the duration on play
    console.log("play: this audio has a duration of " + event.jPlayer.status.duration + " seconds.");
    });

This produced the following output in the logs:

loadedmetadata: this audio has a duration of 0 seconds.
play: this audio has a duration of 0 seconds.
play: this audio has a duration of 10.72 seconds.

indicating that the duration isn't known until the first playthrough.

UPDATE 3: retracting UPDATE 1: Although soxi is somehow able to extract duration data from the file, that doesn't necessarily mean that the HTML5 browser is able to do so. A different algorithm may be in place there. The conversion is back on the hook. I can't see how it could be anything else.

I thought it might be because the Circle Player lives inside a modal dialog, but is instantiated when the page that invokes the modal dialog is loaded and only upon showing the modal dialog was the media loaded. I changed that to a cleaner design where the Circle Player is instantiated every time the modal dialog is shown and the media loaded at that time (and destroyed when the modal goes away), but the problem remains.

SAMPLE FILE

Download sample file for testing. It's a 10-second clip with some faint random noise in the first few seconds, then at about the 7 or 8 second mark, a female voice saying a first and last name.

解决方案

CAUSE

There are multiple reasons of why the player doesn't play .WAV files. Based on your description that the player can play .WAV file after second click, it seems that you may be loading your .WAV files too early before player has been initialized.

NOTES

According to the documentation:

The WAV format is supported by many HTML5 browsers. We recommend that you avoid it though as a counterpart format. The recommended encoding options are:

  • 8-bit and 16-bit linear PCM
  • Only codec "1" (PCM) is supported.

If possible I would recommend using .MP3 format instead as it has wider support by desktop/mobile browsers.

Also please note that you need to specify supplied: 'wav' in order to play .WAV files.

DEMO

See this jsFiddle for the demonstration of the jPlayer Circle Player playing the .WAV file you've uploaded.

I was able to play the .WAV file on Firefox, Chrome and Safari, but not IE. This shows that the problem is not with the file format.

这篇关于JPlayer圈播放器不显示第一圈与VOX制作wav文件阵子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆