Skip to content

Commit e6e8888

Browse files
authored
Merge pull request #202 from tobexyz/feat/ui2
Feat/ui2
2 parents 7c678f2 + 9009238 commit e6e8888

74 files changed

Lines changed: 1844 additions & 325 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# YAACC Changelog
2+
3+
## [Unreleased] - 2026-02-21
4+
5+
### Added
6+
- **SAF Short ID System**: Implemented short numeric ID mapping to fix UPnP browsing errors caused by long ObjectIDs (97% size reduction)
7+
- **Clear Cache Button**: Added button in Server Control Activity to clear SAF cache and trigger reindexing
8+
- **Image Preload**: Extended preload indexing to include image files (previously only audio/video)
9+
- **Preload Timeout**: Added 5-minute timeout to prevent indefinite hanging during indexing
10+
- **Permission Checks**: Added read permission checks before traversing SAF folders
11+
- **Notification Permission**: Added POST_NOTIFICATIONS permission request on startup (Android 13+)
12+
- **Lightweight Content Wrappers**: Created YaaccItem, YaaccMusicTrack, YaaccPhoto, YaaccRes classes for faster browsing
13+
- **ProtocolInfo Cache**: Pre-created ProtocolInfo for common MIME types to eliminate repeated parsing
14+
15+
### Changed
16+
- **Renamed**: DurationCacheManager → SAFCacheManager (better reflects actual purpose)
17+
- **Extended Cache**: Now caches duration, MIME type, file size, and shortId for all files
18+
- **Optimized Item Creation**: Eliminated Cling library overhead (~5.5x faster, from ~250ms to ~45ms per item)
19+
- **Improved Logging**: Better logging for cache operations and preload progress
20+
- **ID Persistence**: ID counter now persisted in SharedPreferences to maintain stable IDs across restarts
21+
22+
### Fixed
23+
- Fixed SAF folder browsing hanging on folders without read permission
24+
- Fixed preload getting stuck on large or inaccessible folders
25+
- Fixed ID counter not persisting, causing ID collisions after restart
26+
- Fixed cache not including image files
27+
- Fixed UPnP `UPNP_E_BAD_RESPONSE` errors caused by excessively long ObjectIDs
28+
29+
### Performance
30+
- SAF browsing: 70% faster after initial cache population (3.75s → 1.1s for 15 files)
31+
- Item creation: 5.5x faster (~250ms → ~45ms per item)
32+
- ObjectID length: 97% reduction (250 chars → 8 chars)
33+
- Cache hit time: <1ms (memory), <50ms (disk)
34+
35+
### Breaking Changes
36+
- Cache format changed: Old cache entries automatically migrated to include shortId
37+
- ID format changed: ObjectIDs now use short numeric IDs instead of Base64-encoded URIs
38+
- Desktop UPnP clients may need to clear cache and re-browse after update
39+
40+
---
41+
42+
## [4.4.1] - Previous Release
43+
44+
### Added
45+
- Modernized image viewer with zoom support (PhotoView library)
46+
- Media controls on lock screen
47+
- Volume controls using Media Router API (standard Android implementation)
48+
- System audio streaming (Android 10+)
49+
- Screen cast streaming using MJPEG
50+
- Experimental MPEG-TS streaming
51+
- Smart logger for better debugging
52+
- Unit tests for core functionality
53+
54+
### Changed
55+
- Refactored player service to align with recent Android APIs
56+
- Implemented ExoPlayer and Media3 MediaSession
57+
- Smart WiFi lock management to reduce battery drain
58+
- Improved DLNA metadata
59+
- Modernized TabBrowser activity
60+
- Improved performance in content browsing
61+
- LRU cache for SAF file scanning
62+
63+
### Fixed
64+
- Fixed renderer service issues
65+
- Fixed album art in notifications
66+
- Fixed restart during pause
67+
- Fixed background service not stopping correctly
68+
- Fixed issue #151 (network stack)
69+
- Fixed issue #186 (media controls)
70+
- Fixed issue #187 (media resource selection)
71+
- Fixed issue #110 (network stack refactoring)
72+
- Fixed issue #105 (player service refactoring)
73+
- Fixed issue #93 (volume controls)
74+
- Fixed issue #81 (audio streaming)
75+
- Fixed issue #121 (screen cast)
76+
77+
### Removed
78+
- Removed dead classes after refactoring
79+
- Cleaned up deprecated player implementations
80+
81+
---
82+
83+
## Migration Notes
84+
85+
### From 4.4.1 to Unreleased
86+
1. **SAF Cache**: Existing cache entries will be automatically migrated on first access
87+
2. **Desktop Clients**: Clear UPnP client cache and re-browse YAACC server after update
88+
3. **Permissions**: Grant POST_NOTIFICATIONS permission when prompted (Android 13+)
89+
4. **Cache Management**: Use new "Clear SAF Cache" button in Server Control Activity if needed
90+
91+
---
92+
93+
## Technical Details
94+
95+
### SAF Short ID Implementation
96+
- Bidirectional URI ↔ shortId mapping in SAFCacheManager
97+
- Persistent ID counter in SharedPreferences (`saf_id_counter`)
98+
- Automatic migration of old cache entries
99+
- ObjectID format: `1100999` + shortId (e.g., `11009991`, `11009992`)
100+
- URL format: `http://ip:port/saf/11009991/1.mp3`
101+
102+
### Performance Optimizations
103+
- Eliminated Cling Property/ArrayList overhead in item creation
104+
- Cached ProtocolInfo for common MIME types
105+
- Lightweight wrapper classes instead of heavy Cling objects
106+
- Deferred Cling conversion until UPnP response generation
107+
108+
### Cache Improvements
109+
- Memory cache: LRU with 1000 entry limit
110+
- Disk cache: SharedPreferences with automatic trimming
111+
- Preload: Background indexing with timeout and permission checks
112+
- Metadata: Duration, MIME type, file size, shortId for all media files
113+
114+
---
115+
116+
## Known Issues
117+
- Preload may take several minutes for large SAF folders (5-minute timeout)
118+
- Desktop UPnP clients must refresh cache after YAACC cache clear
119+
- Local device in Receiver tab doesn't show status badge (not a UPnP renderer)
120+
121+
---
122+
123+
## Credits
124+
- SAF Short ID implementation: tobexyz
125+
- Content browsing optimization: tobexyz
126+
- Cache management improvements: tobexyz

