Skip to content

Commit

Permalink
Adds the isMuxVideo() and isMuxVideoReady() asset methods. Bump to 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mmikkel committed Jun 21, 2023
1 parent d5f254d commit 22f530c
Show file tree
Hide file tree
Showing 4 changed files with 29 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 @@
# MuxMate Changelog

## 1.1.0 - 2023-06-21
### Added
- Added the `isMuxVideo()` and `isMuxVideoReady()` asset methods.

## 1.0.3 - 2023-06-21
### Fixed
- Fixed an issue where the `getMuxAspectRatio()` always returned `1`
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,12 @@ Per-volume config settings. Currently only supports a `baseUrl` setting, see "Ov
## Mux asset methods and attributes
MuxMate adds some methods and attributes to asset models:

### `isMuxVideo()` [bool]
Returns `true` if the asset has a Mux playback ID.

### `isMuxVideoReady()` [bool]
Returns `true` if the asset has a Mux playback ID and a "ready" status, i.e. is ready to play.

### `getMuxVideo()` [Markup|null]
If the asset has a Mux playback ID, returns a `<mux-video>` web component.

Expand All @@ -305,7 +311,7 @@ If the asset has a Mux playback ID, returns an animated GIF from the video.
### `getMuxAssetId()` [string|null]
Returns the Mux asset ID.

### `getMuxAssetId()` [string|null]
### `getMuxPlaybackId()` [string|null]
Returns the Mux playback ID.

### `getMuxData()` [array|null]
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vaersaagod/muxmate",
"description": "Mux ado about streaming, mate!",
"type": "craft-plugin",
"version": "1.0.3",
"version": "1.1.0",
"require": {
"php": ">=8.1",
"craftcms/cms": "^4.4.0",
Expand Down
17 changes: 17 additions & 0 deletions src/behaviors/MuxAssetBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,23 @@
class MuxAssetBehavior extends Behavior
{


/**
* @return bool
*/
public function isMuxVideo(): bool
{
return !empty($this->getMuxPlaybackId());
}

/**
* @return bool
*/
public function isMuxVideoReady(): bool
{
return $this->getMuxStatus() === 'ready';
}

/**
* @return string|null
*/
Expand Down

0 comments on commit 22f530c

Please sign in to comment.