Skip to content

Commit

Permalink
fix durationBar and block google ads in video source
Browse files Browse the repository at this point in the history
  • Loading branch information
Predidit committed Jun 15, 2024
1 parent a877ad9 commit 41daee0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions lib/pages/player/player_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,9 @@ class _PlayerItemState extends State<PlayerItem> with WindowListener {
@override
void dispose() {
//player.dispose();
if (playerTimer != null) {
playerTimer!.cancel();
}
super.dispose();
}

Expand Down
4 changes: 2 additions & 2 deletions lib/pages/webview/webview_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class WebviewItemController {
var iframe = iframes[i];
var src = iframe.getAttribute('src');
if (src && src.trim() !== '' && src.includes('http')) {
if (src && src.trim() !== '' && src.includes('http') && !src.includes('googleads')) {
window.location.href = src;
JSBridgeDebug.postMessage(src);
break;
Expand All @@ -139,7 +139,7 @@ class WebviewItemController {
VideoBridgeDebug.postMessage('The number of video tags is' + videos.length);
for (var i = 0; i < videos.length; i++) {
var src = videos[i].getAttribute('src');
if (src && src.trim() !== '' && !src.startsWith('blob:')) {
if (src && src.trim() !== '' && !src.startsWith('blob:') && !src.includes('googleads')) {
VideoBridgeDebug.postMessage(src);
break;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/pages/webview_desktop/webview_desktop_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class WebviewDesktopItemController {
var iframe = iframes[i];
var src = iframe.getAttribute('src');
if (src && src.trim() !== '' && src.includes('http')) {
if (src && src.trim() !== '' && src.includes('http') && !src.includes('googleads')) {
window.chrome.webview.postMessage('iframeMessage:' + src);
window.location.href = src;
break;
Expand All @@ -116,7 +116,7 @@ class WebviewDesktopItemController {
var videos = document.querySelectorAll('video');
for (var i = 0; i < videos.length; i++) {
var src = videos[i].getAttribute('src');
if (src && src.trim() !== '' && !src.startsWith('blob:')) {
if (src && src.trim() !== '' && !src.startsWith('blob:') && !src.includes('googleads')) {
window.chrome.webview.postMessage('videoMessage:' + src);
}
}
Expand Down

0 comments on commit 41daee0

Please sign in to comment.