Why my youtube video does not stop? - php

Here is my code :-
<?php
$sql = "SELECT * FROM era_videos ORDER BY video_id";
$sqlex = mysqli_query($db,$sql);
$m = 1;
while($result = mysqli_fetch_assoc($sqlex))
{
?>
<div class="slide" current_id="<?php echo $m;?>" style="width:300px !important; height:200px !important;">
<object class="youtube" id="videoid<?php echo $m;?>" width="300" height="200"><param name="movie" value="https://www.youtube.com/v/<?php echo $result['urlname'];?>"version=3&hl=en_US&rel=0"> </param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="https://www.youtube.com/v/<?php echo $result['urlname'];?>"version=3&hl=en_US&rel=0" type="application/x-shockwave-flash" width="300" height="200" allowscriptaccess="always" allowfullscreen="true"></embed></object>
</div>
<?php
$m++;
}
?>
jQuery Code :-
jQuery('#iCarouselNext').click(function()
{
var current_id = parseInt($('.current').attr('current_id'));
var previous_id = current_id - 1;
$('#videoid'+previous_id).stopVideo();
});
But it throws an error - Uncaught TypeError: Object [object Object] has no method 'stopVideo'
I found this but no solution Stop a youtube video with jquery?
Thanks in advance

Use
$('#videoid'+previous_id).get(0).stopVideo();
Or
$('#videoid'+previous_id)[0].stopVideo();
Also there is an error in your logic of getting the current_id
var current_id = parseInt($('.current').attr('current_id'));
This will always give the first element's id.

Related

Why calling file by id is not working with jw player

I've came to an idea that looks very simple of how to hide video link to certain limit
Okay suppose we've
index.php
<?PHP
$media = 'http://www.some_site.com/get.php?id=2';
echo '<object id="mediaplayer" classid="clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#version=5,1,52,701" standby="loading microsoft windows media player components..." type="application/x-oleobject" width="300" height="225">
<param name="filename" value="'.$media.'">
<param name="animationatstart" value="true">
<param name="transparentatstart" value="true">
<param name="autostart" value="true">
<param name="showcontrols" value="true">
<param name="ShowStatusBar" value="true">
<param name="windowlessvideo" value="true">
<embed type="application/x-mplayer2" src="'.$media.'" autostart="true" showcontrols="true" showstatusbar="1" bgcolor="white" width="300" height="225">
</object>';
?>
and get.php code
<?PHP
$id = $_GET['id'];
if ($id === '2') {
$file = "http://www.real_site.com/video/test.wmv";
echo $file;
} else {
echo "die well";
}
?>
so when we call http://www.some_site.com/get.php?id=2 it will brings http://www.real_site.com/video/test.wmv and it worked
i've noticed that it works fine even with youtube embedding code iframe vlc and the ugly brothers quicktime realplayer players ... etc but not with JW Player
here is the code of index.php for case of jwplayer
<?PHP
$media = 'http://www.some_site.com/get.php?id=2';
// suppose it leads to youtube link or of what jw player support
echo "<script type='text/javascript' src='player/jwplayer.js'></script>
<div id='mediaspace'>This text will be replaced</div>
<script type='text/javascript'>
jwplayer('mediaspace').setup({
'flashplayer': 'player/player.swf',
'file': '".$media."',
'controlbar': 'bottom',
'width': '300',
'height': '225',
'skin': 'player/schoon.zip'
});
</script>";
?>
it print this error
so is there any reason or this ! ~ that out helps me a lot
Under:
'file': '".$media."',
Add:
'provider': 'video',
You should be all set!
You need redirect to media file instead of print file url:
<?PHP
$id = $_GET['id'];
if ($id === '2') {
$file = "http://www.real_site.com/video/test.wmv";
//echo $file;
header('Location: '.$file);
} else {
echo "die well";
}
?>

how to open a new file in php by clicking on some image click

