Skip to content

Commit 17234fe

Browse files
committed
Update kitchensink example for imagemap with video
1 parent 222c7bf commit 17234fe

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
lines changed

examples/kitchensink/server.go

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -545,15 +545,35 @@ func (app *KitchenSink) handleText(message *linebot.TextMessage, replyToken stri
545545
linebot.NewImagemapMessage(
546546
app.appBaseURL+"/static/rich",
547547
"Imagemap alt text",
548-
linebot.ImagemapBaseSize{1040, 1040},
549-
linebot.NewURIImagemapAction("https://store.line.me/family/manga/en", linebot.ImagemapArea{0, 0, 520, 520}),
550-
linebot.NewURIImagemapAction("https://store.line.me/family/music/en", linebot.ImagemapArea{520, 0, 520, 520}),
551-
linebot.NewURIImagemapAction("https://store.line.me/family/play/en", linebot.ImagemapArea{0, 520, 520, 520}),
552-
linebot.NewMessageImagemapAction("URANAI!", linebot.ImagemapArea{520, 520, 520, 520}),
548+
linebot.ImagemapBaseSize{Width: 1040, Height: 1040},
549+
linebot.NewURIImagemapAction("https://store.line.me/family/manga/en", linebot.ImagemapArea{X: 0, Y: 0, Width: 520, Height: 520}),
550+
linebot.NewURIImagemapAction("https://store.line.me/family/music/en", linebot.ImagemapArea{X: 520, Y: 0, Width: 520, Height: 520}),
551+
linebot.NewURIImagemapAction("https://store.line.me/family/play/en", linebot.ImagemapArea{X: 0, Y: 520, Width: 520, Height: 520}),
552+
linebot.NewMessageImagemapAction("URANAI!", linebot.ImagemapArea{X: 520, Y: 520, Width: 520, Height: 520}),
553553
),
554554
).Do(); err != nil {
555555
return err
556556
}
557+
case "imagemap video":
558+
if _, err := app.bot.ReplyMessage(
559+
replyToken,
560+
linebot.NewImagemapMessage(
561+
app.appBaseURL+"/static/rich",
562+
"Imagemap with video alt text",
563+
linebot.ImagemapBaseSize{Width: 1040, Height: 1040},
564+
linebot.NewURIImagemapAction("https://store.line.me/family/manga/en", linebot.ImagemapArea{X: 0, Y: 0, Width: 520, Height: 520}),
565+
linebot.NewURIImagemapAction("https://store.line.me/family/music/en", linebot.ImagemapArea{X: 520, Y: 0, Width: 520, Height: 520}),
566+
linebot.NewURIImagemapAction("https://store.line.me/family/play/en", linebot.ImagemapArea{X: 0, Y: 520, Width: 520, Height: 520}),
567+
linebot.NewMessageImagemapAction("URANAI!", linebot.ImagemapArea{X: 520, Y: 520, Width: 520, Height: 520}),
568+
).WithVideo(&linebot.ImagemapVideo{
569+
OriginalContentURL: app.appBaseURL + "/static/imagemap/video.mp4",
570+
PreviewImageURL: app.appBaseURL + "/static/imagemap/preview.jpg",
571+
Area: linebot.ImagemapArea{X: 280, Y: 385, Width: 480, Height: 270},
572+
ExternalLink: &linebot.ImagemapVideoExternalLink{LinkURI: "https://line.me", Label: "LINE"},
573+
}),
574+
).Do(); err != nil {
575+
return err
576+
}
557577
case "quick":
558578
if _, err := app.bot.ReplyMessage(
559579
replyToken,
80.2 KB
Loading
1.73 MB
Binary file not shown.

0 commit comments

Comments
 (0)