To embed jwplayer in AMP HTML there is a component called amp-jwplayer which displays a cloud hosted jwplayer.
Required Scripts: Importing the amp-jwplayer component into the header
HTML
< script async custom-element = "amp-jwplayer" </ script >
|
Attributes:
- data-player-id: An alphanumeric ID found in the player section of JW player.
- data-playlist-id /data-media-id: An alphanumeric playlist-ID found in the content section of JW player anyone playlist-id or media-id is Required to be specified.
- autoplay: If specified the video starts playing as soon as it is loaded.
Example:
HTML
<!doctype html> < html ⚡>
< head >
< meta charset = "utf-8" >
< title >Google AMP amp-jwplayer</ title >
< script async src =
</ script >
<!-- Import the `amp-jwplayer`
component in the header.-->
< script async custom-element = "amp-jwplayer" </ script >
< link rel = "canonical" href =
< meta name = "viewport" content =
"width=device-width,minimum-scale=1,initial-scale=1" >
< style amp-boilerplate>
body {
-webkit-animation: -amp-start 8s
steps(1, end) 0s 1 normal both;
-moz-animation: -amp-start 8s
steps(1, end) 0s 1 normal both;
-ms-animation: -amp-start 8s
steps(1, end) 0s 1 normal both;
animation: -amp-start 8s
steps(1, end) 0s 1 normal both;
}
@-webkit-keyframes -amp-start {
from {
visibility: hidden
}
to {
visibility: visible
}
}
@-moz-keyframes -amp-start {
from {
visibility: hidden
}
to {
visibility: visible
}
}
@-ms-keyframes -amp-start {
from {
visibility: hidden
}
to {
visibility: visible
}
}
@-o-keyframes -amp-start {
from {
visibility: hidden
}
to {
visibility: visible
}
}
@keyframes -amp-start {
from {
visibility: hidden
}
to {
visibility: visible
}
}
</ style >
< noscript >
< style amp-boilerplate>
body {
-webkit-animation: none;
-moz-animation: none;
-ms-animation: none;
animation: none
}
</ style >
</ noscript >
</ head >
< body >
< amp-jwplayer data-media-id = "BZ6tc0gy" data-player-id = "uoIbMPm3" layout = "responsive" width = "16" height = "9" >
</ amp-jwplayer >
</ body >
</ html >
|
Output:
Article Tags :