1

I have a weird error with jwplayer.

I configure it from a Angular JS Controller and load it with a simple preview button which loads the jwplayer with the requested conf.

As simple as this.

jwplayer(id).setup(config);

I have a skin and the skin colors (active, inactive, background) configured.

The issue happens when I click the preview button. Sometimes the player loads with the correct colors and sometimes the player loads with the default skin colors.

Every other jwplayer property get loaded correctly. If I change the skin model it will always load that model but will have the same issue with the colors.

I ran a jwplayer(attribute_id).getConfig() to check which conf has been loaded in both cases and they are exactly the same.

So how is it possible the jwplayer has the skin colors loaded but they don't work in some cases?

Skin related conf obtained from the js api:

skin: "seven"
skinColorActive: "#FFFFFF"
skinColorBackground: "#3B0239"
skinColorInactive: "#EE2A7B"
skinUrl: undefined

The player's version I am using is the 7.4.3

UPDATE

I figured out the issue. I have a function to random generate (number and characters) jwplayer id's in case I have a couple of jwplayers in the same page they have different ids.

Every time I generated a new jwplayer it would use a different id. So I noticed the colors weren't working when the jwplayer id was starting with a number.

ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").

So for some reason although the JQuery selector was wrong, just the colors weren't working, the rest of the setup was working fine.

I assume the CSS couldn't work with a wrong id selector and that's why the colors wouldn't show up...

4

2 回答 2

1

皮肤更改在您的 CSS 文件或<style></style>标题中的标签中实现。看起来您的配置文件正试图将它们拉入 JavaScript 播放器设置。以下是设计和实现自己的皮肤的指南:https ://developer.jwplayer.com/jw-player/docs/developer-guide/customization/css-skinning/skins_creating/

此外,我会确保您在调用皮肤更改时引用 JavaScript API 中定义的正确播放状态(空闲、缓冲、播放、暂停):https ://developer.jwplayer.com/jw-player /docs/developer-guide/api/javascript_api_reference/#playback

于 2016-06-06T19:52:28.817 回答
0

我弄清楚了这个问题。我有一个随机生成(数字和字符)jwplayer id 的功能,以防我在同一页面中有几个 jwplayer 他们有不同的 id。

每次我生成一个新的 jwplayer 时,它都会使用不同的 id。所以我注意到当 jwplayer id 以数字开头时颜色不起作用。

ID 和 NAME 标记必须以字母 ([A-Za-z]) 开头,后跟任意数量的字母、数字 ([0-9])、连字符 ("-")、下划线 ("_") 、冒号 (":") 和句点 (".")。

因此,出于某种原因,尽管 JQuery 选择器错误,只是颜色不起作用,其余设置工作正常。

我假设 CSS 不能使用错误的 id 选择器,这就是颜色不会显示的原因......

于 2017-09-25T08:54:17.880 回答