ねむすぎノート
トップ
メニュー
一覧
検索
pukiwiki1.5/twitch.inc.php
をテンプレートにして作成
開始行:
* Twitchの動画をPukiwikiに埋め込む [#q460640d]
#contents
** 概要 [#sd3b92ec]
- [[Pukiwiki1.5/youtube.inc.php]] を参考にねむすぎが作成...
- video , clip , channel に対応
- ''iPhone(iOS 16.6.1)からだとvideoだけ再生できない問題が...
-- [[APIリファレンス:https://dev.twitch.tv/docs/embed/]]...
- 自動再生の制御は `&autoplay=false` です。自動再生したい...
** videoを埋め込む [#l394a414]
https://www.twitch.tv/videos/1963266362
を埋め込む場合
#twitch(1963266362)
#twitch(1963266362)
** clipを埋め込む [#l394a414]
https://clips.twitch.tv/embed?clip=SpoopySmoggyPizzaDeIl...
を埋め込む場合
#twitch(SpoopySmoggyPizzaDeIlluminati-efqluiGRzSTQAnsT,c...
#twitch(SpoopySmoggyPizzaDeIlluminati-efqluiGRzSTQAnsT,cl...
** channelを埋め込む [#kdd2e53d]
https://www.twitch.tv/nemusg
を埋め込む場合
#twitch(nemusg,channel)
#twitch(nemusg,channel)
** 検証用 [#d3908aed]
#code_x{{
clip
<iframe src="https://clips.twitch.tv/embed?clip=HorribleD...
video
<iframe src="https://player.twitch.tv/?video=1963266362&p...
channel(LIVE)
<iframe src="https://player.twitch.tv/?channel=nemusg&par...
}}
** プラグイン本体 [#f55e4164]
`twitch.inc.php` として保存して pluginフォルダにアップロ...
#code_x{{
<?php
// Twitch埋め込みプラグイン
// twitch.inc.php
//
// Copyright(c) 2023 nemusg
// for PukiWiki
function plugin_twitch_convert()
{
define('WEBSITE_URL',"note.nemusg.com" , true); //動画を...
define('DEFAULT_WIDTH',"620px" , true);
define('DEFAULT_TYPE',"?video" , true);
define('DEFAULT_DOMAIN',"player" , true);
$width = DEFAULT_WIDTH;
$type = DEFAULT_TYPE;
$domain = DEFAULT_DOMAIN;
if (func_num_args() < 1) return FALSE;
$args = func_get_args();
$name = trim($args[0]);
$websiteurl = WEBSITE_URL;
if($args[1]==="channel"){ //channel
$type = "?channel";
}
if($args[1]==="clip"){ //channel
$type = "embed?clip";
$domain = "clips";
}
if($args[2]){ //width
$width = trim($args[1])."px";
}
$body = <<<EOM
<div style="max-width: $width;">
<div class="twitch" style="
height: 0;
position: relative;
padding-bottom: 56.25%;
overflow: hidden;
">
<iframe style="position:absolute;width:100%;height:100%;t...
</div>
</div>
EOM;
return $body . "\n";
}
function plugin_twitch_inline() {
//使用しない
}
?>
}}
** CSS [#q0c64d2a]
`pukiwiki.css` などで設定してください
#code_x{{
div#textBody .twitch {
max-width: 580px;
margin: 0 8px 16px;
}
@media (max-width:767px) {
div#textBody .twitch {
max-width: unset;
}
}
}}
終了行:
* Twitchの動画をPukiwikiに埋め込む [#q460640d]
#contents
** 概要 [#sd3b92ec]
- [[Pukiwiki1.5/youtube.inc.php]] を参考にねむすぎが作成...
- video , clip , channel に対応
- ''iPhone(iOS 16.6.1)からだとvideoだけ再生できない問題が...
-- [[APIリファレンス:https://dev.twitch.tv/docs/embed/]]...
- 自動再生の制御は `&autoplay=false` です。自動再生したい...
** videoを埋め込む [#l394a414]
https://www.twitch.tv/videos/1963266362
を埋め込む場合
#twitch(1963266362)
#twitch(1963266362)
** clipを埋め込む [#l394a414]
https://clips.twitch.tv/embed?clip=SpoopySmoggyPizzaDeIl...
を埋め込む場合
#twitch(SpoopySmoggyPizzaDeIlluminati-efqluiGRzSTQAnsT,c...
#twitch(SpoopySmoggyPizzaDeIlluminati-efqluiGRzSTQAnsT,cl...
** channelを埋め込む [#kdd2e53d]
https://www.twitch.tv/nemusg
を埋め込む場合
#twitch(nemusg,channel)
#twitch(nemusg,channel)
** 検証用 [#d3908aed]
#code_x{{
clip
<iframe src="https://clips.twitch.tv/embed?clip=HorribleD...
video
<iframe src="https://player.twitch.tv/?video=1963266362&p...
channel(LIVE)
<iframe src="https://player.twitch.tv/?channel=nemusg&par...
}}
** プラグイン本体 [#f55e4164]
`twitch.inc.php` として保存して pluginフォルダにアップロ...
#code_x{{
<?php
// Twitch埋め込みプラグイン
// twitch.inc.php
//
// Copyright(c) 2023 nemusg
// for PukiWiki
function plugin_twitch_convert()
{
define('WEBSITE_URL',"note.nemusg.com" , true); //動画を...
define('DEFAULT_WIDTH',"620px" , true);
define('DEFAULT_TYPE',"?video" , true);
define('DEFAULT_DOMAIN',"player" , true);
$width = DEFAULT_WIDTH;
$type = DEFAULT_TYPE;
$domain = DEFAULT_DOMAIN;
if (func_num_args() < 1) return FALSE;
$args = func_get_args();
$name = trim($args[0]);
$websiteurl = WEBSITE_URL;
if($args[1]==="channel"){ //channel
$type = "?channel";
}
if($args[1]==="clip"){ //channel
$type = "embed?clip";
$domain = "clips";
}
if($args[2]){ //width
$width = trim($args[1])."px";
}
$body = <<<EOM
<div style="max-width: $width;">
<div class="twitch" style="
height: 0;
position: relative;
padding-bottom: 56.25%;
overflow: hidden;
">
<iframe style="position:absolute;width:100%;height:100%;t...
</div>
</div>
EOM;
return $body . "\n";
}
function plugin_twitch_inline() {
//使用しない
}
?>
}}
** CSS [#q0c64d2a]
`pukiwiki.css` などで設定してください
#code_x{{
div#textBody .twitch {
max-width: 580px;
margin: 0 8px 16px;
}
@media (max-width:767px) {
div#textBody .twitch {
max-width: unset;
}
}
}}
ページ名:
トップ
新規
一覧
検索
最終更新
RSS