Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
video_embed_html5
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
video_embed_html5
Commits
f98c6411
Commit
f98c6411
authored
8 years ago
by
Robin Ingelbrecht
Committed by
robin.ingelbrecht
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Updated readme
parent
1f6f42fc
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+18
-0
18 additions, 0 deletions
README.md
src/Plugin/video_embed_field/Provider/Html5.php
+8
-7
8 additions, 7 deletions
src/Plugin/video_embed_field/Provider/Html5.php
video_embed_html5.module
+15
-0
15 additions, 0 deletions
video_embed_html5.module
with
41 additions
and
7 deletions
README.md
0 → 100644
+
18
−
0
View file @
f98c6411
This module add support for embedding HTML5 videos into your website using Video Embed Field
## Installation
To install this module, do the following:
1.
Download the Video Embed HTML5 module and follow the instruction for
[
installing contributed modules
](
https://www.drupal.org/docs/8/extending-drupal-8/installing-contributed-modules-find-import-enable-configure-drupal-8
)
.
## Usage
1.
Install module
2.
Add video embed field and enable "HTML5" provider
3.
Add link that ends with mp4/ogg/webm
## Generating thumbnails
*
If you want to use the Thumbnail formatter, you have to install the
[
php_ffmpeg module
](
https://www.drupal.org/project/php_ffmpeg
)
*
Configure it properly (install dependent binaries)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/Plugin/video_embed_field/Provider/Html5.php
+
8
−
7
View file @
f98c6411
...
...
@@ -21,6 +21,7 @@ class Html5 extends ProviderPluginBase {
/** @var FFMpeg $phpFFMpeg */
protected
$phpFFMpeg
;
protected
$filename
;
/**
* Html5 constructor.
...
...
@@ -38,6 +39,10 @@ class Html5 extends ProviderPluginBase {
if
(
$module_handler
->
moduleExists
(
'php_ffmpeg'
))
{
$this
->
phpFFMpeg
=
\Drupal
::
service
(
'php_ffmpeg'
);
}
// Set filename for thumbnail.
list
(
$video_url
,
$video_type
)
=
$this
->
getVideoId
();
$this
->
filename
=
md5
(
$video_url
);
}
/**
...
...
@@ -75,13 +80,11 @@ class Html5 extends ProviderPluginBase {
if
(
!
file_exists
(
$local_uri
))
{
file_prepare_directory
(
$this
->
thumbsDirectory
,
FILE_CREATE_DIRECTORY
);
try
{
// Thumb does not exist yet. Generate it.
list
(
$video_url
,
$video_type
)
=
$this
->
getVideoId
();
// Thumb does not exist yet. Generate it.
$video
=
$this
->
phpFFMpeg
->
open
(
$video_url
);
$filename
=
md5
(
$video_url
);
$video
->
frame
(
TimeCode
::
fromSeconds
(
1
))
->
save
(
drupal_realpath
(
$this
->
thumbsDirectory
)
.
'/'
.
$filename
.
'.jpg'
);
->
save
(
drupal_realpath
(
$this
->
thumbsDirectory
)
.
'/'
.
$
this
->
filename
.
'.jpg'
);
}
catch
(
\Exception
$e
)
{
}
}
...
...
@@ -98,9 +101,7 @@ class Html5 extends ProviderPluginBase {
* {@inheritdoc}
*/
public
function
getLocalThumbnailUri
()
{
list
(
$video_url
,
$video_type
)
=
$this
->
getVideoId
();
$filename
=
md5
(
$video_url
);
return
$this
->
thumbsDirectory
.
'/'
.
$filename
.
'.jpg'
;
return
$this
->
thumbsDirectory
.
'/'
.
$this
->
filename
.
'.jpg'
;
}
/**
...
...
This diff is collapsed.
Click to expand it.
video_embed_html5.module
+
15
−
0
View file @
f98c6411
<?php
use
Drupal\Core\Routing\RouteMatchInterface
;
/**
* Implements hook_help().
*/
function
video_embed_html5_help
(
$route_name
,
RouteMatchInterface
$route_match
)
{
switch
(
$route_name
)
{
case
'help.page.video_embed_html5'
:
$output
=
file_get_contents
(
drupal_get_path
(
'module'
,
'video_embed_html5'
)
.
'/README.md'
);
return
'<pre>'
.
$output
.
'</pre>'
;
break
;
default
:
}
}
/**
* Implements hook_theme().
*/
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment