lumi_h5p 1.1.0
lumi_h5p: ^1.1.0 copied to clipboard
A Flutter plugin to view and serve H5P content locally using a static server and InAppWebView.
๐ฏ Lumi_H5P #
A new Flutter package that helps you play Lumi H5P files locally โ no external H5P server required! ๐
Bring interactive H5P learning experiences directly into your Flutter apps โ offline, serverless, and simple.
๐ฑ About #
lumi_h5p enables developers and educators to load, download, and play H5P interactive content directly on mobile devices.
Itโs especially useful for offline schooling or e-learning environments, where access to an H5P server is limited or unavailable.
โจ Features #
โ
Play .h5p files locally โ no internet needed after download
โ
No H5P server or backend rendering required
โ
Automatically downloads .h5p files from a direct URL
โ
Perfect for educational and e-learning use cases
โ
Planned updates:
- ๐ Background downloads using
HashMap<String, String> - ๐พ Caching & offline playback
- ๐งฉ Improved rendering and user interface
For Improvements And Suggestions Raise Issue #
https://github.com/musa195420/h5p/issues
Github Link https://github.com/musa195420/h5p/tree/auto
Connect With Me Through https://muhammad-musa.netlify.app/
๐งฉ How It Works #
- Upload your
.h5pfile to Lumi or another accessible online location. - Copy the direct URL of your
.h5pfile. - Provide the URL to this packageโs controller.
- The package will:
- ๐ฆ Download the file
- ๐ง Unpack and render it locally
- ๐ฎ Play it seamlessly inside your app
No server, no hassle โ everything happens locally. ๐โ
๐ License & Usage #
This package is free to use for schooling and educational purposes. ๐ซ
Commercial usage is allowed with attribution. Future versions will include additional offline and background features.
๐ Getting Started #
Add this package to your pubspec.yaml file:
Yaml #
dependencies: test_h5p: ^0.1.0
Then, install it:
flutter pub get
Finally, import it in your Dart file
import 'package:test_h5p/test_h5p.dart';
๐ก Example Usage
Hereโs a simple example showing how to play an H5P file:
Dart #
import 'package:test_h5p/test_h5p.dart';
H5pWebView webView = H5pWebView(
controller: _h5pcontroller,
listenToEvents:
true, //only needed if you want to listen to events like marks and anything else
onXApiEvent: (event) {
h5pLog(message:๐ข xAPI Event: $event);
},
);
ValueListenableBuilder<H5PLoadStatus>(
valueListenable: _h5pcontroller.status,
builder: (_, status, __) {
if (status == H5PLoadStatus.downloading) {
return Column(
children: [
const Text("Downloading..."),
ValueListenableBuilder<double>(
valueListenable: _h5pcontroller.downloadProgress,
builder: (_, progress, __) =>
LinearProgressIndicator(value: progress),
),
],
);
} else if (status == H5PLoadStatus.extracting) {
return Column(
children: [
const Text("Extracting... Please wait"),
ValueListenableBuilder<double>(
valueListenable: _h5pcontroller.downloadProgress,
builder: (_, progress, __) => LinearProgressIndicator(
value: progress > 0
? progress
: null, // indeterminate if 0
),
),
],
);
}
return const SizedBox.shrink();
},
),
Expanded(child: webView),
๐ iOS Configuration #
If youโre targeting iOS, you need to allow local networking so the app can load H5P files from local storage or localhost.
๐ File Location ios/Runner/Info.plist
๐งฉ Add the Following Inside the
(but not inside any other
<key>NSAppTransportSecurity</key>
<dict>
<!-- Allow local HTTP (127.0.0.1, localhost) -->
<key>NSAllowsLocalNetworking</key>
<true/>
<!-- General rule for HTTP (optional if you only use localhost) -->
<key>NSAllowsArbitraryLoads</key>
<true/>
<!-- (Optional) Restrict to localhost only -->
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
<key>127.0.0.1</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
</dict>
</dict>
##โ After Updating
Run:
flutter clean flutter pub get flutter run
๐ค Android Configuration #
For Android, ensure that your app can access local files and HTTP connections.
๐ File Location android/app/src/main/AndroidManifest.xml
๐งฉ Add the Following Inside the #
<!-- โ
Under Application Tag -->
<application
android:name="${applicationName}"
android:label="test_h5p"
android:usesCleartextTraffic="true" <!-- Allow local HTTP -->
android:networkSecurityConfig="@xml/network_security_config"<!-- Add Http Rules -->
android:icon="@mipmap/ic_launcher">
๐งฉ (Optional) Add Internet Permission
Add this above the
<!-- โ
Add required permissions here -->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="28"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32"/>
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION"/>
Add new Folder in (Project Root) Android>src>main>res Create folder Named xml and create file network_security_config.xml and paste following code in it
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true">
<trust-anchors>
<certificates src="system" />
<certificates src="user" />
</trust-anchors>
</base-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">127.0.0.1</domain>
<domain includeSubdomains="true">10.0.2.2</domain>
</domain-config>
</network-security-config>
This allows the package to fetch .h5p files from remote URLs before caching them locally.
๐ง Why These Settings Are Needed #
By default, both iOS and Android restrict local HTTP access for security reasons. Because this package plays .h5p files locally (via WebView and internal file loading), these permissions are required to ensure:
๐ Local network access
๐ Smooth local file rendering
โ๏ธ Compatibility across all Flutter platforms
๐งญ Future Roadmap
Background download of multiple H5P files
Offline caching using HashMap<String, String>
Improved H5P player user interface
Android and iOS native performance optimizations
Example app with interactive demos
๐ฌ Contribute
We welcome contributions from the community! ๐ค
Feel free to:
๐ชฒ Report bugs
๐ก Suggest features
๐งโ๐ป Submit pull requests
Together, letโs make H5P local playback simple, open-source, and reliable. ๐ช
๐ท๏ธ Version
v1.0.6 โ Initial Release #
Watch a quick demo showing how Lumi_H5P works in action:
๐ก Usage Example Gif #
Watch the demo directly in the README:
Here are some screenshots of Lumi_H5P in action:
๐ฌ Usage Example Video #
Watch Demo Video ๐ฌ
Made with โค๏ธ by the community for educators, learners, and Flutter developers.