Skip to content
Merged
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
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
## v1.5.1

### Changelog

* Adjusted the playback control bar style in compact layout
* Clicking “Check update” in the Microsoft Store version redirects to the Store page
* Fixed forward and backward issues

### 更新日志

* 调整了紧凑布局下的播放控制栏样式
* 微软商店版本中点击检查更新将跳转至商店页面
* 修复了快退快进的问题

## v1.5.0

### Changelog
Expand Down
33 changes: 15 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

# IRIS - A lightweight video player

![ci](https://github.com/nini22P/iris/actions/workflows/ci.yml/badge.svg)
[![Build Status](https://github.com/nini22P/iris/actions/workflows/ci.yml/badge.svg)](https://github.com/nini22P/iris/actions/workflows/ci.yml)
<a href="https://apps.microsoft.com/detail/9NML7WNHNRTJ?referrer=appbadge&mode=direct"><img src="https://get.microsoft.com/images/en-us%20dark.svg" height="30"/></a>
<a href="https://afdian.com/a/nini22P"><img alt="Afdian" style="height: 30px;" src="https://pic1.afdiancdn.com/static/img/welcome/button-sponsorme.png"></a>
[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/nini22p)

Expand All @@ -18,18 +19,14 @@ English | [中文](./README_CN.md)

## Download

### Windows

- [IRIS-windows-installer.exe](https://github.com/nini22P/iris/releases/latest/download/IRIS-windows-installer.exe)
- [IRIS-windows.zip](https://github.com/nini22P/iris/releases/latest/download/IRIS-windows.zip)

### Android

| Architecture | Download Link |
| ------------ | ------------------------------------------------------------------------------------------------------------------ |
| arm64-v8a | [IRIS-android-arm64-v8a.apk](https://github.com/nini22P/iris/releases/latest/download/IRIS-android-arm64-v8a.apk) |
| armeabi-v7a | [IRIS-android-armeabi-v7a.apk](https://github.com/nini22P/iris/releases/latest/download/IRIS-android-armeabi-v7a.apk) |
| x86_64 | [IRIS-android-x86_64.apk](https://github.com/nini22P/iris/releases/latest/download/IRIS-android-x86_64.apk) |
| Platform | Arch/Channel | Download Link | Notes |
| :------- | :---------------- | :----------------------------------------------------------------------------------------------------------------- | :--------------------- |
| Windows | **Microsoft Store** | [Microsoft Store](https://apps.microsoft.com/detail/9NML7WNHNRTJ) | **Recommended**, auto-updates |
| | Installer | [IRIS-windows-installer.exe](https://github.com/nini22P/iris/releases/latest/download/IRIS-windows-installer.exe) | |
| | Portable | [IRIS-windows.zip](https://github.com/nini22P/iris/releases/latest/download/IRIS-windows.zip) | Unzip and run |
| Android | arm64-v8a | [IRIS-android-arm64-v8a.apk](https://github.com/nini22P/iris/releases/latest/download/IRIS-android-arm64-v8a.apk) | For 64-bit devices |
| | armeabi-v7a | [IRIS-android-armeabi-v7a.apk](https://github.com/nini22P/iris/releases/latest/download/IRIS-android-armeabi-v7a.apk) | For 32-bit devices |
| | x86_64 | [IRIS-android-x86_64.apk](https://github.com/nini22P/iris/releases/latest/download/IRIS-android-x86_64.apk) | For emulators/x86 devices |

## Keyboard and Gesture Controls

Expand All @@ -38,8 +35,8 @@ English | [中文](./README_CN.md)
| Key | Description |
| ---------------------- | -------------------------------------------------- |
| `Space` | Play / Pause / Select file |
| `Arrow Left` | Fast backward 10 seconds |
| `Arrow Right` | Fast forward 10 seconds |
| `Arrow Left` | Fast backward |
| `Arrow Right` | Fast forward |
| `Arrow Up` | Volume up |
| `Arrow Down` | Volume down |
| `Ctrl + Arrow Left` | Previous |
Expand Down Expand Up @@ -70,12 +67,12 @@ English | [中文](./README_CN.md)
| --------------------------------- | ----------------------------- |
| Tap | Select an item or open a menu |
| Double tap center | Play / Pause |
| Double tap left side | Fast backward 10 seconds |
| Double tap right side | Fast forward 10 seconds |
| Double tap left side | Fast backward |
| Double tap right side | Fast forward |
| Swipe left / right | Adjust playback progress |
| Swipe up / down on left side | Adjust screen brightness |
| Swipe up / down on right side | Adjust device volume |
| Long press | Start speed playback |
| Long press | Display Playback Speed Selector |
| Long press and swipe left / right | Adjust speed playback speed |

## Contribution
Expand Down
35 changes: 16 additions & 19 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

# IRIS - 轻量级视频播放器

![ci](https://github.com/nini22P/iris/actions/workflows/ci.yml/badge.svg)
[![Build Status](https://github.com/nini22P/iris/actions/workflows/ci.yml/badge.svg)](https://github.com/nini22P/iris/actions/workflows/ci.yml)
<a href="https://apps.microsoft.com/detail/9NML7WNHNRTJ?referrer=appbadge&mode=direct"><img src="https://get.microsoft.com/images/zh-cn%20dark.svg" height="30"/></a>
<a href="https://afdian.com/a/nini22P"><img alt="爱发电" style="height: 30px;" src="https://pic1.afdiancdn.com/static/img/welcome/button-sponsorme.png"></a>
[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/nini22p)

Expand All @@ -18,18 +19,14 @@

## 下载

### Windows

- [IRIS-windows-installer.exe](https://github.com/nini22P/iris/releases/latest/download/IRIS-windows-installer.exe)
- [IRIS-windows.zip](https://github.com/nini22P/iris/releases/latest/download/IRIS-windows.zip)

### Android

| 设备架构 | 下载链接 |
| ----------- | ------------------------------------------------------------------------------------------------------------------ |
| arm64-v8a | [IRIS-android-arm64-v8a.apk](https://github.com/nini22P/iris/releases/latest/download/IRIS-android-arm64-v8a.apk) |
| armeabi-v7a | [IRIS-android-armeabi-v7a.apk](https://github.com/nini22P/iris/releases/latest/download/IRIS-android-armeabi-v7a.apk) |
| x86_64 | [IRIS-android-x86_64.apk](https://github.com/nini22P/iris/releases/latest/download/IRIS-android-x86_64.apk) |
| 平台 | 架构/渠道 | 下载链接 | 备注 |
| :------ | :------------ | :----------------------------------------------------------------------------------------------------------------- | :--------------- |
| Windows | **微软商店** | [Microsoft Store](https://apps.microsoft.com/detail/9NML7WNHNRTJ) | **推荐**,自动更新 |
| | 安装包 | [IRIS-windows-installer.exe](https://github.com/nini22P/iris/releases/latest/download/IRIS-windows-installer.exe) | |
| | 便携版 | [IRIS-windows.zip](https://github.com/nini22P/iris/releases/latest/download/IRIS-windows.zip) | 解压即用 |
| Android | arm64-v8a | [IRIS-android-arm64-v8a.apk](https://github.com/nini22P/iris/releases/latest/download/IRIS-android-arm64-v8a.apk) | 64位设备 |
| | armeabi-v7a | [IRIS-android-armeabi-v7a.apk](https://github.com/nini22P/iris/releases/latest/download/IRIS-android-armeabi-v7a.apk) | 32位设备 |
| | x86_64 | [IRIS-android-x86_64.apk](https://github.com/nini22P/iris/releases/latest/download/IRIS-android-x86_64.apk) | 模拟器/x86设备 |

## 键位和手势

Expand All @@ -38,8 +35,8 @@
| 键位 | 描述 |
| ---------------------- | ------------------------------------ |
| `Space` | 播放 / 暂停 / 选择文件 |
| `Arrow Left` | 快退 10 秒 |
| `Arrow Right` | 快进 10 秒 |
| `Arrow Left` | 快退 |
| `Arrow Right` | 快进 |
| `Arrow Up` | 提升音量 |
| `Arrow Down` | 降低音量 |
| `Ctrl + Arrow Left` | 上一个 |
Expand Down Expand Up @@ -70,13 +67,13 @@
| ---------------- | ------------------ |
| 单击 | 选择项目或打开菜单 |
| 双击屏幕中心 | 播放 / 暂停 |
| 双击屏幕左侧 | 快退 10 秒 |
| 双击屏幕右侧 | 快进 10 秒 |
| 双击屏幕左侧 | 快退 |
| 双击屏幕右侧 | 快进 |
| 左右滑动 | 调整播放进度 |
| 屏幕左侧上下滑动 | 调整屏幕亮度 |
| 屏幕右侧上下滑动 | 调整设备音量 |
| 长按 | 启动倍速播放 |
| 长按后左右滑动 | 调整倍速播放的速度 |
| 长按 | 显示播放速度选择器 |
| 长按后左右滑动 | 调整播放速度 |

## 贡献

Expand Down
2 changes: 1 addition & 1 deletion inno.iss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "IRIS"
#define MyAppVersion "1.5.0"
#define MyAppVersion "1.5.1"
#define MyAppPublisher "nini22P"
#define MyAppURL "https://github.com/nini22P/iris"
#define MyAppExeName "iris.exe"
Expand Down
3 changes: 1 addition & 2 deletions lib/hooks/use_app_lifecycle.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ import 'package:provider/provider.dart';

void useAppLifecycle() {
final context = useContext();
final saveProgress = context.read<MediaPlayer>().saveProgress;

AppLifecycleState? appLifecycleState = useAppLifecycleState();

useEffect(() {
try {
if (appLifecycleState == AppLifecycleState.paused) {
logger('App lifecycle state: paused');
saveProgress();
context.read<MediaPlayer>().saveProgress();
}
} catch (e) {
logger('App lifecycle state error: $e');
Expand Down
19 changes: 7 additions & 12 deletions lib/hooks/use_cover.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,11 @@ FileItem? useCover() {
final currentIndex =
usePlayQueueStore().select(context, (state) => state.currentIndex);

final int currentPlayIndex = useMemoized(
() => playQueue.indexWhere((element) => element.index == currentIndex),
[playQueue, currentIndex]);

final FileItem? file = useMemoized(
() => playQueue.isEmpty || currentPlayIndex < 0
? null
: playQueue[currentPlayIndex].file,
[playQueue, currentPlayIndex]);
final FileItem? file = useMemoized(() {
final index =
playQueue.indexWhere((element) => element.index == currentIndex);
return playQueue.isEmpty || index < 0 ? null : playQueue[index].file;
}, [playQueue, currentIndex]);

final localStoragesFuture =
useMemoized(() async => await getLocalStorages(context), []);
Expand Down Expand Up @@ -52,9 +48,8 @@ FileItem? useCover() {

final files = await storage.getFiles(dir);

final images = files
.where((file) => [ContentType.image].contains(file.type))
.toList();
final images =
files.where((file) => file.type == ContentType.image).toList();

cover.value = images.firstWhereOrNull((image) =>
image.name.split('.').first.toLowerCase() == 'cover') ??
Expand Down
41 changes: 21 additions & 20 deletions lib/hooks/use_gesture.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:flutter_volume_controller/flutter_volume_controller.dart';
import 'package:iris/globals.dart' show speedStops, speedSelectorItemWidth;
import 'package:iris/hooks/use_brightness.dart';
import 'package:iris/hooks/use_volume.dart';
Expand Down Expand Up @@ -31,7 +32,6 @@ class Gesture {
final bool isRightGesture;
final double? brightness;
final double? volume;
final MouseCursor cursor;

Gesture({
required this.onTapDown,
Expand All @@ -51,7 +51,6 @@ class Gesture {
required this.isRightGesture,
required this.brightness,
required this.volume,
required this.cursor,
});
}

Expand All @@ -65,8 +64,6 @@ Gesture useGesture({
}) {
final context = useContext();

final player = context.read<MediaPlayer>();

final gestureState = useRef({
'isTouch': false,
'isLongPress': false,
Expand Down Expand Up @@ -97,20 +94,22 @@ Gesture useGesture({
}

void onDoubleTapDown(TapDownDetails details) {
final player = context.read<MediaPlayer>();

if (details.kind == PointerDeviceKind.touch) {
final screenWidth = MediaQuery.sizeOf(context).width;
final tapDx = details.globalPosition.dx;

if (tapDx > screenWidth * 0.7) {
// 右侧 30%
if (tapDx > screenWidth * 0.75) {
// 右侧 25%
showProgress();
player.forward(10);
} else if (tapDx < screenWidth * 0.3) {
// 左侧 30%
} else if (tapDx < screenWidth * 0.25) {
// 左侧 25%
showProgress();
player.backward(10);
} else {
// 中间 40%
// 中间 50%
if (player.isPlaying) {
useAppStore().updateAutoPlay(false);
player.pause();
Expand All @@ -128,7 +127,8 @@ Gesture useGesture({
}

void onLongPressStart(LongPressStartDetails details) {
if (gestureState.value['isTouch'] as bool && player.isPlaying) {
if (gestureState.value['isTouch'] as bool &&
context.read<MediaPlayer>().isPlaying) {
gestureState.value['isLongPress'] = true;
gestureState.value['startPanOffset'] = details.globalPosition;

Expand Down Expand Up @@ -206,7 +206,8 @@ Gesture useGesture({
gestureState.value['isTouch'] = true;
gestureState.value['isDragging'] = true;
gestureState.value['startPanOffset'] = details.globalPosition;
gestureState.value['startSeekPosition'] = player.position;
gestureState.value['startSeekPosition'] =
context.read<MediaPlayer>().position;
gestureState.value['panDirection'] = null;
isLeftGesture.value = false;
isRightGesture.value = false;
Expand Down Expand Up @@ -246,9 +247,10 @@ Gesture useGesture({
int targetSeconds = (startSeconds + seekSecondsOffset).round();

// 边界检查
targetSeconds = targetSeconds.clamp(0, player.duration.inSeconds);
targetSeconds = targetSeconds.clamp(
0, context.read<MediaPlayer>().duration.inSeconds);

player.seek(Duration(seconds: targetSeconds));
context.read<MediaPlayer>().seek(Duration(seconds: targetSeconds));
showProgress();
}

Expand All @@ -259,6 +261,10 @@ Gesture useGesture({
isLeftGesture.value =
startOffset.dx < MediaQuery.sizeOf(context).width / 2;
isRightGesture.value = !isLeftGesture.value;

if (isRightGesture.value) {
FlutterVolumeController.updateShowSystemUI(false);
}
}

final double dy = details.delta.dy;
Expand Down Expand Up @@ -287,6 +293,8 @@ Gesture useGesture({
};
isLeftGesture.value = false;
isRightGesture.value = false;

FlutterVolumeController.updateShowSystemUI(true);
}

void onPanEnd(DragEndDetails details) => _resetPanState();
Expand All @@ -299,12 +307,6 @@ Gesture useGesture({
}
}

final cursor = useMemoized(() {
return player.isPlaying == false
? SystemMouseCursors.basic
: SystemMouseCursors.none;
}, [player.isPlaying]);

return Gesture(
onTapDown: onTapDown,
onTap: onTap,
Expand All @@ -323,6 +325,5 @@ Gesture useGesture({
isRightGesture: isRightGesture.value,
brightness: brightness.value,
volume: volume.value,
cursor: cursor,
);
}
16 changes: 8 additions & 8 deletions lib/hooks/use_keyboard.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:iris/globals.dart';
import 'package:iris/models/player.dart';
import 'package:iris/models/storages/local.dart';
import 'package:iris/pages/player/overlays/history.dart';
import 'package:iris/pages/player/overlays/play_queue.dart';
import 'package:iris/pages/player/overlays/track/subtitle_and_audio_track.dart';
import 'package:iris/pages/settings/settings.dart';
import 'package:iris/pages/storages/storages.dart';
import 'package:iris/widgets/popups/history.dart';
import 'package:iris/widgets/popups/play_queue.dart';
import 'package:iris/widgets/popups/track/subtitle_and_audio_track.dart';
import 'package:iris/widgets/popups/settings/settings.dart';
import 'package:iris/widgets/popups/storages/storages.dart';
import 'package:iris/store/use_app_store.dart';
import 'package:iris/store/use_play_queue_store.dart';
import 'package:iris/store/use_player_ui_store.dart';
Expand All @@ -28,9 +28,9 @@ KeyboardEvent useKeyboard({
}) {
final context = useContext();

final player = context.read<MediaPlayer>();

void onKeyEvent(KeyEvent event) async {
final player = context.read<MediaPlayer>();

if (event.runtimeType == KeyDownEvent) {
if (HardwareKeyboard.instance.isAltPressed) {
switch (event.logicalKey) {
Expand Down Expand Up @@ -138,7 +138,7 @@ KeyboardEvent useKeyboard({
case LogicalKeyboardKey.space:
case LogicalKeyboardKey.mediaPlayPause:
showControl();
if (context.read<MediaPlayer>().isPlaying) {
if (player.isPlaying) {
useAppStore().updateAutoPlay(false);
player.pause();
} else {
Expand Down
2 changes: 0 additions & 2 deletions lib/hooks/use_volume.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,13 @@ ValueNotifier<double?> useVolume(bool isGesture) {
try {
() async {
if (!isGesture) return;
await FlutterVolumeController.updateShowSystemUI(false);
volume.value = await FlutterVolumeController.getVolume();
}();
} catch (e) {
logger('Error getting volume: $e');
}
return () {
volume.value = null;
FlutterVolumeController.updateShowSystemUI(true);
};
}, [isGesture]);

Expand Down
Loading