Chrome阻止了“视频”标签的autoplay
属性。
这是chrome_content_browser_client.cc
中的代码:
bool IsAutoplayAllowedByPolicy(content::WebContents* contents,
PrefService* prefs) {
DCHECK(prefs);
// Check if we have globally allowed autoplay by policy.
if (prefs->GetBoolean(prefs::kAutoplayAllowed) &&
prefs->IsManagedPreference(prefs::kAutoplayAllowed)) {
return true;
}
if (!contents)
return false;
// Check if the current URL matches a URL pattern on the whitelist.
const base::ListValue* autoplay_whitelist =
prefs->GetList(prefs::kAutoplayWhitelist);
return autoplay_whitelist &&
prefs->IsManagedPreference(prefs::kAutoplayWhitelist) &&
IsURLWhitelisted(contents->GetURL(), autoplay_whitelist->GetList());
}
我们在这里可以看到,有些网站是白名单。
我试图从铬源代码中找到它们,但是失败了。 如何获得此列表?