0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

DiscordActivityのアスペクト比を調べてみる

Last updated at Posted at 2024-05-30

はじめに

2024年6月に仕様変更で、Discord側でのアスペクト比の固定仕様が無くなりました

Discord Activityの開発で表示領域のアスペクト比に関する記載が見つからなかったので調べて見ました。

結果

概ね 16:9 でした。
以下解像度1920*1080 の16:9のディスプレイで表示した、横サイズを16に固定したアスペクト比の調査表です。

表示種類 横サイズ 縦サイズ アスペクト比
通常表示 1063 598 16 : 9.0009
通常表示_メンバー表示なし 1134 638 16 : 9.0017
フルスクリーン表示 1173 661 16 : 9.0161
ウインドウ最小表示 352 198 16 : 9
ウインドウ最小表示_メンバー表示なし 423 238 16 : 9.0023

調査内容

表示領域サイズを表示するHTMLを作成し、Discord Activityに表示しました。
表示領域はwindow.innerWidth,window.innerHeightとしました。

通常表示
スクリーンショット

通常表示_メンバー表示なし
スクリーンショット 2024-05-28 203854.jpg

フルスクリーン表示
スクリーンショット 2024-05-28 203915.jpg

ウインドウ最小表示
スクリーンショット 2024-05-28 204552.jpg

ウインドウ最小表示_メンバー表示なし
スクリーンショット 2024-05-28 204524.jpg

以下使用したHTMLのコード

<!DOCTYPE html []>
<html>
  <body>
    <h2>Window Size</h2>
    <p id="screen"></p>
    <p id="window"></p>
    <p id="page"></p>
    <script>

    //ウインドウのリサイズ時の処理
    function windowResizeEvent(){
        var timeoutId = 0;
        const resizeDelay = 300;  //リサイズが完了したと判断する時間
        window.onresize = () => {
            clearTimeout(timeoutId);
            timeoutId = setTimeout(()=>{
                viewWindowSize();
            }, resizeDelay);
        };
    }
    function viewWindowSize(){

        const screenWidth = screen.width;
        const screenHeight = screen.height;
        const screenAspectRatioWidth = 16;
        const screenAspectRatioHeight = screenHeight * screenAspectRatioWidth / screenWidth;
        const windowWidth = window.innerWidth;
        const windowHeight = window.innerHeight;
        const windowAspectRatioWidth = 16;
        const windowAspectRatioHeight = windowHeight * windowAspectRatioWidth / windowWidth;
        const pageWidth  = document.documentElement.scrollWidth;
        const pageHeight = document.documentElement.scrollHeight;
        const pageAspectRatioWidth = 16;
        const pageAspectRatioHeight = pageHeight * pageAspectRatioWidth / pageWidth;

        const screenSize = document.getElementById("screen");
        screenSize.innerHTML = "Display Size (screen) : width: " + screenWidth + ", height: " + screenHeight + ", aspect-ratio: (" + screenAspectRatioWidth +":" + screenAspectRatioHeight + ");";

        const browserSize = document.getElementById("window");
        browserSize.innerHTML = "Browser Size (window.inner) : width: " + windowWidth + ", height: " + windowHeight + ", aspect-ratio: (" + windowAspectRatioWidth +":" + windowAspectRatioHeight + ");";

        const pageSize = document.getElementById("page");
        pageSize.innerHTML = "Webpage Size (documentElement.scroll) : width:" + pageWidth + ", height: " + pageHeight + ", aspect-ratio: (" + pageAspectRatioWidth +":" + pageAspectRatioHeight + ");";
        
    }

    viewWindowSize();
    windowResizeEvent();

    </script>
  </body>
</html>
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?