|
@@ -435,14 +435,34 @@
|
|
|
|
|
|
// 处理页面可见属性的改变
|
|
|
document.addEventListener("visibilitychange", function () {
|
|
|
- console.log(document[hidden]);
|
|
|
- if (document[hidden]) {
|
|
|
- quit();
|
|
|
- ws.close();
|
|
|
- wsss.close();
|
|
|
+
|
|
|
+ if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
|
|
|
+ visibilitychange();
|
|
|
+ } else if (window.__wxjs_environment === 'miniprogram') {
|
|
|
+ visibilitychange();
|
|
|
+ } else {
|
|
|
+ if (document[hidden]) {
|
|
|
+ ws.close();
|
|
|
+ wsss.close();
|
|
|
+ uni.webView.navigateTo({
|
|
|
+ url: '/pages/index/index'
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
}, false);
|
|
|
|
|
|
+ function visibilitychange() {
|
|
|
+ if (document.visibilityState == "visible") {
|
|
|
+ var buffer = RequestIFrame();
|
|
|
+ ws.send(buffer);
|
|
|
+ isVisuable = true;
|
|
|
+ } else {
|
|
|
+ isVisuable = false;
|
|
|
+ isFeed = false;
|
|
|
+ myVideo.pause();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
myVideo.addEventListener('pause', function () {
|
|
|
isFeed = false;
|
|
|
});
|