Skip to content

Commit

Permalink
fixed videos without information about having an audio
Browse files Browse the repository at this point in the history
  • Loading branch information
kringkaste committed Feb 26, 2021
1 parent 05f13c6 commit ab4285b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Instagram Feed Changelog

## 1.0.7 - 2021-02-26
### Fixed
- Fixed videos without information about having an audio.

## 1.0.6 - 2021-02-16
### Added
- Enable environment variables for setting username (thanks to @niektenhoopen)
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "codemonauts/craft-instagram-feed",
"description": "Craft CMS plugin to receive Instragram feed data as variable in templates.",
"version": "1.0.6",
"version": "1.0.7",
"type": "craft-plugin",
"keywords": [
"craft",
Expand Down
4 changes: 3 additions & 1 deletion src/services/InstagramService.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,9 @@ private function flattenMediaArray($mediaArray): array
$item['timestamp'] = $media['node']['taken_at_timestamp'];
$item['caption'] = $media['node']['edge_media_to_caption']['edges'][0]['node']['text'] ?? '';
$item['isVideo'] = (bool)$media['node']['is_video'];
$item['hasAudio'] = $item['isVideo'] ? (bool)$media['node']['has_audio'] : false;
if ($item['isVideo']) {
$item['hasAudio'] = isset($media['node']['has_audio']) ? (bool)$media['node']['has_audio'] : false;
}
$item['video_view_count'] = $media['node']['video_view_count'] ?? 0;
$items[] = $item;
}
Expand Down

0 comments on commit ab4285b

Please sign in to comment.