diff --git a/Mf2/Parser.php b/Mf2/Parser.php index 317db25..a1104a0 100644 --- a/Mf2/Parser.php +++ b/Mf2/Parser.php @@ -615,6 +615,8 @@ public function parseU(\DOMElement $u) { $uValue = $u->getAttribute('href'); } elseif (in_array($u->tagName, array('img', 'audio', 'video', 'source')) and $u->hasAttribute('src')) { $uValue = $u->getAttribute('src'); + } elseif ($u->tagName == 'video' and !$u->hasAttribute('src') and $u->hasAttribute('poster')) { + $uValue = $u->getAttribute('poster'); } elseif ($u->tagName == 'object' and $u->hasAttribute('data')) { $uValue = $u->getAttribute('data'); } diff --git a/tests/Mf2/ParseUTest.php b/tests/Mf2/ParseUTest.php index b10957b..1a8e818 100644 --- a/tests/Mf2/ParseUTest.php +++ b/tests/Mf2/ParseUTest.php @@ -222,6 +222,19 @@ public function testParseUHandlesSource() { $this->assertEquals('http://example.com/video.ogg', $output['items'][0]['properties']['video'][1]); } + /** + * @group parseU + */ + public function testParseUHandlesVideoPoster() { + $input = '
'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('video', $output['items'][0]['properties']); + $this->assertEquals('http://example.com/video.mp4', $output['items'][0]['properties']['video'][0]); + $this->assertEquals('http://example.com/posterimage.jpg', $output['items'][0]['properties']['photo'][0]); + } + /** * @group parseU */