PHP loading JS video player - javascript

So I have this PHP script to show my videos in Fluid Player, it looks like this:
while($video = mysqli_fetch_array($resultat_video, MYSQLI_ASSOC))
{
echo "<video id='video-id'><source src='mov/$video[filnavn]' type='video/mp4' />";
}
Loading the Javascript to load Fluid players looks like this:
<script>
var myFP = fluidPlayer(
'video-id', {
"layoutControls": {
"controlBar": {
"autoHideTimeout": 3,
"animated": true,
"autoHide": true
},
"htmlOnPauseBlock": {
"html": null,
"height": null,
"width": null
},
"autoPlay": false,
"mute": true,
"allowTheatre": true,
"playPauseAnimation": false,
"playbackRateEnabled": false,
"allowDownload": false,
"playButtonShowing": false,
"fillToContainer": false,
"posterImage": ""
},
"vastOptions": {
"adList": [],
"adCTAText": false,
"adCTATextPosition": ""
}
});
</script>
This works perfectly for one video, but i guess I can't call the same ID in my PHP ID and expet it to work, so I guess it needs some sort of invidual ID both in the PHP and also in the Javascript?
I'm very new to Javascript so all help is apprichiated alot :)
Regards,
Jan

Related

Fancybox not running perfectly

I have written the following code in my project
$('[data-fancybox]').fancybox({
// Options will go here
infobar: false,
buttons : [
"zoom",
"slideShow",
//"fullScreen",
//"download",
"thumbs",
"close"
],
wheel : false,
transitionEffect: "slide",
// thumbs: false,
// hash : false,
// keyboard : true,
toolbar: true,
// animationEffect : false,
// arrows : true,
clickContent: false,
afterLoad: function() {
if (!$('.fancybox-button--play').hasClass("fancybox-button--pause")) {
$('.fancybox-button--play').trigger('click');
}
}
});
That code is not executing... however, When I execute it in console it perfectly works... What I am doing wrong?
Please try to load your script under "$( document ).ready()"

Getting a Garbage value on Printing a Page in PHP Desktop

I am Printing a invoice I filled with input values for print, After generating Final Invoice I am getting Garbage value not in correct format I have shared Below Image. But if I use Php Desktop on external Browser then Printing a page getting correct value. Thanks in Advance.
This is My json for php Desktop
{
"application": {
"single_instance_guid": "",
"dpi_aware": true
},
"debugging": {
"show_console": false,
"subprocess_show_console": false,
"log_level": "DEBUG4",
"log_file": "debug.log"
},
"main_window": {
"title": "PHP Desktop",
"icon": "",
"default_size": [1024, 768],
"minimum_size": [800, 600],
"maximum_size": [0, 0],
"disable_maximize_button": false,
"center_on_screen": true,
"start_maximized": false,
"start_fullscreen": false,
"print": true
},
"popup_window": {
"icon": "",
"fixed_title": "",
"center_relative_to_parent": true,
"default_size": [1024, 768]
},
"web_server": {
"listen_on": ["127.0.0.1", 0],
"www_directory": "www",
"index_files": ["index.html", "index.php"],
"cgi_interpreter": "php/php-cgi.exe",
"cgi_extensions": ["php"],
"cgi_temp_dir": "",
"404_handler": "/pretty-urls.php"
},
"chrome": {
"log_file": "debug.log",
"log_severity": "default",
"cache_path": "webcache",
"external_drag": true,
"external_navigation": true,
"reload_page_F5": true,
"devtools_F12": true,
"remote_debugging_port": 0,
"command_line_switches": {},
"enable_downloads": true,
"context_menu": {
"enable_menu": true,
"navigation": true,
"print": true,
"view_source": true,
"open_in_external_browser": true,
"devtools": true
}
}
}
The Above json is for PHP Desktop Settings, should I change anything in this json?
Below is my code.
function data() {
var separateDecimal = lclTotal.toString().split('.');
var paisa = parseInt(separateDecimal[1]);
var paisaInt = parseInt(paisa);
$("#txtPrintName").val($("#name").val());
$("#txtPrintAddress").val($("#address").val());
$("#txtPrintMobile").val($("#mobile").val());
}
$(document).on("click", "#print", function (e) {
// $("#supplier-info, #invoice-no, #txtUniqueNo, #delivery-note, #supplier-reference, #txtSupplierRef, #buyer, #buyer-label, #buyer-label, #txtCusName, #txtAddress, #txtGSTIN").printThis({
$("#printCode").printThis({
debug: true, // show the iframe for debugging
importCSS: true, // import page CSS
importStyle: true, // import style tags
printContainer: true, // grab outer container as well as the contents of the selector
loadCSS:"sale.css", // path to additional css file - use an array [] for multiple
pageTitle: "TAX INVOICE", // add title to print page
removeInline: true, // remove all inline styles from print elements
printDelay: 300, // variable print delay; depending on complexity a higher value may be necessary
base: true,
footer: "", // prefix to html
formValues: true // preserve input/form values
});
});
I got Fixed with, I changed version of the PHP Desktop.

