10

I am embedding you tube videos in my elm sample application.So to implement i have write the elm video code

[ embed [ attribute "-video" "", attribute "api" "1", attribute "height" "100%", href "//vimeo.com/111690998", attribute "iframe-id" "vimeo1", attribute "player_id" "vimeo1", attribute "width" "100%" ]
     []
   , a [ href "//vimeo.com/111690998" ]
   [ text "Watch" ]
]

but i am getting some error of embed-video element

Please any one help me to impelment this feature.

Manu Chawla
  • 327
  • 1
  • 12

1 Answers1

13

You can simply translate embed code (html) into Elm code.

For example, in case of youtube...

import Html exposing (..)
import Html.Attributes exposing (..)
import Json.Encode

videoframe =
  iframe
  [ width 560
  , height 315
  , src "https://www.youtube.com/embed/test"
  , property "frameborder" (Json.Encode.string "0")
  , property "allowfullscreen" (Json.Encode.string "true")
  ]
  []
KhaledMohamedP
  • 5,000
  • 3
  • 28
  • 26
Tosh
  • 35,955
  • 11
  • 65
  • 55
  • Thanks @Tosh for your help – Manu Chawla Aug 01 '16 at 10:22
  • 2
    I was browsing for what to do about properties that aren't given a value, and the "true" hint above was very useful! FWIW, though, property didn't work for me for those attributes (only tested in Chrome so far). `attribute` does, however. The bug is hard to notice - as it still "works," just without fullscreen or borderless video! – Dav Clark Oct 12 '16 at 19:05