Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Recently i've updated both VideoJS and CCK (VideoJS 6.x-1.7 , CCK 6.x-3.0-alpha3) after the update all videos are displayed twice! I tried to find the problem and noticed that the CCK is displaying the video twice because i have two files (mp4 & webm) attached to the custom field. Here is the output when i print the items variable in modules/cck/theme/content-field.tpl.php line 35:
<div class="field field-type-filefield field-field-video-640-360">
<div class="field-items">
Array
(
[0] => Array
(
[fid] => 555
[uid] => 7
[filename] => 6_normal.mp4
[filepath] => sites/default/files/videos/6_normal_1.mp4
[filemime] => video/mp4
[filesize] => 1907641
[status] => 1
[timestamp] => 1326098418
[list] => 1
[data] =>
[nid] => 125
[#delta] => 0
[view] => <div class="video-js-box 0" id="videojs-125-field-video-640-360">
<video id="videojs-125-field-video-640-360-video" class="video-js" width="640" height="360" controls="controls" preload="auto" poster="http://exmaple.com/sites/default/files/posters/6_0.jpg">
<source src="http://exmaple.com/sites/default/files/videos/6_normal_1.mp4" type="video/mp4; codecs='avc1.42E01E, mp4a.40.2'" />
<source src="http://exmaple.com/sites/default/files/videos/6_normal_1.webm" type="video/webm; codec="vp8, vorbis"" />
<div class="vjs-flash-fallback"><div id='vjs-flash-fallback' style="width:640px;height:384px;" class="flowplayer"></div></div>
<div class="vjs-no-video">
<strong>Download Video:</strong>
<a href="http://exmaple.com/sites/default/files/videos/6_normal_1.mp4">MP4</a>,
<a href="http://exmaple.com/sites/default/files/videos/6_normal_1.webm">ATION/OCTET-STREAM</a>,
</div>
</video>
</div>
[empty] =>
)
[1] => Array
(
[fid] => 556
[uid] => 7
[filename] => 6_normal.webm
[filepath] => sites/default/files/videos/6_normal_1.webm
[filemime] => application/octet-stream
[filesize] => 2082726
[status] => 1
[timestamp] => 1326098431
[list] => 1
[data] =>
[nid] => 125
[#delta] => 1
[view] => <div class="video-js-box 0" id="videojs-125-field-video-640-360">
<video id="videojs-125-field-video-640-360-video" class="video-js" width="640" height="360" controls="controls" preload="auto" poster="http://exmaple.com/sites/default/files/posters/6_0.jpg">
<source src="http://exmaple.com/sites/default/files/videos/6_normal_1.mp4" type="video/mp4; codecs='avc1.42E01E, mp4a.40.2'" />
<source src="http://exmaple.com/sites/default/files/videos/6_normal_1.webm" type="video/webm; codec="vp8, vorbis"" />
<div class="vjs-flash-fallback"><div id='vjs-flash-fallback-1' style="width:640px;height:384px;" class="flowplayer"></div></div>
<div class="vjs-no-video">
<strong>Download Video:</strong>
<a href="http://exmaple.com/sites/default/files/videos/6_normal_1.mp4">MP4</a>,
<a href="http://exmaple.com/sites/default/files/videos/6_normal_1.webm">ATION/OCTET-STREAM</a>,
</div>
</video>
</div>
[empty] =>
)
)
<div class="field-item odd">
<div class="video-js-box 0" id="videojs-125-field-video-640-360">
<video id="videojs-125-field-video-640-360-video" class="video-js" width="640" height="360" controls="controls" preload="auto" poster="http://exmaple.com/sites/default/files/posters/6_0.jpg">
<source src="http://exmaple.com/sites/default/files/videos/6_normal_1.mp4" type="video/mp4; codecs='avc1.42E01E, mp4a.40.2'" />
<source src="http://exmaple.com/sites/default/files/videos/6_normal_1.webm" type="video/webm; codec="vp8, vorbis"" />
<div class="vjs-flash-fallback"><div id='vjs-flash-fallback' style="width:640px;height:384px;" class="flowplayer"></div></div>
<div class="vjs-no-video">
<strong>Download Video:</strong>
<a href="http://exmaple.com/sites/default/files/videos/6_normal_1.mp4">MP4</a>,
<a href="http://exmaple.com/sites/default/files/videos/6_normal_1.webm">ATION/OCTET-STREAM</a>,
</div>
</video>
</div>
</div>
<div class="field-item even">
<div class="video-js-box 0" id="videojs-125-field-video-640-360">
<video id="videojs-125-field-video-640-360-video" class="video-js" width="640" height="360" controls="controls" preload="auto" poster="http://exmaple.com/sites/default/files/posters/6_0.jpg">
<source src="http://exmaple.com/sites/default/files/videos/6_normal_1.mp4" type="video/mp4; codecs='avc1.42E01E, mp4a.40.2'" />
<source src="http://exmaple.com/sites/default/files/videos/6_normal_1.webm" type="video/webm; codec="vp8, vorbis"" />
<div class="vjs-flash-fallback"><div id='vjs-flash-fallback-1' style="width:640px;height:384px;" class="flowplayer"></div></div>
<div class="vjs-no-video">
<strong>Download Video:</strong>
<a href="http://exmaple.com/sites/default/files/videos/6_normal_1.mp4">MP4</a>,
<a href="http://exmaple.com/sites/default/files/videos/6_normal_1.webm">ATION/OCTET-STREAM</a>,
</div>
</video>
</div>
</div>
</div>
</div>
Any idea why this is happening?
Comments
Comment #1
Jorrit CreditAttribution: Jorrit commentedIf you make the following update to videojs.module and clear the Drupal cache, is the problem gone?
Search for:
CONTENT_HANDLE_CORE
Replace by:
CONTENT_HANDLE_MODULE
Comment #2
Jorrit CreditAttribution: Jorrit commentedFixed in git.
Comment #4
Nico_Laine CreditAttribution: Nico_Laine commentedHello,
You said it has been fixed but I have exactly the same problem: videos are displayed twice when I put 2 files for one field...
I tried to debug it seems that the field module split into different items.
Does someone have more explanations please ?!
Comment #5
Jorrit CreditAttribution: Jorrit commentedWith which version are you having this problem? Can I see the page with the two videos?
Comment #6
Nico_Laine CreditAttribution: Nico_Laine commentedI think I found the problem: I'm using the module "video" and "video.js" and it makes some problem when you want to put different sources for the video.
I tried to use video.js only alone with file field and it works!
Maybe we can close this discussion, thanks for your response.