I've a route which says like /video/:_id/:slug
now on this route I want to get the video url from the _id and now I want to scrap that url and I want to send this url as a source to video element in html
I tried like below but it is not working
this.route("video",{
path:'/video/:_id/:slug',
waitOn: function() {
Meteor.subscribe('singleVideo', this.params._id);
},
onBeforeAction: function () {
},
data:function(){
Session.set("currentVideoId",this.params._id);
var video;
video= Videos.findOne({_id: this.params._id});
Meteor.call("videoData",video.videourl,function(er,da){
Session.set('vurl',da);
});
console.log(video);
return {
video:video
};
},
in the html
<video id="videoId" class="video-js vjs-default-skin vjs-big-play-centered"
controls width="720" height="480"
poster="{{video.thumbs}}">
<source type='video/mp4' src="{{uurl}}" />
<!-- <source type='video/mp4' /> -->
</video>
In the JS
'uurl':function(){
urlDep.depend();
console.log("changed");
return Session.get("vurl");
}
I know this is a bad practice, Is there any standard way of doing this,because this is not working my server method
page.open(url, function (status) {
page.getContent(function(content) {
var $ = cheerio.load(content);
var mp4Link = $('#xvideos_pic > a').attr('href');
console.log(mp4Link);
fut.return(mp4Link);
});
});
return fut.wait();
Any suggestions on how to do it?