Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/20230417 add watermark to video #104

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions example/macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
import FlutterMacOS
import Foundation

import screen_brightness_macos
import wakelock_macos

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
ScreenBrightnessMacosPlugin.register(with: registry.registrar(forPlugin: "ScreenBrightnessMacosPlugin"))
WakelockMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockMacosPlugin"))
}
3 changes: 3 additions & 0 deletions example/windows/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

#include "generated_plugin_registrant.h"

#include <screen_brightness_windows/screen_brightness_windows_plugin.h>

void RegisterPlugins(flutter::PluginRegistry* registry) {
ScreenBrightnessWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("ScreenBrightnessWindowsPlugin"));
}
1 change: 1 addition & 0 deletions example/windows/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#

list(APPEND FLUTTER_PLUGIN_LIST
screen_brightness_windows
)

list(APPEND FLUTTER_FFI_PLUGIN_LIST
Expand Down
1 change: 1 addition & 0 deletions lib/src/controllers/pod_getx_video_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class PodGetXVideoController extends _PodGesturesController {
bool controllerInitialized = false;
late PodPlayerConfig podPlayerConfig;
late PlayVideoFrom playVideoFrom;
Widget? waterMark;
void config({
required PlayVideoFrom playVideoFrom,
required PodPlayerConfig playerConfig,
Expand Down
2 changes: 1 addition & 1 deletion lib/src/models/pod_progress_bar_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class PodProgressBarConfig {
this.getBufferedPaint,
this.getCircleHandlerPaint,
this.getBackgroundPaint,
this.height = 3.6,
this.height = 5,
this.padding = EdgeInsets.zero,
this.circleHandlerRadius = 8,
this.curveRadius = 4,
Expand Down
16 changes: 5 additions & 11 deletions lib/src/pod_player.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import 'dart:async';
import 'dart:ui';

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'package:lottie/lottie.dart';
import 'package:screen_brightness/screen_brightness.dart';
import 'package:universal_html/html.dart' as _html;

import '../pod_player.dart';
Expand All @@ -14,21 +14,13 @@ import 'utils/logger.dart';
import 'widgets/material_icon_button.dart';

part 'widgets/animated_play_pause_icon.dart';

part 'widgets/core/overlays/mobile_bottomsheet.dart';

part 'widgets/core/overlays/mobile_overlay.dart';

part 'widgets/core/overlays/overlays.dart';

part 'widgets/core/overlays/web_dropdown_menu.dart';

part 'widgets/core/overlays/web_overlay.dart';

part 'widgets/core/pod_core_player.dart';

part 'widgets/core/video_gesture_detector.dart';

part 'widgets/full_screen_view.dart';

class PodVideoPlayer extends StatefulWidget {
Expand All @@ -45,7 +37,7 @@ class PodVideoPlayer extends StatefulWidget {
final Widget? videoTitle;
final Color? backgroundColor;
final DecorationImage? videoThumbnail;

final Widget? waterMark;
/// Optional callback, fired when full screen mode toggles.
///
/// Important: If this method is set, the configuration of [DeviceOrientation]
Expand All @@ -59,6 +51,7 @@ class PodVideoPlayer extends StatefulWidget {
PodVideoPlayer({
Key? key,
required this.controller,
this.waterMark,
this.frameAspectRatio = 16 / 9,
this.videoAspectRatio = 16 / 9,
this.alwaysShowProgressBar = true,
Expand Down Expand Up @@ -91,7 +84,8 @@ class PodVideoPlayer extends StatefulWidget {
..videoTitle = videoTitle
..onToggleFullScreen = onToggleFullScreen
..onLoading = onLoading
..videoThumbnail = videoThumbnail;
..videoThumbnail = videoThumbnail
..waterMark = waterMark;
}

@override
Expand Down
3 changes: 3 additions & 0 deletions lib/src/utils/video_apis.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'package:youtube_explode_dart/youtube_explode_dart.dart';

import '../models/vimeo_models.dart';

String podErrorString(String val) {
Expand Down Expand Up @@ -104,7 +105,9 @@ class VideoApis {
),
),
);
urls.removeWhere((element) => element.quality == 144);
}

// Close the YoutubeExplode's http client.
yt.close();
return urls;
Expand Down
12 changes: 6 additions & 6 deletions lib/src/widgets/core/overlays/mobile_overlay.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ class _MobileOverlay extends StatelessWidget {
Expanded(
child: _VideoGestureDetector(
tag: tag,
onDoubleTap: _isRtl()
onDoubleTap: _isRtl(context)
? _podCtr.onRightDoubleTap
: _podCtr.onLeftDoubleTap,
child: ColoredBox(
color: overlayColor,
child: _LeftRightDoubleTapBox(
tag: tag,
isLeft: !_isRtl(),
isLeft: !_isRtl(context),
),
),
),
Expand All @@ -48,14 +48,14 @@ class _MobileOverlay extends StatelessWidget {
Expanded(
child: _VideoGestureDetector(
tag: tag,
onDoubleTap: _isRtl()
onDoubleTap: _isRtl(context)
? _podCtr.onLeftDoubleTap
: _podCtr.onRightDoubleTap,
child: ColoredBox(
color: overlayColor,
child: _LeftRightDoubleTapBox(
tag: tag,
isLeft: _isRtl(),
isLeft: _isRtl(context),
),
),
),
Expand Down Expand Up @@ -97,8 +97,8 @@ class _MobileOverlay extends StatelessWidget {
);
}

bool _isRtl() {
final Locale locale = window.locale;
bool _isRtl(BuildContext context) {
final Locale locale = Localizations.localeOf(context);
final langs = [
'ar', // Arabic
'fa', // Farsi
Expand Down
Loading