I want to open a new window on image click. My code is:
<img src="images/input.jpg" width="100" style="border-radius:20px;
cursor:pointer;" onclick="javascript:window.open(<?php echo"<a
href='data.php?id=$date&id1=$d'></a>"?>,'','width=870,height=620');">
But it's not working; id and id1 are not passed on to the next page to be opened.
How can I fix this?
you need to use the direct url for window.open statement
<img src="images/input.jpg" width="100" style="border-radius:20px; cursor:pointer;"onclick="javascript:window.open(<?php echo"'data.php?id=$date&id1=$d'"?>,'','width=870,height=620');">
You shouldn't use an <a> tag.
You also need to encapsulate your URL in single quotes:
<img src="images/input.jpg" width="100" style="border-radius:20px;
cursor:pointer;"onclick="javascript:window.open('<?php echo
"data.php?id=$date&id1=$d" ?>','','width=870,height=620');">
Try this:
<?php
$date = '2013-07-01';
$id = '1';
?>
<script type="text/javascript">
function popupwindow(url, title, w, h) {
var left = (screen.width/2)-(w/2);
var top = (screen.height/2)-(h/2);
return window.open(url, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
}
</script>
<img src="images/input.jpg" width="100" style="border-radius:20px; cursor:pointer;" onclick="popupwindow('data.php?id=<?=$date?>&id=<?=$id?>', 'Popup', 200, 200)" />

how to open video in new window with all browser supports

I want to open one .mp4 video in new window on clicking a link.
now, i am using this function to open new window:
function showCreateProfilePopup()
{
var myAjax = $.ajax({
url: '<?php echo $this->config->item('url'); ?>info/createProfileVideo',
type: "POST",
success: function(response) {
var windowWidth = 625;
var windowHeight = 500;
var centerWidth = (window.screen.width - windowWidth) / 2;
var centerHeight = (window.screen.height - windowHeight) / 2;
myWindow = window.open('','Video','width='+windowWidth+', height='+windowHeight+',scrollbars=no,resizable=no, innerWidth='+windowWidth+', innerHeight='+windowHeight+',left='+centerWidth+',top='+centerHeight);
myWindow.document.write(response);
myWindow.focus();
}
});
}
Definitely it opens window but, not same size for all Browser.
and after that it post to another view with one video
like
:
<video controls="controls" poster="<?php echo $this->config->item('content_url'); ?>/images/scrublyVideo.png" width="610" height="450">
<source src="<?php echo $this->config->item('content_url'); ?>video/createProfileHelpVideo.mp4" type="video/mp4" />
<object width='610' height='450' id='player' name='player'>
<param name="movie" value="<?php echo $this->config->item('content_url'); ?>video/createProfileHelpVideo.mp4" />
<param name="allowFullScreen" value="true" />
<param name="wmode" value="transparent" />
<param name="autoStart" value="false">
<img alt="Scrubly" src="<?php echo $this->config->item('content_url'); ?>/images/scrublyVideo.png" width="640" height="360" title="Scrubly Create Profile Help" />
<embed src='<?php echo $this->config->item('content_url'); ?>video/createProfileHelpVideo.mp4' type='Svideo/mp4' allowfullscreen='true' allowscriptaccess='always' width='600' height='450'/>
</object>
</video>
anyone tell me the easiest way to open video which supports by all the browsers(Mozilla, Chrome and safari) ?????
-Thanks a lot....
Okey,
i got the answer by using jwPlayer library.
-Thanks for your valuable response...
http://www.longtailvideo.com/support/jw-player/jw-player-for-flash-v5/22420/embedding-with-webm-and-mp4-source/

Javascript php onclick

Hey guys im trying to make a javscript function that will execute php code. This is what I have that should work I think.
<script type="text/javascript">
function doit()
{
$.get("dumplings.php");
return false; }
</script>
Dumplings.php contains this
<?php
$format = '<OBJECT style="z-index:2; position:absolute; top:20%; left:44%;" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="320" HEIGHT="240" id="rice" ALIGN="">
<PARAM NAME=movie VALUE="rice.swf"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#333399> <EMBED src="rice.swf" quality=high bgcolor=#333399 WIDTH="320" HEIGHT="240" NAME="rice" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED> </OBJECT>';
echo $format;
?>
Here is my radio button:
<input name="sample_check3" id="sample_check3" value="1" type="radio" onclick="doit();"/>
Basically, it just does nothing. Any idea why its not working?
it propbably does something but when you fetch your page with the php code you do nothing with the result
try changing it to something like this
$.get("dumplings.php", function (data){
$('body').append(data);
});
the data will contain the data from your php page. In this example I just add it to the body. but you can do anything with it.
You must use $.get on a one of your's page element (
<span>,<div>,<p>
)
After radiobutton add
<div id="loadobjecthere"></div>
And change script to
<script type="text/javascript">
function doit()
{
$("#loadobjecthere").get("dumplings.php");
return false;
}
</script>
Also try to change onclick attribute to
"javascript:return doit();"

Insert Javascript variable into PHP return

I am sure this should be easy but I ahve been going crazy trying to get it to work:
return '<img border="0" src="'.$args['Image URL'].'?amount='.$args['invoiceAmount'].'&trans_id='.$args['invoiceNumber'].'&jrox_svalue_1=Sitename:javascript:document.write (sitename);" width="1" height="1">';
Essentially I need to inject the javascript varialbe "sitename" into the querystring value (jrox_svalue_1)for the image.
jrox_svalue_1=Sitename:javascript:document.write (sitename);
Any help would be apprecaited.
This should do the trick:
<script>
document.write("<?php echo '<img border="0" src="' . $args['Image URL'] . '?amount=' . $args['invoiceAmount'] . '&trans_id=' . $args['invoiceNumber'] . '&jrox_svalue_1=' ?>" + sitename + '" width="1" height="1">');
</script>
Hope this would help
<img id="jroxImg" src="'.$args['Image URL'].'?amount='.$args['invoiceAmount'].'&trans_id='.$args['invoiceNumber']." width="1" height="1">
<script type="text/javascript">
var jroxImgObj=document.getElementById('jroxImg');
var jroxImgSrc=jroxImgObj.getAttribute('src');
jroxImgSrc+="&jrox_svalue_1="+siteName;//document.location ??
jroxImgObj.setAttribute('src',jroxImgSrc);
</script>

Categories