我想使用 grails 2.3.0 ,grails resource plugin 1.2和videojs来显示视频。可以访问图像,但不能访问视频。我写的相应代码是:
23 <video id="knowledgeVideos" class="video-js vjs-default-skin" controls preload="none" width="640" height="264"
24 poster="${resource(dir:'images', file:'oceans-clip.png')}"
25 data-setup="{}">
26 <source src="${resource(dir:'videos', file:'ocean-clip.mp4')}" type='video/mp4' />
27 <source src="${resource(dir:'videos', file:'ocean-clip.webm')}" type='video/webm' />
28 <source src="${resource(dir:'videos', file:'ocean-clip.ogg')}" type='video/ogg' />
29
30 <track kind="captions" src="demo.captions.vtt" srclang="en" label="English"></track><!-- Tracks need an ending tag thanks to IE9 -->
31 </video>
我的视频位于web-app/videos
prayag@prayag:~/zazzercode/knowledge2coin$ ls -l web-app/videos/
total 21156
-rw-rw-r-- 1 prayag prayag 7036928 Oct 6 11:07 oceans-clip.mp4
-rw-rw-r-- 1 prayag prayag 14625011 Oct 6 11:07 oceans-clip.webm
我还在/videos/*
conf/Config.groovy
资源模式
36 // What URL patterns should be processed by the resources plugin
37 grails.resources.adhoc.patterns = ['/images/*', '/videos/*','/css/*', '/js/*', '/plugins/*']
我得到的例外是
Resource not found: /videos/ocean-clip.mp4
resource.ResourceMeta Resource not found: /videos/ocean-clip.mp4
Cannot locate resource [/videos/ocean-clip.mp4]
util.ResourceMetaStore Cannot locate resource [/videos/ocean-clip.mp4]
Invocation of <r:resource> for a resource that apparently doesn't exist: /knowledge2coin/videos/ocean-clip.mp4
resource.ResourceTagLib Invocation of <r:resource> for a resource that apparently doesn't exist: /knowledge2coin/videos/ocean-clip.mp4
Resource not found: /videos/ocean-clip.webm
resource.ResourceMeta Resource not found: /videos/ocean-clip.webm
Cannot locate resource [/videos/ocean-clip.webm]
util.ResourceMetaStore Cannot locate resource [/videos/ocean-clip.webm]
Invocation of <r:resource> for a resource that apparently doesn't exist: /knowledge2coin/videos/ocean-clip.webm
resource.ResourceTagLib Invocation of <r:resource> for a resource that apparently doesn't exist: /knowledge2coin/videos/ocean-clip.webm
Resource not found: /videos/ocean-clip.ogg
resource.ResourceMeta Resource not found: /videos/ocean-clip.ogg
Cannot locate resource [/videos/ocean-clip.ogg]
util.ResourceMetaStore Cannot locate resource [/videos/ocean-clip.ogg]
Invocation of <r:resource> for a resource that apparently doesn't exist: /knowledge2coin/videos/ocean-clip.ogg
resource.ResourceTagLib Invocation of <r:resource> for a resource that apparently doesn't exist: /knowledge2coin/videos/ocean-clip.ogg