Masko player
The Masko player puts your mascot in a website or an app, with its transparency, on the web, React, iPhone, iPad, Mac, React Native and Android. Give it one animation and it loops it. Give it a released canvas and it switches clips by itself: your app only says what is happening, with set and fire.
This is Spike, playing in the Masko player. Hover him, grab him or press a button: the calls your app would send to the player show under him.
Hover him, grab him, or press a button.
// The calls your app sends show here.Two ways to play
Play one animation
Loop one animation from its two hosted files. No backend and no API key, about 2 minutes.
Play a canvas
A mascot that reacts to your app: your backend fetches the release, your app calls set and fire.
Install
| Platform | Install |
|---|---|
| Web, any framework | npm install @masko/player |
| React 17 or later | npm install @masko/player, then import from @masko/player/react |
| Web page without a build step | <script src="https://cdn.jsdelivr.net/npm/@masko/player@0.1/dist/masko-player.js"></script> |
| iPhone, iPad, Mac and visionOS | Swift package https://github.com/masko-ai/masko-player from 0.1.9, product MaskoPlayer |
| React Native and Expo | npm install @masko/player-react-native |
| Android | ai.masko:player, built from the repository until it reaches Maven Central |
Web
- It runs in Chrome and Edge 87, Firefox 79 and Safari 15 (iOS 15) or later.
- The element sets the mascot's size. Without a height, the mascot is square and as wide as the element.
- The script tag defines
window.MaskoPlayer; it is a classic script, not a module. - With a Content Security Policy, allow
'wasm-unsafe-eval'inscript-srcand your clip host inmedia-src. The web README lists every rule and the Vite setting.
iPhone, iPad and Mac
In Xcode, choose File > Add Package Dependencies, enter https://github.com/masko-ai/masko-player, choose Up to Next Major Version from 0.1.9 and add the MaskoPlayer product to your app target. It runs on iOS 15, macOS 13, Mac Catalyst 15 and visionOS 1 or later. Show it with MaskoView in SwiftUI or MaskoPlayerView in UIKit and AppKit. The Apple README has every call.
React Native and Expo
npm install @masko/player-react-native
npx expo run:ios # or: npx expo run:androidThe package is an Expo module with the Swift and Android players inside, for Expo SDK 54 (React Native 0.81, new architecture), iOS 15.1 and Android 7 (API 24) or later. It has native code, so build the app after installing it. A bare React Native app installs Expo modules first (npx install-expo-modules) and runs pod install in ios/. On Android, keep the ABIs the player is built for with reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86_64 in android/gradle.properties. The React Native README has every prop and call.
Android
ai.masko:player is coming to Maven Central. Until then, build it from the repository as its Android README shows: scripts/build-android.sh, then ./gradlew :player:publishReleasePublicationToLocalRepository in android/, which writes ai.masko:player:0.1.10 to android/player/build/repo. Add that folder to your app's Maven repositories. It needs Android 7 (API 24) and Java 17. Show it with MaskoPlayerView.
What it handles
- Transparency everywhere. It plays the file each platform shows with transparency: HEVC on Safari and Apple devices, WebM in other browsers and the stacked MP4 on Android. Apps that ask for it get the stacked AV1 file, two to three times lighter (file sizes).
- No flicker. The next clip is shown only once its first frame is ready, and a move waits for the end of the loop on screen, so it starts from the same frame.
- The page or app around it. It preloads the next clips, pauses while the page is hidden or the app is in the background, and shows a tap-to-play button when the browser blocks autoplay.
- Sound. A clip's own voice is heard by default;
setSound(false)on the web orsoundset tofalseon Apple, Android and React Native mutes it. Browsers allow sound only after the person's first click or key press on the page; until then the player plays muted, and the voice is heard from the next clip or loop.
The player is open source (MIT) at github.com/masko-ai/masko-player: one Rust engine runs the canvas rules, with a player for each platform. The rulebook gives every rule.
