Giter Club home page Giter Club logo

Comments (6)

zbby1987 avatar zbby1987 commented on July 17, 2024

也可以通过类似adblock/油猴脚本的方法,直接屏蔽掉无关内容的加载
把所有与视频无关的内容,都当广告直接过滤掉,不加载就行了。。。

from cctv_viewer.

matrix3d avatar matrix3d commented on July 17, 2024

https://github.com/matrix3d/CCTV_Viewer/releases/tag/tagv23
此版本已删除图片加载

  1. 使用 Webview 的 WebViewClient 类来控制加载。
  2. 重写 WebViewClient#shouldInterceptRequest() 方法来拦截加载请求。
  3. 检查请求的 URL,如果是要加载图像,则返回 WebResourceResponse 对象来阻止加载。
  4. WebResourceResponse 对象中设置 data 属性为空,以防止加载图像。
@Override
public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) {
    String url = request.getUrl().toString();
    if (url.endsWith(".png") || url.endsWith(".jpg") || url.endsWith(".jpeg")) {
        return new WebResourceResponse("image/gif", "UTF-8", new ByteArrayInputStream(new byte[0]));
    }
    return super.shouldInterceptRequest(view, request);
}
  1. 也可以使用 WebView#getSettings() 方法来设置 blockNetworkImage 属性为 true,以阻止加载所有图像。
WebView webView = (WebView) findViewById(R.id.webView);
WebSettings webSettings = webView.getSettings();
webSettings.setBlockNetworkImage(true);

from cctv_viewer.

zbby1987 avatar zbby1987 commented on July 17, 2024

https://github.com/matrix3d/CCTV_Viewer/releases/tag/tagv23 此版本已删除图片加载

是不是可以考虑,把播放器和视频外的所有内容都给不加载?
这样速度肯定更快

from cctv_viewer.

zbby1987 avatar zbby1987 commented on July 17, 2024

经在手机上测试,
webview屏蔽图片的方法,确实速度快了!
效果视频:https://share.feijipan.com/s/BlUuxIDi
@Eanya-Tonic 能否给x5也加一个!!!

在手机上长按屏幕,还会出现选台菜单。这样手机也能测了!
同时播放器底部控制栏里的全屏切换的按钮也消失不见了,手机因为基本秒变全屏,又没退出全屏的按钮显示,手机上就无法看到屏蔽图片后的网页长什么样子。(后续在电视上看到了,就是不知怎么退出全屏)
.
另外,主版本加了体验优化的变动,希望分支版也能尽快加上。
比如
★能看到运行在哪个内核及其对应的版本号上!
★强制只使用x5且支持安卓4的版本,
★多行多列的选台列表 或 二级选台列表
★视频清晰度选择
.
明显的错误:
第1个**一台明明是央视频,不是央视网!
第2个**一台才是央视网!
(话说顶部央视频和央视网两个**1还是好评的,毕竟央视网的**一老是因为版权问题停播)
.
Bug:
a.如果已经选了央视频的某个台,就无法再切换到央视频的其他台!
b.在电视上,选台弹窗的弹出响应时间太长,按完确定键要很久才会弹出来!这是老毛病了!
.
体验优化项:
经过验证对比,还是先让播放起来 ,再进行视频全屏更好。
这样给人的感觉也更流畅!
也不会一直在全屏播放器界面显示一个暂停按钮的无图叉号!
刚开始在手机上测,基本都秒开,还没感觉。
电视上测时,切台速度没手机那么快,播放器先全屏再播放的话,会给人感觉慢了些!
.
但这样全屏后再播放,可能一步完成了再操作下一步的方式,对低性能设备更友好些!不容易卡死

from cctv_viewer.

zbby1987 avatar zbby1987 commented on July 17, 2024

https://github.com/matrix3d/CCTV_Viewer/releases/tag/tagv23 此版本已删除图片加载

这个版本里的第一个频道:央视频的**1,清晰度比较差,
是因为用的960x540p来保证开机后的绝对流畅么?
但右下角显示的是蓝光1080p!
其实可以考虑在设置弹窗里里搞个1280x720p和1920x1080p的选择吧?

from cctv_viewer.

zbby1987 avatar zbby1987 commented on July 17, 2024

https://github.com/matrix3d/CCTV_Viewer/releases/tag/tagv23 此版本已删除图片加载

  1. 使用 Webview 的 WebViewClient 类来控制加载。
  2. 重写 WebViewClient#shouldInterceptRequest() 方法来拦截加载请求。
  3. 检查请求的 URL,如果是要加载图像,则返回 WebResourceResponse 对象来阻止加载。
  4. WebResourceResponse 对象中设置 data 属性为空,以防止加载图像。
@Override
public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) {
    String url = request.getUrl().toString();
    if (url.endsWith(".png") || url.endsWith(".jpg") || url.endsWith(".jpeg")) {
        return new WebResourceResponse("image/gif", "UTF-8", new ByteArrayInputStream(new byte[0]));
    }
    return super.shouldInterceptRequest(view, request);
}
  1. 也可以使用 WebView#getSettings() 方法来设置 blockNetworkImage 属性为 true,以阻止加载所有图像。
WebView webView = (WebView) findViewById(R.id.webView);
WebSettings webSettings = webView.getSettings();
webSettings.setBlockNetworkImage(true);

@matrix3d @Eanya-Tonic
我突然反应过来,你这就是浏览器里都能开启的无图模式啊。。。。
x5和webview肯定都是现成支持这个的!
在这个基础上,是不是还可以再屏蔽点东西去加速!?!?

from cctv_viewer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.