I know this has been asked before but for some reason that strategy doesn't seem to be working for me.
this is my code:
$(document).ready(function() {
$('#foo').click(function() {
var videoFile = 'video/law_cash.mp4';
$('#video_container video source').attr('src', videoFile);
});
});
the click function works and also when I check in firebug the video/law_cash.mp4 shows up in the right area. It just wont load when I click
EDIT: this is what im actually trying to do:
$(document).ready(function() {
var knicks = 'video/knicks_therapist.m4v';
law = 'video/law_cash.mp4';
fit = 'video/fit_some.mp4';
texas = 'video/texas_familia.mp4';
partner = 'video/drug.m4v';
keyspan = 'video/keyspan_nrg.mov';
$('#law').click(function() {
$('#video_container video source').attr开发者_StackOverflow社区('src', law);
$('#video_container video source').load();
});
$('#knicks').click(function() {
$('#video_container video source').attr('src', knicks);
$('#video_container video source').load();
});
$('#fit').click(function() {
$('#video_container video source').attr('src', fit);
$('#video_container video source').load();
});
$('#texas').click(function() {
$('#video_container video source').attr('src', texas);
$('#video_container video source').load();
});
$('#partner').click(function() {
$('#video_container video source').attr('src', partner);
$('#video_container video source').load();
});
$('#keyspan').click(function() {
$('#video_container video source').attr('src', keyspan);
$('#video_container video source').load();
});
});
html:
<a id="law" href="#">BLAH</a>
Firefox doesn't support MPEG audio/video formats... dunno why.
EDIT: If you have an onerror
event registered then it would fire, and the video element's error
object will tell you MEDIA_ERR_SRC_NOT_SUPPORTED
In the original example, I believe the code snippet to load the video should be
$('#video_container video').load();
(without 'source' tag after 'video' tag)
Just use javascript
video.src = 'new/url/video.ogv';
video.load(); // Load the new video
video.play(); // Play it
精彩评论