npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

screen-recording-detector-ios

v1.1.18

Published

**screen-recording-detector-ios** は Expo Modules API を使ったカスタムネイティブモジュールです。 iOS 上での画面録画/ミラーリング状態の変化とスクリーンショットイベントを検知し、JavaScript 側に通知します。 さらに、アプリ起動時に遅延チェックを行うことで、バックグラウンドからの再開時にも最新状態を取得できます。

Readme

screen-recording-detector-ios

screen-recording-detector-ios は Expo Modules API を使ったカスタムネイティブモジュールです。 iOS 上での画面録画/ミラーリング状態の変化とスクリーンショットイベントを検知し、JavaScript 側に通知します。 さらに、アプリ起動時に遅延チェックを行うことで、バックグラウンドからの再開時にも最新状態を取得できます。

主な機能

  • 画面録画検知

    • UIScreen.capturedDidChangeNotification を監視して録画/ミラーリング開始・終了を検出
    • アプリがフォアグラウンド復帰 (didBecomeActiveNotification) した際にも状態を再チェック
    • 起動直後に遅延チェック(5 秒間隔で合計 3 回)を行い、アプリ終了時の状態をフォローアップ
  • スクリーンショット検知

    • UIApplication.userDidTakeScreenshotNotification を監視してスクリーンショットを検出
  • オーバーレイによる画面保護

    • setProtectionEnabled(true) でバックグラウンド移行時/スクショ検知時に全画面を黒塗りオーバーレイ
    • フラグを false に戻すとオーバーレイを削除

インストール

yarn add screen-recording-detector-ios

使い方

import { useEffect } from "react";
import {
  addScreenRecordingListener,
  addScreenshotListener,
  getCapturedStatus,
  setProtectionEnabled,
} from "screen-recording-detector-ios";

export function useSecureScreen() {
  useEffect(() => {
    // 画面保護(オーバーレイ)を有効化
    setProtectionEnabled(true);

    // 録画検知
    const recSub = addScreenRecordingListener(({ isCaptured }) => {
      console.log("Screen recording state:", isCaptured);
    });

    // スクショ検知
    const shotSub = addScreenshotListener(() => {
      console.log("Screenshot taken.");
    });

    // 初期状態も取得可能
    (async () => {
      const status = await getCapturedStatus();
      console.log("Initial recording status:", status);
    })();

    return () => {
      // 後片付け
      recSub.remove();
      shotSub.remove();
      setProtectionEnabled(false);
    };
  }, []);
}

ネイティブ実装(Swift)概要

  • OnCreate:

    • アプリ起動時に初期録画状態を通知
    • 遅延チェックをスケジュール
  • OnStartObserving:

    • capturedDidChangeNotification で録画状態の変化を監視
    • userDidTakeScreenshotNotification でスクショ検知 & オーバーレイ表示
    • willResignActiveNotification でバックグラウンド移行時にオーバーレイ表示
    • didBecomeActiveNotification でフォアグラウンド復帰時にオーバーレイ解除 & 状態通知
  • OnStopObserving:

    • すべての通知監視を解除
  • 公開メソッド:

    • getCapturedStatus(): Promise<boolean>
    • setProtectionEnabled(enabled: boolean): void

License

MIT