const film_fix = function() { // This function will set cn_disable to the following values: // 0 == Apple device of a full supported browser (Chrome, Firefox, Edge), also Android // 1 == Device that cannot play HLS videos only MP4 // 2 == Device that cannot play any video at all cn_disable = -1; home_events = -1; const t = { ua: window.navigator.userAgent }; const u_agent = t.ua.toLowerCase(); const cn_disable_0_u_agents = [ "apple", "iphone", "ipad", "mac", "safari" ] const cn_disable_1_u_agents = [ "36kr", "acfun", "aliapp", "baidu", "bili", "buildup", "byte", "dingtalk", "himalaya", "ijkplayer", "imgotv", "iting", "keep", "kuai", "kwai", "live4iphone", "mango", "maoyan", "mgtv", "micromessenger", "migu", "mihome", "moji", "moo", "netease", "pgbm", "ppstream", "qbwebview", "qq", "qiyi", "qunar", "qyplayer", "smz", "sogou", "sohu", "sspai", "tencent", "ucbrowser", "variflight", "walkman", "windvane", "youdao", "youku", "yuedong", "zhihu", "kswebview", "weibo", "facebook", "pinterest", "snapchat", "yahoo", "naver", "kaokao", "toss", "instagram" ]; const cn_disable_2_u_agents = [ "iqoo", "ireader" ] const events_0_u_agents = [ "chrome", "crios", "firefox", "fxios", "edge", "android", "linux", "wechat", "weixin" ] // if Apple device then can play everything cn_disable_0_u_agents.some(agent => { if(u_agent.indexOf(agent) > -1) { if ((u_agent.indexOf("android") < 0) && (u_agent.indexOf("linux") < 0)) { cn_disable = 0; } } }) // if mp4 compatible app then set to mp4 if (cn_disable < 0) { cn_disable_1_u_agents.some(agent => { if(u_agent.indexOf(agent) > -1) { cn_disable = 1; } }) } // if lowest app don't play any video if (cn_disable < 0) { cn_disable_2_u_agents.some(agent => { if(u_agent.indexOf(agent) > -1) { cn_disable = 2; } }) } if (cn_disable <= 0) { home_events = 0; cn_disable_1_u_agents.some(agent => { if(u_agent.indexOf(agent) > -1) { home_events = 1; } }) cn_disable_2_u_agents.some(agent => { if(u_agent.indexOf(agent) > -1) { home_events = 1; } }) events_0_u_agents.some(agent => { if(u_agent.indexOf(agent) > -1) { home_events = 1; } }) } else { home_events = 1; } // default in case user agent has no match, roll to default website behavior (aka, do nothing) if (cn_disable === -1) cn_disable = 0; if (home_events === -1) home_events = 0; } window.onload = film_fix();