1
浏览量计数器遇到一些麻烦。我真的使用CakePHP和PostgreSQL在这里,我们去HTML5视频浏览量计数器
<div class="video-slider">
<img
src="/app/webroot/files/white_post.jpg"
alt="altMessage"
class="post-image"
width=770
height=432>
<div class="video-container">
<video width=770 height=432 controls id=videoPlayer></video>
</div>
<div class="vertical-btn-container">
<div id="1" class="button" data-file="/path/to/files/video1.mp4" >
<img
src="/app/webroot/files/introduction.png"
alt="intro"
class="cover-image">
<p id="btn-text">btn text</p>
</div>
<div id="2" class="button" data-file="/path/to/files/video2.mp4">
<img
src="/app/webroot/files/enviromental_settings.png"
alt="settings"
class="cover-image">
<p id="btn-text">btn text</p>
</div>
<div id="3" class="button" data-file="/path/to/files/video3.mp4">
<img
src="/app/webroot/files/comparative_report.png"
alt="comparative"
class="cover-image">
<p id="btn-text">btn text</p>
</div>
<div id="4" class="button" data-file="/path/to/files/video3.mp4">
<img
src="/app/webroot/files/technical_requirements.png"
alt="technical"
class="cover-image">
<p id="btn-text">btn text</p>
</div>
<div id="5" class="button" data-file="/path/to/files/video5.mp4">
<img
src="/app/webroot/files/clinical_report_part1.png"
alt="clinical1"
class="cover-image">
<p id="btn-text">btn text</p>
</div>
<div id="6" class="button" data-file="/path/to/files/video6.mp4">
<img
src="/app/webroot/files/clinical_report_part2.png"
alt="calinical2"
class="cover-image">
<p id="btn-text">btn text</p>
</div>
<div id="7" class="button" data-file="/path/to/files/video7.mp4">
<img
src="/app/webroot/files/child_attentional_age_report.png"
alt="children"
class="cover-image">
<p id="btn-text">btn text</p>
</div>
</div>
</div>
<!-- End of sub menu -->
<script type="text/javascript">
$('.video-container').hide();
var b = $('.button');
for(i = 0; i<b.length; i++) {
b[i].addEventListener('click',swapVideo,true);
}
function swapVideo(e) {
var id = this.id;
console.log();
var par = $(e.target).parent();
if(par[0].childElementCount > 2) {
par = $(this);
$('#videoPlayer')[0].src = e.target.getAttribute('data-file');
} else {
$('#videoPlayer')[0].src = par[0].attributes[2].nodeValue;
}
b.removeClass('playing'); //canceling gray color
par.addClass('playing'); //draw clicked button to gray color
$('#videoPlayer')[0].play();
$('.post-image').hide();
$('.video-container').show();
}
</script>
这是index.ctp
function index($id=null) {
$this->layout = 'app_ui_listview';
$counter = $this->EntityCounter->find('list', array('fields' => array('EntityCounter.id', 'EntityCounter.value')));
CakeLog::write('debug',print_r($counter,1));
$this->set('counter', $counter);
}
模板这是控制器, ,进行了一些处理表 “entity_counters
”。
我应该按下我的播放器中切换视频的任何按钮,并根据它的ID增加基地的值,但我几乎没有任何想法。