docs/index.md

Lines changed: 133 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ On the first screen all UPnP/DLNA servers in your network are listed.
2626
Select one and the app will automatically switch to the content tab.
2727
It allows to browse the content provided by the selected server.
2828

29-
![browse_servers](./screenshots/4.4.x/browse_servers.png){:height="30%" width="30%"}
29+
![browse_servers](./screenshots/5.0.x/browse_servers.png){:height="30%" width="30%"}
3030

3131
Before selecting content make sure you have chosen an receiver on
3232
the receiver tab. Receivers are either UPnP/DLNA media renderers in
3333
your network or the android device itself.
3434

35-
![browse_receiver](./screenshots/4.4.x/browse_receiver.png){:height="30%" width="30%"}
35+
![browse_receiver](./screenshots/5.0.x/browse_receiver.png){:height="30%" width="30%"}
3636

3737
Normally senders and receivers will appear automatically.
3838
If not you can use the refresh button at the bottom of
@@ -50,34 +50,155 @@ Behind each content entry different symbols are showing the possible actions:
5050

5151
At the bottom of the screen the currently selected sender and receiver is displayed.
5252

53-
![browse_music_folder](./screenshots/4.4.x/browse_music_folder.png){:height="30%" width="30%"}
53+
![browse_music_folder](./screenshots/5.0.x/browse_music_folder.png){:height="30%" width="30%"}
5454

5555
## Playing content
5656

57-
YAACC is able to control an multiple players at the same time.
58-
For example you are able to stream a image show with background music
57+
YAACC is able to control multiple players at the same time.
58+
For example you are able to stream an image show with background music
5959
on your device, starting a movie on a TV or play music on a
6060
smart speaker at the same time.
6161

6262
Each player is displayed in the player tab. Depending on the content type
6363
and if the content is played by YAACC itself or a network device, the player ui differs.
6464

65-
![browse_player](./screenshots/4.4.x/browse_player.png){:height="30%" width="30%"}
65+
![browse_player](./screenshots/5.0.x/browse_player.png){:height="30%" width="30%"}
6666

6767
YAACC includes a player for music and image shows.
6868
Videos are played using a third parties app on the device.
6969
The video app will start automatically, if video content is selected for playing
7070

71-
![music_player](./screenshots/4.4.x/music_player.png){:height="30%" width="30%"}
71+
![music_player](./screenshots/5.0.x/music_player.png){:height="30%" width="30%"}
7272

