Skip to content

Commit 9b8139f

Browse files
authored
Merge pull request #111 from line/feature/add_example_for_play_video_on_imagemap
Add example for play video on imagemap
2 parents 81e683a + ad5903f commit 9b8139f

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

examples/kitchensink/app.rb

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
HORIZONTAL_THUMBNAIL_URL = 'https://via.placeholder.com/1024x768'
66
QUICK_REPLY_ICON_URL = 'https://via.placeholder.com/64x64'
77

8+
set :app_base_url, ENV['APP_BASE_URL']
9+
810
def client
911
@client ||= Line::Bot::Client.new do |config|
1012
config.channel_secret = ENV["LINE_CHANNEL_SECRET"]
@@ -255,6 +257,36 @@ def handle_message(event)
255257
]
256258
})
257259

260+
when 'imagemap video'
261+
video_url = File.join(settings.app_base_url.to_s, 'imagemap/video.mp4')
262+
preview_url = File.join(settings.app_base_url.to_s, 'imagemap/preview.jpg')
263+
reply_content(event, {
264+
type: 'imagemap',
265+
baseUrl: THUMBNAIL_URL,
266+
altText: 'Imagemap alt text',
267+
baseSize: { width: 1040, height: 1040 },
268+
video: {
269+
originalContentUrl: video_url,
270+
previewImageUrl: preview_url,
271+
area: {
272+
x: 0,
273+
y: 0,
274+
width: 520,
275+
height: 520,
276+
},
277+
external_link: {
278+
linkUri: 'https://line.me',
279+
label: 'LINE',
280+
},
281+
},
282+
actions: [
283+
{ area: { x: 0, y: 0, width: 512, height: 512 }, type: 'uri', linkUri: 'https://store.line.me/family/manga/en' },
284+
{ area: { x: 512, y: 0, width: 512, height: 512 }, type: 'uri', linkUri: 'https://store.line.me/family/music/en' },
285+
{ area: { x: 0, y: 512, width: 512, height: 512 }, type: 'uri', linkUri: 'https://store.line.me/family/play/en' },
286+
{ area: { x: 512, y: 512, width: 512, height: 512 }, type: 'message', text: 'Fortune!' },
287+
]
288+
})
289+
258290
when 'flex'
259291
reply_content(event, {
260292
type: "flex",
80.2 KB
Loading
1.73 MB
Binary file not shown.

0 commit comments

Comments
 (0)