Reputation: 592
I have an embedded video and I only want to allow logged-in users to view it.
If a user is not logged in and tries to play it must log an alert
I try following way but it does not work:
<div id="container">
<embed id="playerid" width="300" height="200" flashvars="file=http://www.mydomain.com/Video/demo.flv&autostart=false&stretching=fill&image=http://www.mydomain.com/Video/demo.jpg&logo=http://www.mydomain.com/Video/Watermark.gif" allowscriptaccess="always" allowfullscreen="true" quality="high" bgcolor="#330099" name="ply" id="ply" style="undefined" src="player.swf" type="application/x-shockwave-flash">
</div>
my jQuery code is
<script>
<?php
if(!$login){
?>
$(document).ready(function(){
$('#container').click(function(){
alert('video clicked');
});
});
<?php
}
?>
</script>
Upvotes: 1
Views: 80
Reputation: 40
Try this:
<?php $login = true; //Let's make it true just for testing ?>
<script>
$(document).ready(function(){
$('#container').click(function(){
if("<?php echo($login); ?>"){
alert('Play Video');
}else{
alert("Please login to play video");
}
});
</script>
Upvotes: 1