Skip to content

Commit 2627a0b

Browse files
committed
Incorporated review suggestion to all versions including v16
1 parent 1f239c2 commit 2627a0b

File tree

5 files changed

+44
-10
lines changed

5 files changed

+44
-10
lines changed

10/umbraco-cms/fundamentals/design/rendering-media.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ If you upload a video file (such as `.mp4`) to the Media library, Umbraco will s
106106

107107
The example above assumes that:
108108

109-
* You've uploaded an MP4 file to the **Media** section.
109+
* You've uploaded an `.mp4` file to the **Media** section.
110110
* You want to include basic playback controls in the browser.
111111
* You know the media item’s ID.
112112

13/umbraco-cms/fundamentals/design/rendering-media.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ It is always worth having null-checks around your code when retrieving media in
7878

7979
## Working with Video files
8080

81-
If you upload a video file (such as .mp4) to the Media library, Umbraco will store it as a Video Media Type by default. Unlike images, video files won’t include properties like `umbracoWidth` or `umbracoHeight`, but you can still retrieve the media item and render it using the `<video>` HTML tag.
81+
If you upload a video file (such as `.mp4`) to the Media library, Umbraco will store it as a Video Media Type by default. Unlike images, video files won’t include properties like `umbracoWidth` or `umbracoHeight`, but you can still retrieve the media item and render it using the `<video>` HTML tag.
8282

8383
### Example: Rendering a Video Media item
8484

@@ -102,9 +102,9 @@ If you upload a video file (such as .mp4) to the Media library, Umbraco will sto
102102
}
103103
```
104104

105-
This example assumes that:
105+
The example above assumes that:
106106

107-
* You've uploaded an MP4 file to the **Media** section.
107+
* You've uploaded an `.mp4` file to the **Media** section.
108108
* You want to include basic playback controls in the browser.
109109
* You know the media item’s ID.
110110

14/umbraco-cms/fundamentals/design/rendering-media.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ It is always worth having null-checks around your code when retrieving media in
7878

7979
## Working with Video files
8080

81-
If you upload a video file (such as .mp4) to the Media library, Umbraco will store it as a Video Media Type by default. Unlike images, video files won’t include properties like `umbracoWidth` or `umbracoHeight`, but you can still retrieve the media item and render it using the `<video>` HTML tag.
81+
If you upload a video file (such as `.mp4`) to the Media library, Umbraco will store it as a Video Media Type by default. Unlike images, video files won’t include properties like `umbracoWidth` or `umbracoHeight`, but you can still retrieve the media item and render it using the `<video>` HTML tag.
8282

8383
### Example: Rendering a Video Media item
8484

@@ -102,9 +102,9 @@ If you upload a video file (such as .mp4) to the Media library, Umbraco will sto
102102
}
103103
```
104104

105-
This example assumes that:
105+
The example above assumes that:
106106

107-
* You've uploaded an MP4 file to the **Media** section.
107+
* You've uploaded an `.mp4` file to the **Media** section.
108108
* You want to include basic playback controls in the browser.
109109
* You know the media item’s ID.
110110

15/umbraco-cms/fundamentals/design/rendering-media.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ It is always worth having null-checks around your code when retrieving media in
7878

7979
## Working with Video files
8080

81-
If you upload a video file (such as .mp4) to the Media library, Umbraco will store it as a Video Media Type by default. Unlike images, video files won’t include properties like `umbracoWidth` or `umbracoHeight`, but you can still retrieve the media item and render it using the `<video>` HTML tag.
81+
If you upload a video file (such as `.mp4`) to the Media library, Umbraco will store it as a Video Media Type by default. Unlike images, video files won’t include properties like `umbracoWidth` or `umbracoHeight`, but you can still retrieve the media item and render it using the `<video>` HTML tag.
8282

8383
### Example: Rendering a Video Media item
8484

@@ -102,9 +102,9 @@ If you upload a video file (such as .mp4) to the Media library, Umbraco will sto
102102
}
103103
```
104104

105-
This example assumes that:
105+
The example above assumes that:
106106

107-
* You've uploaded an MP4 file to the **Media** section.
107+
* You've uploaded an `.mp4` file to the **Media** section.
108108
* You want to include basic playback controls in the browser.
109109
* You know the media item’s ID.
110110

16/umbraco-cms/fundamentals/design/rendering-media.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,40 @@ As with example one, we are accessing a MediaType `image` using the same Guid as
7676
It is always worth having null-checks around your code when retrieving media in case the conversion fails or Media() returns null. This makes your code more robust.
7777
{% endhint %}
7878

79+
## Working with Video files
80+
81+
If you upload a video file (such as `.mp4`) to the Media library, Umbraco will store it as a Video Media Type by default. Unlike images, video files won’t include properties like `umbracoWidth` or `umbracoHeight`, but you can still retrieve the media item and render it using the `<video>` HTML tag.
82+
83+
### Example: Rendering a Video Media item
84+
85+
```csharp
86+
@{
87+
var videoUrl = string.Empty;
88+
var videoMediaItem = Umbraco.Media(Guid.Parse("8c49c5d3-cb2a-48b2-87c9-7e2c1873e948"));
89+
90+
if (videoMediaItem != null)
91+
{
92+
videoUrl = videoMediaItem?.Url();
93+
}
94+
}
95+
96+
@if (!string.IsNullOrEmpty(videoUrl))
97+
{
98+
<video width="640" height="360" controls>
99+
<source src="@videoUrl" type="video/mp4">
100+
Your browser does not support the video tag.
101+
</video>
102+
}
103+
```
104+
105+
The example above assumes that:
106+
107+
* You've uploaded an `.mp4` file to the **Media** section.
108+
* You want to include basic playback controls in the browser.
109+
* You know the media item’s ID.
110+
111+
You can also add custom properties to your Video Media Type (for example: `thumbnail`, `autoplay`, `caption`) under **Settings** > **Media Types**.
112+
79113
### Other Media Items such as `File`
80114

81115
Accessing other media items can be performed in the same way. The techniques are not limited to the `Image` type, but it is one of the most common use cases.

0 commit comments

Comments
 (0)