1
|
# Media: YouTube
|
2
|
|
3
|
Media: YouTube integrates with the Media module to make YouTube videos
|
4
|
available as file entities. Users can insert YouTube videos with file fields
|
5
|
or directly into into WYSIWYG text areas with the Media module insert button.
|
6
|
|
7
|
|
8
|
## File fields
|
9
|
|
10
|
- Add a new "file" type field to your content type or entity. Choose the widget
|
11
|
type "Multimedia browser". You can also select an existing file field.
|
12
|
- While setting up the field (or after selecting "edit" on an existing field)
|
13
|
enable:
|
14
|
- Enabled browser plugins: "Web"
|
15
|
- Allowed remote media types: "Video"
|
16
|
- Allowed URI schemes: "youtube:// (YouTube videos)"
|
17
|
|
18
|
- On "Manage display" for the file field's content or entity type, choose
|
19
|
"Rendered file" and a view mode.
|
20
|
- Set up YouTube video formatter options for each view mode in Structure ->
|
21
|
File types -> Manage file display. This is where you can choose size, autoplay,
|
22
|
appearance, and special JS API integration options.
|
23
|
- When using the file field while creating or editing content, paste a YouTube
|
24
|
video url into the Web tab.
|
25
|
|
26
|
ProTip: You can use multiple providers (e.g., Media: YouTube and Media: Vimeo)
|
27
|
on the same file field.
|
28
|
|
29
|
|
30
|
## WYSIWYG inserts
|
31
|
|
32
|
- Enable the Media module "Media insert" button on your WYSIWYG profile.
|
33
|
- Enable "Convert Media tags to markup" filter in the appropriate text formats.
|
34
|
- Configure any desired settings in Configuration -> Media -> "Media browser
|
35
|
settings"
|
36
|
- Set up YouTube video formatter options in Structure -> File types -> Manage
|
37
|
file display. **Note:** for any view mode that will be used in a WYSIWYG,
|
38
|
enable both the YouTube video and preview image formatter. Arrange the Video
|
39
|
formatter on top. This allows the video to be used when the content is viewed,
|
40
|
and the preview when the content is being edited.
|
41
|
|
42
|
- When editing a text area with your WYSIWYG, click the "Media insert" button,
|
43
|
and paste a YouTube video url into the Web tab of the media browser.
|
44
|
|
45
|
|
46
|
## Upgrading from 7.x-1.x or 7.x-2.0-alpha-2 to 7.x-2.0
|
47
|
|
48
|
There are some important changes between the older recommended versions of
|
49
|
Media: YouTube and the new stable release that may require manual updating.
|
50
|
|
51
|
- 2.0 uses the YouTube iframe embed with the currently supported player
|
52
|
parameters. If you were relying on parameters that no longer work with
|
53
|
the iframe player, you may see some minor differences in player appearance.
|
54
|
Please review your formatter settings after you update.
|
55
|
|
56
|
- **The markup for the player embed has changed.** The 2.0 and 2.x-dev versions
|
57
|
use simplified and updated markup that integrates better with responsive
|
58
|
video techniques. There is a tpl provided at /includes/themes/media-youtube-
|
59
|
video.legacy-example.tpl.php that duplicates the old markup. To use it, copy
|
60
|
it to your theme folder and rename it to media-youtube-video.tpl.php. It is
|
61
|
recommended that you revise any css or javascript that requires the old
|
62
|
markup and then delete the legacy markup tpl file.
|
63
|
|
64
|
|
65
|
## Further Reading
|
66
|
|
67
|
- Media 2.x Overview, including file entities and view modes:
|
68
|
http://drupal.stackexchange.com/questions/40229/how-to-set-media-styles-in-media-7-1-2-media-7-2-x/40685#40685
|
69
|
- Media 2.x Walkthrough: http://drupal.org/node/1699054
|
70
|
- YouTube player parameters and explanation. Media: YouTube uses only iframe
|
71
|
player parameters:
|
72
|
https://developers.google.com/youtube/player_parameters#Parameters
|
73
|
- YouTube JS API example:
|
74
|
http://stackoverflow.com/questions/7443578/youtube-iframe-api-how-do-i-control-a-iframe-player-thats-already-in-the-html/7513356#7513356
|