A powerful Tampermonkey userscript that automates video playback on FAMSUN Academy with smart course-switching detection and countdown timer management.
- Automatic Video Playback: Automatically plays videos at 2x speed
- Smart Speed Control: Maintains 2x playback speed throughout the video
- Automatic Course Switching: Detects course changes and seamlessly transitions to the next video
- Countdown Timer Management: Keeps playback alive when system countdown is running, completes only when timer ends
- Multi-Player Support: Compatible with JW Player, CyberPlayer, VideoJS, Petrel (Haiyan), and native HTML5 video
- Course Detection: Intelligent course switching detection via:
- URL path changes
- Browser history changes (pushState/replaceState/popstate)
- Video element mutations
- Video source changes
- Fallback Mechanism: Uses system countdown timer when video duration is unavailable
- User Activity Simulation: Simulates mouse and keyboard activity to prevent focus loss detection
- Parses countdown in multiple formats: "2ๅฐๆถ 2ๅ้ 30็ง" (hours/minutes/seconds)
- Maintains playback during countdown (rewinds to ~1% if video stops)
- Prevents auto-jump until countdown reaches zero or countdown panel disappears
- Tracks countdown state across monitoring cycles to avoid stale data leakage
- Go to your browser's extension store:
- Chrome: Chrome Web Store - Tampermonkey
- Firefox: Firefox Add-ons - Tampermonkey
- Safari: App Store - Tampermonkey
- Click "Install" and confirm the installation
- Go to Greasy Fork or OpenUserJS
- Search for "FAMSUN Academy Auto-Play" or manually install:
- Open Tampermonkey dashboard
- Click "+" (Create new script)
- Copy the entire content of
famsun_auto_video.user.js - Paste into the editor
- Press Ctrl+S (Cmd+S on Mac) to save
- Enable the script in Tampermonkey dashboard
- Navigate to any video course on FAMSUN Academy
- The script will automatically detect the content type (video/PDF)
- For videos:
- The control panel appears in the top-right corner
- Click the "Start" button or enable auto-start in settings
- The script will automatically play at 2x speed
- Progress is displayed in real-time
- For PDFs:
- The script automatically scrolls through the document
- Countdown timer requirement is monitored
The control panel displays:
- ๐น Playback Progress: Current percentage and time
- โฑ System Requirement: Remaining countdown time required
- โก Speed: Current playback speed (2x)
- Auto-Next Checkbox: Toggle automatic course switching
Ctrl + Alt + S: Start/Stop playbackCtrl + Alt + N: Jump to next courseCtrl + Alt + P: Pause/Resume
Right-click the Tampermonkey icon โ Dashboard โ Find "FAMSUN Academy" โ Settings
Available Options:
autoStart(default: true): Automatically start playback when entering a courseplaybackSpeed(fixed: 2.0): Video playback speed (2x faster)autoNext(default: true): Automatically proceed to next course when current completessimulateActivity(default: true): Simulate user activity to prevent focus lossdebugMode(default: false): Enable debug logging in consoleminWatchPercent(default: 95): Minimum percentage to watch before course is marked complete
// In Tampermonkey dashboard, you can modify these GM_getValue calls:
GM_getValue('autoStart', true) // Auto-start playback
GM_getValue('autoNext', true) // Auto-jump to next course
GM_getValue('simulateActivity', true) // Simulate user activity
GM_getValue('debugMode', false) // Show debug logs
GM_getValue('minWatchPercent', 95) // Minimum watch percentage
GM_getValue('pdfScrollInterval', 3000) // PDF scroll interval (ms)
GM_getValue('pdfScrollStep', 500) // PDF scroll distance (pixels)graph TD
A["๐ค User enters course page"] --> B["๐ Detect content type<br/>Video/PDF"]
B --> C{Content<br/>Type?}
C -->|Video| D["๐ฌ Find video player<br/>JW/Cyber/VideoJS/Native"]
C -->|PDF| E["๐ Initialize PDF controller"]
D --> F["โ๏ธ Set playback speed to 2x"]
F --> G["โถ๏ธ Start video playback"]
E --> H["๐ Start auto-scrolling PDF"]
G --> I["โฑ๏ธ Monitor system countdown"]
H --> J["โฑ๏ธ Monitor system countdown"]
I --> K{Countdown > 0?}
J --> K
K -->|Yes| L["๐ Keep playback active<br/>Rewind if stopped"]
K -->|No| M["โ
Mark course complete"]
L --> N{Countdown<br/>reached zero?}
N -->|No| L
N -->|Yes| M
M --> O{Auto-next<br/>enabled?}
O -->|Yes| P["๐ Jump to next course"]
O -->|No| Q["๐ Stop"]
P --> A
Q --> Q
graph TD
A["๐ฌ Video ends"] --> B["โฑ๏ธ System countdown<br/>still active<br/>e.g., 2:30"]
B --> C["๐ Monitor every 1 second"]
C --> D{Video<br/>stopped?}
D -->|Yes| E["โช Rewind to ~1%"]
D -->|No| F["โ Continue playing"]
E --> G["โฑ๏ธ Check cooldown<br/>8 seconds"]
G --> H{Cooldown<br/>expired?}
H -->|Yes| I["โถ๏ธ Resume playback"]
H -->|No| J["โธ๏ธ Wait for cooldown"]
I --> K{Countdown = 0 or<br/>panel disappeared?}
J --> K
F --> K
K -->|Yes| L["โ
Complete course"]
K -->|No| M["๐ Continue monitoring"]
M --> D
L --> N["๐ Auto-jump to next"]
graph TD
A["๐ Page Change Detected"] --> B{Detection<br/>Source?}
B -->|URL Path Changed| C["๐ Pathname differs"]
B -->|pushState/replaceState| D["๐ Navigation event"]
B -->|popstate| E["๐ Browser back/forward"]
B -->|Video Element| F["๐ New video element"]
B -->|Video Source| G["๐ Different src URL"]
C --> H["๐ Validate real change<br/>Compare normalized URLs<br/>& course IDs"]
D --> H
E --> H
F --> H
G --> H
H --> I{Is this a<br/>real course<br/>switch?}
I -->|No| J["โญ๏ธ Skip - internal update"]
I -->|Yes| K["๐ Stop current playback"]
K --> L["โณ Wait 3 seconds<br/>for new page load"]
L --> M["๐ Detect new content type"]
M --> N["โ๏ธ Initialize new controller"]
N --> O{Auto-start<br/>enabled?}
O -->|Yes| P["๐ Auto-play new course"]
O -->|No| Q["โธ๏ธ Waiting for user"]
P --> R["โ
Course switch complete"]
Q --> R
J --> S["โ Continue current course"]
graph TD
A["๐ฏ Detect Player Type"] --> B{Check<br/>players}
B -->|JW Player container| C["โ
JW Player found"]
B -->|cyberplayer object| D["โ
CyberPlayer found"]
B -->|videojs instance| E["โ
VideoJS found"]
B -->|Petrel marker| F["โ
Petrel found"]
B -->|video element| G["โ
Native HTML5"]
C --> H["โ๏ธ Set 2x Speed"]
D --> H
E --> H
F --> H
G --> H
H --> I["๐ Try multiple methods"]
I --> J["Method 1: UI Click<br/>Most reliable"]
I --> K["Method 2: Player API<br/>setPlaybackRate"]
I --> L["Method 3: Video element<br/>playbackRate property"]
I --> M["Method 4: Global object<br/>window.cyberplayer"]
J --> N{Speed<br/>set?}
K --> N
L --> N
M --> N
N -->|Yes| O["โ
Verify speed"]
N -->|No| P["๐ Retry up to 3x"]
P --> N
O --> Q{Actual speed<br/>โ 2x?}
Q -->|Yes| R["โ
Success!"]
Q -->|No| S["โ ๏ธ Warning: Speed mismatch"]
graph LR
subgraph "Tampermonkey Runtime"
A["AutoPlayer<br/>Main Controller"]
end
subgraph "Detection & Monitoring"
B["StateManager<br/>State Storage"]
C["AntiDetection<br/>Prevent Detection"]
end
subgraph "Content Controllers"
D["VideoController<br/>Video Playback"]
E["PDFController<br/>PDF Reading"]
end
subgraph "UI Components"
F["ControlPanel<br/>Dashboard"]
end
subgraph "Player Support"
G["JW Player"]
H["CyberPlayer"]
I["VideoJS"]
J["Petrel/Native"]
end
A --> B
A --> C
A --> D
A --> E
A --> F
D --> G
D --> H
D --> I
D --> J
F -.->|Displays Status| D
F -.->|Displays Status| E
C -.->|Anti-Detection| A
B -.->|Stores State| A
stateDiagram-v2
[*] --> NoCountdown: Initial State
NoCountdown --> FirstSeen: Countdown detected<br/>lastCountdownSeconds = value
FirstSeen --> Armed: Countdown โค 30s<br/>countdownArmed = true
FirstSeen --> FirstSeen: Countdown > 30s<br/>Keep monitoring
Armed --> Armed: 30s < countdown < 0<br/>ensureCountdownActive()<br/>checks every 1s
Armed --> Parsing: Countdown updated<br/>re-parse seconds
Parsing --> Armed: Still active
Armed --> PanelGone: Countdown panel<br/>disappeared
Armed --> Complete: Countdown โค 3s<br/>countdownEverSeen = true
PanelGone --> Complete: Course marked<br/>complete
Complete --> Done: resetCountdownState()<br/>Clear all flags
Done --> [*]: Next course<br/>or idle
-
Check if Tampermonkey is enabled
- Click Tampermonkey icon โ Dashboard
- Verify "FAMSUN Academy Auto-Play Assistant" is enabled
-
Check if you're on the correct domain
- Script only runs on:
https://academy.famsungroup.com/*
- Script only runs on:
-
Clear browser cache
- Ctrl+Shift+Delete โ Clear all cookies and cached images
- Refresh the page
-
Check console for errors
- Press F12 โ Console tab
- Look for red error messages with "[FAMSUNๅฉๆ]" prefix
-
Ensure JavaScript is enabled
- Check browser settings: Settings โ Privacy & Security โ JavaScript
-
Check if video player is detected
- Press F12 โ Console
- Type:
document.querySelector('video') - Should return an element (not null)
-
Try manual playback
- Click the video player's play button manually
- Then enable the script
-
Check current speed
- Press F12 โ Console
- Type:
document.querySelector('video').playbackRate - Should show:
2(or close to 2)
-
Manual speed adjustment
- Right-click video โ Speed settings
- Check if site allows speed changes
-
Enable debug mode
- Right-click Tampermonkey โ Dashboard โ Settings
- Enable
debugMode: true - Check console for speed-related messages
-
Countdown not detected
- Press F12 โ Console
- Type:
document.querySelector('.yxtbiz-language-slot')?.textContent - Check if timer text appears
-
Auto-jump happening too early
- Ensure countdown timer is visible on screen
- Check if countdown format matches supported patterns
-
Playback not resuming during countdown
- Check debug logs for "ๅ่ฎกๆถ" (countdown) messages
- Verify video element is accessible
Enable debug mode to see detailed logs:
- Right-click Tampermonkey icon โ Dashboard
- Find "FAMSUN Academy Auto-Play Assistant" script
- Click Edit
- Find:
debugMode: GM_getValue('debugMode', false) - Change to:
debugMode: true - Press Ctrl+S to save
- Open browser console (F12) to see logs
Sample Debug Output:
[FAMSUNๅฉๆ 10:30:45] ๐ ๅผๅงๆฃๆตๆญๆพๅจ็ฑปๅ...
[FAMSUNๅฉๆ 10:30:45] โ
ๆพๅฐ JW Player ๆญๆพๅจ
[FAMSUNๅฉๆ 10:30:46] ๐ฏ ่ฎพ็ฝฎๆญๆพ้ๅบฆไธบ 2x (ๆญๆพๅจ: jwplayer, ็ฌฌ1ๆฌก)
[FAMSUNๅฉๆ 10:30:47] ๐ ้ๅบฆ่ฎพ็ฝฎๅฎๆ: โ
UIๆ้ฎ็นๅป | โ
JWPlayer.setPlaybackRate() | โ
video.playbackRate
- Memory: ~2-5 MB (minimal)
- CPU: <1% when idle, ~3-5% during active playback
- Network: No additional requests
- Compatibility: Works with all modern browsers (Chrome 60+, Firefox 55+, Safari 11+)
- PDF Scrolling: PDF progress is measured by time elapsed and scroll position, not content understanding
- Live Streams: Not designed for live video streams
- DRM Content: May not work with highly encrypted video content
- iframe Videos: Videos loaded in third-party iframes may not be detected
- Speed Restrictions: Some courses may have server-side restrictions on playback speed
| Browser | Version | Status |
|---|---|---|
| Chrome | 60+ | โ Fully Supported |
| Firefox | 55+ | โ Fully Supported |
| Safari | 11+ | โ Fully Supported |
| Edge | 79+ | โ Fully Supported |
| Opera | 47+ | โ Fully Supported |
This script is provided as-is for educational and personal use only. Users are responsible for complying with FAMSUN Academy's terms of service. The script author is not responsible for any consequences resulting from its use.
- โ Optimized countdown timer management
- โ Smart course-switching detection
- โ Improved playback state tracking
- โ Enhanced error handling and logging
- โ Enhanced button detection with retry mechanism
- โ Improved player type detection
- โ Initial release
To contribute improvements:
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature - Make your changes
- Test thoroughly on various courses
- Submit a pull request with detailed description
For issues, feature requests, or suggestions:
- Open an issue on GitHub Issues
- Check the console (F12) for debug messages
- Enable debug mode for more detailed logs
MIT License - See LICENSE file for details
Last Updated: November 6, 2025
Maintained By: AutoAcademy Contributors
Repository: GitHub - AutoAcademy