73-
![image_player_show_menu](./screenshots/4.4.x/image_player_show_menu.png){:height="30%" width="30%"}
73+
![image_player_show_menu](./screenshots/5.0.x/image_player_show_menu.png){:height="30%" width="30%"}
74+
75+
### Receiver controls
76+
77+
The receiver tab shows all available UPnP/DLNA renderers in your network, including your device.
78+
Each renderer displays:
79+
80+
* Current playback status (PLAYING badge when active)
81+
* Track title and album art (when available)
82+
* Play/pause/stop controls
83+
* Volume control
84+
* Mute button
85+
86+
![browse_receiver](./screenshots/5.0.x/browse_receiver.png){:height="30%" width="30%"}
87+
88+
You can control playback directly from the receiver tab without opening the player view.
89+
The controls work for both local playback and remote UPnP devices.
90+
91+
### Lock screen controls
92+
93+
When playing media locally, YAACC provides lock screen controls:
94+
95+
* Play/pause/stop buttons
96+
* Next/previous track
97+
* Track metadata display
98+
* Album art
99+
* Hardware volume buttons control playback volume
100+
101+
## Live streaming (Android 10+)
102+
103+
YAACC can stream your device's screen and system audio to UPnP/DLNA renderers in your network.
104+
105+
### System audio streaming
106+
107+
Stream all audio playing on your device to network speakers or receivers:
108+
109+
* Captures system audio (music, podcasts, games, etc.)
110+
* 44.1kHz stereo, high quality
111+
* Works with most UPnP audio renderers
112+
* Multiple simultaneous clients supported
113+
114+
**Note:** Some apps may block audio capture (DRM-protected content like Spotify, YouTube Premium).
115+
116+
### Screen casting
117+
118+
Stream your device's screen to TVs or displays:
119+
120+
* 720p video at 15fps
121+
* MJPEG format for broad compatibility
122+
* Works in web browsers and some UPnP video players
123+
* Useful for presentations and screen sharing
124+
125+
### Enabling live streaming
126+
127+
1. Go to the Server tab
128+
2. Find your local device in the list
129+
3. Tap the audio or video button
130+
4. Grant MediaProjection permission when prompted
131+
5. The stream appears in the "Live Streams" folder
132+
133+
Access streams via UPnP or directly:
134+
* Audio: `http://<device-ip>:49157/live/audio`
135+
* Video: `http://<device-ip>:49157/live/video`
136+
137+
## Storage Access Framework (SAF)
138+
139+
YAACC supports browsing files from external storage, USB drives, and SD cards using Android's
140+
Storage Access Framework. This allows sharing media from any storage location accessible on your device.
141+
142+
### Configuring SAF folders
143+
144+
In the server control view, you can add SAF folders to share:
145+
146+
1. Tap "Add SAF folder"
147+
2. Select the folder using Android's file picker
148+
3. Grant permission when prompted
149+
4. The folder appears in the server content directory
150+
151+
![server_control](./screenshots/5.0.x/server_control.png){:height="30%" width="30%"}
152+
153+
### Performance optimization
154+
155+
YAACC caches metadata (duration, MIME type, file size) for faster browsing:
156+
157+
* First browse: Extracts metadata from files
158+
* Subsequent browses: Uses cached data
159+
* Cache persists across app restarts
160+
* Clear cache button available in server control view
161+
162+
The cache significantly improves browsing performance, especially for large media collections.
163+
164+
## Battery optimization
165+
166+
YAACC includes several battery-saving features:
167+
168+
### Smart WiFi lock management
169+
170+
The WiFi lock is only held when actually needed:
171+
172+
* Released when app is backgrounded (if server/renderer disabled)
173+
* Released when no active streaming
174+
* Automatically re-acquired when needed
175+
176+
177+
### Smart foreground service
178+
179+
The player service intelligently manages foreground state:
180+
181+
* Foreground only when actively playing media
182+
* Stops foreground when paused (notification hidden)
183+
* Service stops completely when no players active
184+
185+
186+
## Modern architecture
187+
188+
YAACC uses modern Android APIs for better performance and system integration:
189+
190+
* **Media3/ExoPlayer** - Modern media playback engine (replaces deprecated MediaPlayer)
191+
* **MediaSession** - System-wide media controls and lock screen integration
192+
* **Improved UPnP stack** - Enhanced reliability and network state handling
193+
* **AudioPlaybackCapture** - System audio streaming (Android 10+)
194+
* **MediaProjection** - Screen casting support
74195

75196
## Media server
76197

77198
YAACC includes a media server service, which has to be enabled separately.
78199
A switch for this is located at the bottom of the server list tab.
79200

80-
![browse_servers](./screenshots/4.4.x/browse_servers.png){:height="30%" width="30%"}
201+
![browse_servers](./screenshots/5.0.x/browse_servers.png){:height="30%" width="30%"}
81202

82203
Depending on the configurations for the server in the settings,
83204
the server service is used as media provider, media renderer or proxy.
@@ -91,7 +212,7 @@ are accessible for other UPnP/DLNA devices in you network.
91212
The shareable folders have to be configured using the server control view.
92213
All included files and folders are accessible for other devices in your network.
93214

94-
![server_control](./screenshots/4.4.x/server_control.png){:height="30%" width="30%"}
215+
![server_control](./screenshots/5.0.x/server_control.png){:height="30%" width="30%"}
95216

96217
The server control view is accessible through the YAACC entry in the server list tab or
97218
the YAACC server service notification.
@@ -122,9 +243,9 @@ The shutdown timer stops all running players and the app after a certain time.
122243
The timer is settable and can be enabled at the bottom of the server list tab and the remaining time
123244
is displayed.
124245

125-
![browse_servers](./screenshots/4.4.x/browse_servers.png){:height="30%" width="30%"}
246+
![browse_servers](./screenshots/5.0.x/browse_servers.png){:height="30%" width="30%"}
126247

127-
![shutdown_timer](./screenshots/4.4.x/shutdown_timer.png){:height="30%" width="30%"}
248+
![shutdown_timer](./screenshots/5.0.x/shutdown_timer.png){:height="30%" width="30%"}
128249

129250
| [Screenshots](screenshots/) | [Settings](settings/) | [About](about/) | [Code](doxygen/html/inherits.html)
130251

74.2 KB
Loading
77 KB
Loading
118 KB
Loading
78.7 KB
Loading
99 KB
Loading
182 KB
Loading
107 KB
Loading
1.25 MB
Loading

0 commit comments

Comments
 (0)