Im trying to use ajax and jquery to change src with videojs, so far i tried wrote this code
function getStream(response) {
var video = $("#my-video")
$.ajax({
type:'POST',
url:'status.php?stream',
data:{response:response},
dataType: 'json',
success:function(res){
video.find('source').attr('src',res.stream);
video.get().load();
video.get().play();
},
error: function(jqXHR, textStatus, errorThrown){
}
});
}
my html
<video
id="my-video"
class="video-js vjs-default-skin vjs-big-play-centered"
controls
preload="auto"
width="640"
height="264"
poster="images/enkwentro.jpg"
data-setup='{"fluid" : true, "techorder" : ["flash"]}'
>
<source id="source" src="" type="rtmp/mp4" />
<p class="vjs-no-js">
To view this video please enable JavaScript, and consider upgrading to a
web browser that supports HTML5 video
</p>
</video>
the video is not playing , note that the stream url is working and i tested it from server , but to set on src its not working, and when i directly put url in src in html, its working and no problem
thanks