How parse site after loading javascripts with Java

Hello i need get video url from site with parsing from json. But i can't get video with tag because it creting with javascript.
<script>var player = jwplayer('player-embed');
player.setup({"file": "http://dushanbe.mix.tj/video/2/45/5bafae1306081.mp4", "image": "/img/b/7/42/113989.jpg", "aspectratio": "16:9", "autostart": false, "controls": true, "displaydescription": false, "displaytitle": false, "flashplayer": "/player/jwplayer-7.8.7/jwplayer.flash.swf", "key": "n+94L7vjfQNGEin57ap3glk3iRNum2o7AeOIWw==", "mute": false, "ph": 1, "pid": "mS6Np6yN", "preload": "auto", "primary": "html5", "repeat": false, "stagevideo": false, "stretching": "uniform", "width": "100%"});</script>
How parse site after loading javascripts on Java ?

MP3 Files not playing through inline player

I have a page loading a datatable of mp3 files through a server side script. I am using the sound manager plugin to play the files, however they do not play inline and only open in a new window. I think this is because the inline player is initializing before the table is fully loaded, so it is not finding the mp3 files. How can I get the "listen" button to play these files inline (on the page)?
Javascript:
<script src="{{asset('soundmanager/js/soundmanager2-jsmin.js')}}"></script>
<script src="{{asset('soundmanager/js/inlineplayer.js')}}"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#uploads-table').dataTable( {
"bProcessing": true,
"bServerSide": true,
"bPaginate": true,
"destroy": true,
"sAjaxSource": "/api/admin/tables/uploads",
"order": [[5,'desc']],
"columnDefs": [ { //this prevents errors if the data is null
"targets": "_all",
"defaultContent": ""
} ],
"columns": [
// title will auto-generate th columns
{ "data": "name", "title": "Name", "orderable": true, "searchable": true },
{ "data": "description", "title": "Description", "orderable": true, "searchable": true },
{ "data": "file_extension", "title": "File Extension", "orderable": true, "searchable": true },
{ "data": "mimetype", "title": "Mimetype", "orderable": true, "searchable": true },
{ "data": "created_by", "title": "Created By", "orderable": true, "searchable": true },
{ "data": "created_at", "title": "Created At", "orderable": true, "searchable": true },
{ "data": "updated_at", "title": "Updated At", "orderable": true, "searchable": true },
{ "data": "actions", "title": "Actions", "orderable": false, "searchable": false}
]
});
});
</script>
Server side script:
$upload = Upload::select(array('id','name', 'description', 'file_extension', 'mimetype', 'created_by', 'created_at', 'updated_at', 'filename', 'is_remote'));
return Datatables::of($upload)
->edit_column('name', '{{$name}}')
->edit_column('created_by', function($upload) {
return ($upload->user ? ''.$upload->user->username.'' : 'Unknown');
})
->edit_column('actions', function($upload) {
if($upload->is_remote) {
$filePath = URL::to($upload->filename);
}
else {
$filePath = URL::to($upload->getFilePath());
}
return ('Listen
View
Edit
<a data-itemname="'.$upload->name.'" data-action="/admin/content/uploads/'.$upload->id.'/delete" data-title="Delete Upload?" data-toggle="modal" href="#deleteModal" class="confirmDelete btn btn-xs btn-default">Delete</a>');
})
->remove_column('id')
->make(true);
Use drawCallback option to initialize SoundManager2 player on every table draw.
$('#uploads-table').dataTable( {
drawCallback: function(settings){
// Workaround: remove click event handler from
// MP3 links other than the once in the table.
inlinePlayer.removeEventHandler(document, 'click', inlinePlayer.handleClick);
inlinePlayer.init()
},
// other options
});
Please note, that initializing the player is the only way to force it to rescan MP3 links. If you have other MP3 links on the page they may be initialized twice. That is why I included the line to remove click event handler before re-initializing the player.

Disable keyboard Keys in WYSIHTML5

I want to disable all keyboard keys in wysihtml5 text editor .
I am using this editor https://github.com/bassjobsen/wysihtml5-image-upload
can anyone help me to do this. I have try "load" event and its works perfectly but i cannot use "onkeypress" or "onkeyup"\
var defaultOptions = $.fn.wysihtml5.defaultOptions = {
"font-styles": false,
"color": false,
"emphasis": false,
"lists": false,
"html": false,
"link": false,
"image": true,
events: {
"load": function() {
console.log('loaded!');
}
},
I think that is the answer below
var defaultOptions = $.fn.wysihtml5.defaultOptions = {
"font-styles": false,
"color": false,
"emphasis": false,
"lists": false,
"html": false,
"link": false,
"image": true,
events: {
"load": function() {
$('.wysihtml5-sandbox').contents().find('body').on("keydown",function(event) {
return false;
});
}
},

Categories

Resources