Jump to content

Chrisj

Members
  • Posts

    537
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Chrisj

  1. Thank you again. Yes, what I'm trying to change is the amount that uploaders are credited which is calculated as half of $video_cost which is the default price. Yes, "if they set their video with a custom price of half the default price, they would get 100% of the cost and the site would get nothing", so I need to set default price as minimum somehow. "already have an example: the earlier code that was calculating the total for all the videos to play", yes, but I don't know how or where to put that modified example, I didn't write this code, and my knowledge (as you can tell) is limited. any additional direction will be welcomed.
  2. Yes, initially for testing purposes "the uploader only gets half the default video price and your site keeps the rest". Regarding "that would mean the uploader is setting a price for you that doesn't affect what they get", if they raise the price they get a bigger 50%, right? Currently, the uploader sets the price but isn't getting 50% "do the same thing when crediting the uploader", can you give me an example, please?
  3. Thanks for your replies. Yes, "$uploader_amount is supposed to be how much the uploader of each video to view gets for the view, and originally is the default video amount minus $charge". The uploader can now optionally change the default price, and I believe it is this line: $amout += $video->video_play_price?$video->video_play_price:$video_cost; I'm trying to get it so when the default price is changed, and a purchase is made, $uploader_amount should then be how much the uploader of each video to view gets for the view, not the default video amount minus $charge, but new video price amount minus $charge. These two attempts were unsuccessful: $uploader_amount = $video_play_price - $charge; $uploader_amount = $amout - $charge; any additional help will be appreciated.
  4. This code, that I didn't write, but am trying to modify, generates the cost of a video purchase. One line (line 32) is a formula , I believe for setting a purchase price amount: $amout += $video->video_play_price?$video->video_play_price:$video_cost; Another line (line 50) is a formula for deducting to create another amount: $uploader_amount = $video_cost - $charge; I think line 50 is correct except for I don't think $video_cost in the final price, but I'm no expert at reading this code. I tried this without success: $uploader_amount = $video_play_price - $charge; Here is the full code, any help with line 50, will be appreciated. <?php if (IS_LOGGED == false) { $data = array('status' => 400, 'error' => 'Not logged in'); echo json_encode($data); exit(); } if (!empty($_POST['id'])) { if (!is_array($_POST['id'])) { $id_array[] = $_POST['id']; } else { $id_array = $_POST['id']; } // get cost video $db->where('name', 'video_play_price'); $db_cost = $db->getOne('config'); $video_cost = (float)$db_cost->value; $count_video = count($id_array); $user_id = $user->id; $wallet = (float)str_replace(',', '', $user->wallet); $amout = 0; foreach ($id_array as $id) { $video_id = (int)PT_Secure($id); // get video data $video = $db->where('id', $id)->getOne(T_VIDEOS); $amout += $video->video_play_price?$video->video_play_price:$video_cost; } // $amout = $video_cost * $count_video; $charge = ( $video_cost *0.50 ); if ($wallet >= $amout) { $new_wallet = (string)($wallet - $amout); $db->startTransaction(); $inserted_records = 0; foreach ($id_array as $id) { $video_id = (int)PT_Secure($id); $uploader_amount = $video_cost - $charge; // get video data $video = $db->where('id', $id)->getOne(T_VIDEOS); // add data to paid table $insert_buy = $db->insert('u_paid_videos', [ 'id_user' => $user_id, 'id_video' => $video_id, 'session_key' => $_SESSION['session_key'], 'video_play_price' => (string)$video_cost, 'video_title' => $video->title, 'user_id_uploaded' => $video->user_id, //'up_credit'=>$video_cost, 'up_credit'=>$uploader_amount, ]); if ($insert_buy) { $inserted_records++; } //add wallet users' video $userwallet = $db->where('id', $video->user_id)->getOne(T_USERS); //$videouserwallet = $userwallet->wallet+$video_cost; $videouserwallet = $userwallet->wallet+$uploader_amount; $db->where('id', $video->user_id); $update_wallet = $db->update(T_USERS, [ // 'wallet' => $videouserwallet, 'wallet' => number_format($videouserwallet, 2, '.', ''), ]); } $db->where('id', $user_id); $update_wallet = $db->update(T_USERS, [ 'wallet' => $new_wallet, ]); if (($inserted_records == $count_video) && $update_wallet) { $db->commit(); echo json_encode([ 'status' => 200 ]); exit(); } else { $db->rollback(); echo json_encode([ 'status' => 400, 'error' => 'Buy process error' ]); exit(); } } else { echo json_encode([ 'status' => 400, 'error_num' => 1, 'error' => 'Not enough money' ]); exit(); } } else { echo json_encode([ 'status' => 400, 'error' => 'Bad Request, Invalid or missing parameter' ]); exit(); }
  5. I am purchasing a web script and will be installing it on my host server where I have two domain accounts, and the domains are resolved to the server.I asked the developer if I decided to change the domain name, at some point after install, what I could do, and was told to make the change it the config.php file. After I make that change, and I make the changes needed in WHM/cPanel, besides copying the db over, what else would need to be done to have a complete domain change?
  6. Thanks again. How do I "onclick events for View buttons have to be reassigned ", would it be a modification to the code I posted in my initial request here?
  7. I received help with this, and that helper is not currently available. But I'm guessing it has to do with the script.js file and this portion of it: function PT_MultipleBuyVideo() { var checked = getSelectedVideos(); if (!checked) { return false; } swal({ title: "", type: "info", html:"Simply proceed to purchase " + countSelectedVideos() + " videos", showCancelButton: true, cancelButtonText: "Close", customClass: 'sweetalert-lg', confirmButtonText:'Proceed' }).then(function(){ $.ajax({ url: PT_Ajax_Requests_File() + 'aj/buy-video', type: 'POST', dataType: 'json', data: {id:checked}, }).done(function(data){ if (data.status == 200) { for (var i = 0; i < checked.length; i++) { var button = $("button[data-action='multiple_select_button'][data-id='" + checked[i] + "']") buttonMultipleSelectingStyle(button, 'purchased'); } swal({ title: "Success", type: "success", html:"", showCancelButton: true, cancelButtonText: "Close", customClass: 'sweetalert-lg', confirmButtonText:'Go To Video(s)' }).then(function(){ window.location.href='/paid-list'; }); } else { if (data.error_num == 1) { swal( 'Error!', 'Not enough money', 'error' ); } else { swal( 'Error!', 'Something went wrong. Please try again later!', 'error' ); } } }).fail(function() { swal( 'Error!', 'Something went wrong. Please try again later!', 'error' ); }) }); } function buttonMultipleBuy(command) { var button = $("button[data-action='multuple-buy-video']"); if (command == 'hide') { button.hide(); } else if (command == 'show') { button.show(); } } buttonMultipleBuy('hide'); $("button[data-action='multiple_select_button']").click(function(){ if ($(this).attr('data-selected') == 1) { // uncheck buttonMultipleSelectingStyle($(this), 'uncheck'); } else { // check buttonMultipleSelectingStyle($(this), 'check'); } if (countSelectedVideos()) { buttonMultipleBuy('show'); } else { buttonMultipleBuy('hide'); } }); function countSelectedVideos() { var checked = 0; $("button[data-action='multiple_select_button']").each(function(i){ if ($(this).attr('data-selected') == 1) { checked++; } }); return checked; } function getSelectedVideos() { var checked = []; $("button[data-action='multiple_select_button']").each(function(i){ if ($(this).attr('data-selected') == 1) { checked.push($(this).attr('data-id')); } }); return checked; } function buttonMultipleSelectingStyle(button, action) { if (action == 'check') { button.attr('data-selected', 1); button.css('backgroundColor', '#FF4500'); button.html('Selected'); } else if (action == 'uncheck') { button.attr('data-selected', 0); button.css('backgroundColor', '#04abf2'); button.html('View'); } else if (action == 'purchased') { button.attr('data-selected', 0); button.css('backgroundColor', '#04abf2'); button.html('Purchased'); button.attr('disabled', 'disabled'); } } Any additional help is appreciated
  8. Thanks for you reply. Here is the page html: <div class="col-md-3 col-sm-6 no-padding-right-at-all no-padding-mobile-left"> <div class="video-latest-list video-wrapper" data-id="{{ID}}" data-views="{{VIEWS}}"> <div class="video-thumb"> <img src="{{THUMBNAIL}}" alt="{{TITLE}}"> <div class="video-duration">{{DURATION}}</div> </div> <div class="video-title"> <h4 title="{{TITLE}}">{{TITLE}}</h4> </div> <div class="video-info"> <div style="float:right;"><button class="btn btn-main" data-action="multiple_select_button" data-selected="0" data-id="{{ID}}">View</button></div> </div> </div> </div>
  9. The php web video script that I'm using displays a page of searched results (thumbnail images) with a 'View' button underneath each one. When the 'View' button(s) is selected the button(s) changes from "View" to "Selected", and then a separate "View All Selected" button is used to proceed. The issue I'm having is, when the page of searched list is initially displayed all "View" buttons can be selected, however, if you select the "Show More" button at the bottom of the page, to display more of the searched results, all have a "View" button, but none are selectable. In other words, when these "View" buttons are clicked, these buttons don't change to "Selected" (only the initial page - not the 'Show More" part of the page). Here is a file pertaining to this page: <div class="content pt_shadow"> <div class="col-md-12"> <div class="upload-head"> <div style="float: right;"> <button class="btn btn-main" data-action="multuple-buy-video" onclick="PT_MultipleBuyVideo();">View all selected</button> </div> <h4><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg> {{LANG search_results}}: {{KEYWORD}}</h4> <hr> </div> <div class="videos-latest-list row"> {{VIDEOS}} </div> <?php if (count($pt->videos) > 0 && empty($_GET['is_channel'])) { ?> <div class="watch-video-show-more desc load-more" data-type="search" data-keyword="{{KEYWORD}}"> {{LANG show_more}} </div> <?php } ?> <div class="clear"></div> </div> <div class="clear"></div> </div> Can you provide some suggestions or coding example of what needs to be modified to get the Show More results to also be available to Select? Any help is appreciated
  10. Thanks for your reply. I didn't write this code, so I don't know the answer to your question, and I'm not familiar with 'label switching'. Any additional help/guidance is appreciated ...
  11. thanks for your reply. I wasn't as clear as I could have been, no they are separate pages/files
  12. can you elaborate? I'm not understanding your specific solution
  13. The php web video script that I'm using has two Forms. One for uploading videos, and one for editing the Form (in the User account > My Channel > Manage > edit-video). When I complete the edit-video Form and then select Publish, the Publish button changes to 'Please Wait'. But, when I select "Publish" on the Upload Form nothing appears to happen, for a while until the video is finished uploading. But the line of code seems to be the same in each of the files: $('#submit-btn').val("{{LANG please_wait}}"); I'd like help so as to when the Upload Form "Publish button is selected it changes to Please Wait as, the edit-video Form does. Here is the edit-video Form <script> code: <script> $(function () { $('.edit-thumb').on('click', function(event) { $('#thumbnail').trigger('click'); }); $('#thumbnail').on('change', function(event) { readURL(this); }); $('#description').keyup(function(event) { str = $(this).val().replace(/(?:\r\n|\r|\n)/g, '<br />'); $('.video-description p').html(str); }); $('#title').keyup(function(event) { $('.video-title p').html($(this).val()); }); $("#mySingleFieldTags").tagit({ allowSpaces: true }); $('#edit-form form').ajaxForm({ url: '{{LINK aj/edit-video}}' + '?hash=' + $('.main_session').val(), beforeSend: function() { $('#submit-btn').attr('disabled', true); $('#submit-btn').text("{{LANG please_wait}}"); }, success: function(data) { if (data.status == 200) { $('#video-success').html(data.message); window.location.href = '/manage-videos/'; //window.location.href = '{{URL}}'; } else { $('#submit-btn').attr('disabled', false); $('#submit-btn').html('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-check-circle"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"></path><polyline points="22 4 12 14.01 9 11.01"></polyline></svg> {{LANG publish}}'); $('.errors').removeClass('hidden').html(data.message); } } }); }); </script> Here is the Upload video Form <script> code: <script> $(function () { var video_drop_block = $("[data-block='video-drop-zone']"); if (typeof(window.FileReader)){ video_drop_block[0].ondragover = function() { video_drop_block.addClass('hover'); return false; }; video_drop_block[0].ondragleave = function() { video_drop_block.removeClass('hover'); return false; }; video_drop_block[0].ondrop = function(event) { event.preventDefault(); video_drop_block.removeClass('hover'); var file = event.dataTransfer.files; $('#upload-video').find('input').prop('files', file); }; } $("#mySingleFieldTags").tagit({ allowSpaces: true }); var bar = $('.bar'); var percent = $('.percent'); var prcsvdo = $('.pt_prcs_vdo'); var is_uploaded = false; var video_thumb = Array(); $('#upload-video').submit(function(event) { let file_size = $(".upload-video-file").prop('files')[0].size; if (file_size > "{{CONFIG max_upload}}") { swal({ title: '{{LANG error}}', text: "{{LANG file_is_too_big}} <?php echo pt_size_format($pt->config->max_upload); ?>", type: 'error', confirmButtonColor: '#3085d6', cancelButtonColor: '#d33', confirmButtonText: 'OK', buttonsStyling: true, confirmButtonClass: 'btn btn-success', }).then(function(){ swal.close(); $('.upload-video-file').val(''); }, function() { swal.close(); $('.upload-video-file').val(''); }); return false; } else{ var filename = $('.upload').val().split('\\').pop(); $('#title').val(filename); $('#upload-form').removeClass('hidden'); $('.upload').addClass('hidden'); } }); $('#choose-thumnail-cr').bind('slid.bs.carousel', function (e) { var vsthumb = video_thumb[$(this).find('.active').index()]; $("#video-thumnail").val(vsthumb); }); $('#upload-video').ajaxForm({ url: '{{LINK aj/upload-video-ffmpeg}}?hash=' + $('.main_session').val(), dataType:'json', beforeSend: function() { $('.progress').removeClass('hidden'); var percentVal = '0%'; bar.width(percentVal); percent.html(percentVal); }, uploadProgress: function(event, position, total, percentComplete) { if(percentComplete > 50) { percent.addClass('white'); } var percentVal = percentComplete + '%'; bar.width(percentVal); percent.html(percentVal); if (percentComplete == 100) { prcsvdo.html('<svg width="30" height="10" viewBox="0 0 120 30" xmlns="http://www.w3.org/2000/svg" fill="#000"><circle cx="15" cy="15" r="15"><animate attributeName="r" from="15" to="15" begin="0s" dur="0.8s" values="15;9;15" calcMode="linear" repeatCount="indefinite" /><animate attributeName="fill-opacity" from="1" to="1" begin="0s" dur="0.8s" values="1;.5;1" calcMode="linear" repeatCount="indefinite" /></circle><circle cx="60" cy="15" r="9" fill-opacity="0.3"><animate attributeName="r" from="9" to="9" begin="0s" dur="0.8s" values="9;15;9" calcMode="linear" repeatCount="indefinite" /><animate attributeName="fill-opacity" from="0.5" to="0.5" begin="0s" dur="0.8s" values=".5;1;.5" calcMode="linear" repeatCount="indefinite" /></circle><circle cx="105" cy="15" r="15"><animate attributeName="r" from="15" to="15" begin="0s" dur="0.8s" values="15;9;15" calcMode="linear" repeatCount="indefinite" /><animate attributeName="fill-opacity" from="1" to="1" begin="0s" dur="0.8s" values="1;.5;1" calcMode="linear" repeatCount="indefinite" /></circle></svg> {{LANG porcessing_video}}'); $('.progress').find('.bar').removeClass('upload-progress-bar'); } }, success: function(data) { percentVal = '0%'; bar.width(percentVal); $('.progress').addClass('hidden'); if (data.status == 200) { $('#video-location').val(data.file_path); Snackbar.show({text: '<i class="fa fa-check"></i> ' + data.file_name + ' {{LANG successfully_uplaoded}}'}); $('#submit-btn').attr('disabled', false); $('.upload-video-file').val(''); $('#title').val(data.file_name); $("#video-thumnails").removeClass('hidden'); var i = 0; var url = '{img}'; video_thumb = data.images; $("#video-thumnails").find('.item').each(function(index, el) { if (i == 0) { $("#video-thumnail").val(data.images[i]); } $(el).html($("<img>",{ src:url.replace('{img}',data.images[i]) })); i++; }); } else if(data.status == 401){ swal({ title: '{{LANG oops}}!', text: "{{LANG upload_limit_reached}}!", type: 'info', showCancelButton: true, confirmButtonColor: '#3085d6', cancelButtonColor: '#d33', confirmButtonText: '{{LANG upgrade_now}}', cancelButtonText: '{{LANG cancel}}', confirmButtonClass: 'btn btn-success margin-right', cancelButtonClass: 'btn', buttonsStyling: false }).then(function(){ window.location.href = '{{LINK go_pro}}'; }, function() { window.location.href = '{{LINK }}'; }); } else if(data.status == 402){ swal({ title: '{{LANG error}}', text: data.message, type: 'error', confirmButtonColor: '#3085d6', cancelButtonColor: '#d33', confirmButtonText: 'OK', buttonsStyling: true, confirmButtonClass: 'btn btn-success', }).then(function(){ swal.close(); $('.upload-video-file').val(''); }, function() { swal.close(); $('.upload-video-file').val(''); }); } else { Snackbar.show({showAction: false,backgroundColor: '#e22e40',text: '<div>'+ data.error +'</div>'}); } } }); $('#upload-form form').ajaxForm({ url: '{{LINK aj/ffmpeg-submit}}'+'?hash=' + $('.main_session').val(), beforeSend: function() { $('#submit-btn').attr('disabled', true); $('#submit-btn').val("{{LANG please_wait}}"); }, success: function(data) { if (data.status == 200) { window.location.href = data.link; } else if(data.status == 402){ swal({ title: '{{LANG error}}', text: data.message, type: 'error', confirmButtonColor: '#3085d6', cancelButtonColor: '#d33', confirmButtonText: 'OK', buttonsStyling: true, confirmButtonClass: 'btn btn-success', }).then(function(){ window.location.href = '{{LINK upload-video}}'; }, function() { window.location.href = '{{LINK }}'; }); } else { $('#submit-btn').attr('disabled', false); $('#submit-btn').val('{{LANG publish}}'); Snackbar.show({text: '<div>'+ data.message +'</div>'}); } } }); $('.upload-video-file').on('change', function() { $('#upload-video').submit(); }); }); function PT_OpenUploadForm() { $('#upload-video').find('input').trigger('click'); } </script> Any help will be appreciated
  14. Thanks you I tried adding that, without success, like this: <script> $("#upload-video").submit(function() { $("#loading-spinner").show(); }); </script> Any additional guidance will be welcomed
  15. Thanks for your informative reply. The spinner is at line 145, after the Form, but your suggestion to make it hidden by default and use the Form's submit event to show it, sounds logical, but I don't know how to code that, can you please provide an example?
  16. I have added a spinning gif successfully to this web page, now I am seeking help so that it only appears when the Form submit button is selected. Any help will be appreciated. <div class="wo_about_wrapper_parent"> <div class="wo_about_wrapper"> <div class="hero hero-overlay" style="background-color: #d84c47;"> <div class="container"> <h1 class="text-center">{{LANG upload_new_video}}</h1> </div> </div> <svg id="wave" viewBox="0 0 100 15"><path fill="#d84c47" opacity="0.5" d="M0 30 V15 Q30 3 60 15 V30z"></path><path fill="#d84c47" d="M0 30 V12 Q30 17 55 12 T100 11 V30z"></path></svg> </div> </div> <div class="col-md-2"></div> <div class="col-md-8 pt_page_margin"> <div class="content pt_shadow"> <div class="col-md-12 pt_upload_vdo"> <?php if ($pt->user->admin == 1) { ?> <div class="alert alert-warning"> <h4>Just admins can see this message</h4> <p>Note: Your server max upload size is: <?php echo ini_get('upload_max_filesize')?>, means you can't upload files that are larger than: <?php echo ini_get('upload_max_filesize')?><br><br> If you want to increase the limit or If you can't upload large files, go to Admin Settings > Settings > Site Settings > Max upload size and increase the value, if you still can't upload large files, please contact your host provider and let them increase the upload limit and max_execution_time.</p> </div> <?php } ?> <div class="upload upload-video" data-block="video-drop-zone"> <div> <svg fill="currentColor" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" class="feather feather-upload"><path d="M14,13V17H10V13H7L12,8L17,13M19.35,10.03C18.67,6.59 15.64,4 12,4C9.11,4 6.6,5.64 5.35,8.03C2.34,8.36 0,10.9 0,14A6,6 0 0,0 6,20H19A5,5 0 0,0 24,15C24,12.36 21.95,10.22 19.35,10.03Z" /></svg> <h4>{{LANG darg_drop_video}}</h4> <p>{{LANG or}} {{LANG click_2choose_file}}</p> <button class="btn btn-main">{{LANG upload}}</button> </div> </div> <div class="progress hidden"> <span class="percent">0%</span> <div class="progress_bar_parent"> <div class="bar upload-progress-bar progress-bar active"></div> </div> <div class="clear"></div> <div class="text-center pt_prcs_vdo"></div> </div> <style> .form-group1.hidden { visibility:hidden; } .form-group1.hidden { /*this is being used, it overrides the previous rule*/ position:absolute; left:-999em; } p {margin:0} </style> <form action="" method="POST" id="upload-video" style="visibility: hidden;"> <input type="file" name="video" accept="video/*" class="upload-video-file"> </form> <div class="fluid upload-ffmpeg-mode hidden" id="upload-form"> <div class="col-md-12"> <form action="" class="form-horizontal setting-panel pt_forms" method="POST"> <div class="form-group"> <label class="col-md-12" for="title">{{LANG video_title}}</label> <div class="col-md-12"> <input id="title" name="title" type="text" placeholder="" class="form-control input-md"> <span class="help-block">{{LANG video_title_help}}</span> </div> </div> <div class="form-group"> <label class="col-md-12" for="description">{{LANG video_description}}</label> <div class="col-md-12"> <textarea name="description" id="description" cols="30" rows="5" class="form-control"></textarea> </div> </div> <div class="form-group"> <label class="col-md-12" for="category_id">{{LANG category}}</label> <div class="col-md-12"> <select name="category_id" id="category_id" class="form-control"> <?php foreach($pt->categories as $key => $category) {?> <option value="<?php echo $key?>"><?php echo $category?></option> <?php } ?> </select> </div> </div> <!--<div class="form-group1">--><div class="form-group1 hidden"> <!--<label class="col-md-12" for="privacy">{{LANG privacy}}</label>--> <!--<div class="col-md-12">--> <select name="privacy" id="privacy" class="form-control"> <option hidden value="0">public</option> <option hidden value="1">private</option> <option selected value="2"></option> <!--<option value="2">{{LANG unlisted}}</option>--> </select> <!--</div>--> </div> <div class="form-group1 hidden"> <!--<label class="col-md-12" for="age_restriction">{{LANG age_restriction}}</label>--> <!--<div class="col-md-12">--> <select name="age_restriction" id="age_restriction" class="form-control"> <option selected value="1">{{LANG all_ages}}</option> <option hidden value="2"></option> </select> <!--</div>--> </div> <div class="form-group"> <label class="col-md-12" for="tags">{{LANG tags}}</label> <div class="col-md-12"> <input id="mySingleFieldTags" name="tags" type="text" placeholder="" class="form-control input-md"> <span class="help-block">{{LANG tags_help}}</span> </div> </div> <div class="form-group hidden" id="video-thumnails"> <label class="col-md-12" for="thumbnail">{{LANG thumbnail}}</label> <div class="col-md-12"> <div class="fluid"> <div class="carousel slide" id="choose-thumnail-cr" data-interval="false" style="cursor: pointer"> <div class="carousel-inner"> <div class="item active"></div> </div> <div class="fluid choose-thumnail-control"> <span class="pull-left">{{LANG video_thumbs}}</span> <span class="pull-right"> <a class="btn btn-default" href="#choose-thumnail-cr" data-slide="prev"> <i class="fa fa-caret-left"></i> </a> <a class="btn btn-default" href="#choose-thumnail-cr" data-slide="next"> <i class="fa fa-caret-right"></i> </a> </span> </div> </div> </div> </div> </div> <div class="last-sett-btn modal-footer" style="margin: 0px -40px -10px -40px;"> <button type="submit" id="submit-btn" class="btn btn-main setting-panel-mdbtn" disabled><svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='feather feather-check-circle'><path d='M22 11.08V12a10 10 0 1 1-5.93-9.14'></path><polyline points='22 4 12 14.01 9 11.01'></polyline></svg> {{LANG publish}}</button> </div> <input type="hidden" name="video-location" id="video-location" value=""> <input type="hidden" name="video-thumnail" id="video-thumnail" value=""> </form> </div> </div> <div class="clear"></div> </div> <div class="clear"></div> </div> </div> <form action="" id="thumbnail-form" method="POST"> <input id="thumbnail" name="thumbnail" type="file" style="visibility: hidden;" accept="image/*"> <div class="loading-spinner"></div> </form> <div class="col-md-2"></div> <style> .loading-spinner { -webkit-animation-play-state: running; animation-play-state: running; opacity: 1; position: relative; height: 100vh; } @-webkit-keyframes spinner { 0% { -webkit-transform: translate3d(-50%, -50%, 0) rotate(0deg); transform: translate3d(-50%, -50%, 0) rotate(0deg); } 100% { -webkit-transform: translate3d(-50%, -50%, 0) rotate(360deg); transform: translate3d(-50%, -50%, 0) rotate(360deg); } } @keyframes spinner { 0% { -webkit-transform: translate3d(-50%, -50%, 0) rotate(0deg); transform: translate3d(-50%, -50%, 0) rotate(0deg); } 100% { -webkit-transform: translate3d(-50%, -50%, 0) rotate(360deg); transform: translate3d(-50%, -50%, 0) rotate(360deg); } } .loading-spinner.-paused { -webkit-animation-play-state: paused; animation-play-state: paused; opacity: 0.2; transition: opacity linear 0.1s; } .loading-spinner::before { -webkit-animation: 1.5s linear infinite spinner; animation: 1.5s linear infinite spinner; -webkit-animation-play-state: inherit; animation-play-state: inherit; border: solid 3px #dedede; border-bottom-color: #EF6565; border-radius: 50%; content: ""; height: 40px; left: 50%; opacity: inherit; position: absolute; top: 50%; -webkit-transform: translate3d(-50%, -50%, 0); transform: translate3d(-50%, -50%, 0); width: 40px; will-change: transform; } </style> <script> var video_thumb = Array(); $(document).on('click', '.carousel-inner', function(event) { $('#thumbnail').trigger('click'); }); $('#thumbnail').change(function(event) { $.ajax({ type: 'POST', url: "{{LINK aj/upload-thumbnail}}?hash=" + $('.main_session').val() , data: new FormData($("#thumbnail-form")[0]), processData: false, contentType: false, success: function(data) { $('.carousel-inner').append('<div class="item"><img src="' + data.thumbnail + '"></div>'); video_thumb.push(data.thumbnail); $('#video-thumnail').val(data.thumbnail); $(".carousel-inner").find('.item').removeClass('active'); $(".carousel-inner").find('.item:last').addClass('active'); } }); }); $(function () { var video_drop_block = $("[data-block='video-drop-zone']"); if (typeof(window.FileReader)){ video_drop_block[0].ondragover = function() { video_drop_block.addClass('hover'); return false; }; video_drop_block[0].ondragleave = function() { video_drop_block.removeClass('hover'); return false; }; video_drop_block[0].ondrop = function(event) { event.preventDefault(); video_drop_block.removeClass('hover'); var file = event.dataTransfer.files; $('#upload-video').find('input').prop('files', file); }; } $("#mySingleFieldTags").tagit({ allowSpaces: true }); var bar = $('.bar'); var percent = $('.percent'); var prcsvdo = $('.pt_prcs_vdo'); var is_uploaded = false; $('#upload-video').submit(function(event) { var file_size = $(".upload-video-file").prop('files')[0].size; if (file_size > "{{CONFIG max_upload}}") { swal({ title: '{{LANG error}}', text: "{{LANG file_is_too_big}} <?php echo pt_size_format($pt->config->max_upload); ?>", type: 'error', confirmButtonColor: '#3085d6', cancelButtonColor: '#d33', confirmButtonText: 'OK', buttonsStyling: true, confirmButtonClass: 'btn btn-success', }).then(function(){ swal.close(); $('.upload-video-file').val(''); }, function() { swal.close(); $('.upload-video-file').val(''); }); return false; } else{ var filename = $('.upload').val().split('\\').pop(); $('#title').val(filename); $('#upload-form').removeClass('hidden'); $('.upload').addClass('hidden'); } }); $('#choose-thumnail-cr').bind('slid.bs.carousel', function (e) { console.log(video_thumb); var vsthumb = video_thumb[$(this).find('.active').index()]; console.log(vsthumb); $("#video-thumnail").val(vsthumb); }); $('#upload-video').ajaxForm({ url: '{{LINK aj/upload-video-ffmpeg}}?hash=' + $('.main_session').val(), dataType:'json', beforeSend: function() { $('.progress').removeClass('hidden'); var percentVal = '0%'; bar.width(percentVal); percent.html(percentVal); }, uploadProgress: function(event, position, total, percentComplete) { if(percentComplete > 50) { percent.addClass('white'); } var percentVal = percentComplete + '%'; bar.width(percentVal); percent.html(percentVal); if (percentComplete == 100) { prcsvdo.html('<svg width="30" height="10" viewBox="0 0 120 30" xmlns="http://www.w3.org/2000/svg" fill="#000"><circle cx="15" cy="15" r="15"><animate attributeName="r" from="15" to="15" begin="0s" dur="0.8s" values="15;9;15" calcMode="linear" repeatCount="indefinite" /><animate attributeName="fill-opacity" from="1" to="1" begin="0s" dur="0.8s" values="1;.5;1" calcMode="linear" repeatCount="indefinite" /></circle><circle cx="60" cy="15" r="9" fill-opacity="0.3"><animate attributeName="r" from="9" to="9" begin="0s" dur="0.8s" values="9;15;9" calcMode="linear" repeatCount="indefinite" /><animate attributeName="fill-opacity" from="0.5" to="0.5" begin="0s" dur="0.8s" values=".5;1;.5" calcMode="linear" repeatCount="indefinite" /></circle><circle cx="105" cy="15" r="15"><animate attributeName="r" from="15" to="15" begin="0s" dur="0.8s" values="15;9;15" calcMode="linear" repeatCount="indefinite" /><animate attributeName="fill-opacity" from="1" to="1" begin="0s" dur="0.8s" values="1;.5;1" calcMode="linear" repeatCount="indefinite" /></circle></svg> {{LANG processing_video}}'); $('.progress').find('.bar').removeClass('upload-progress-bar'); } }, success: function(data) { percentVal = '0%'; bar.width(percentVal); $('.progress').addClass('hidden'); if (data.status == 200) { $('#video-location').val(data.file_path); Snackbar.show({text: '<i class="fa fa-check"></i> ' + data.file_name + ' {{LANG successfully_uploaded}}'}); $('#submit-btn').attr('disabled', false); $('.upload-video-file').val(''); $('#title').val(data.file_name); $("#video-thumnails").removeClass('hidden'); var i = 0; var url = '{img}'; video_thumb = data.images; $('.carousel-inner').html(''); $.each(video_thumb, function( index, value ) { $('.carousel-inner').append('<div class="item"><img src="' + value + '"></div>'); i++; }); $(".carousel-inner").find('.item:first-child').addClass('active'); $("#video-thumnail").val(video_thumb[0]); $('.carousel').carousel({ interval: false });
  17. Thanks again for your reply. No, the videos don't upload with the added part to watermark the video: -i /home/user/public_html/watermark.png -filter_complex 'overlay=10:10' without that, the videos upload successfully. The Media Error shown on my original posting, appears over the video player on the web page. It may not be a message from PHP, it may be a message from ffmpeg Any additional help will be appreciated
  18. Thanks for your reply. So, I added the error log code correctly? No, videos are generated. The last entry in the error_log file is from Aug-16. Any additional guidance will be welcomed. Much thanks again
  19. Thanks for that. I'm not sure how to do that. Does this look correct? if ($video_res >= 854 || $video_res == 0) { error_log($shell = shell_exec("$ffmpeg_b -y -i $video_file_full_path -i /home/user/public_html/watermark.jpg -filter_complex 'overlay=x=(main_w-overlay_w)/2:y=(main_h-overlay_h)/2' -vcodec libx264 -preset {$pt->config->convert_speed} -filter:v scale=854:-2 -crf 26 $video_output_full_path_480 2>&1")); $upload_s3 = PT_UploadToS3($filepath . "_480p_converted.mp4"); $db->where('id', $insert); $db->update(T_VIDEOS, array( '480p' => 1 )); }
  20. Thanks, yes that file is: ../ajax/ffmpeg-submit.php but I don't know how to "to see what its value is" any guidance or example will be appreciated
  21. Thanks for your reply/insight. Can you direct me as to how/where I might "look at the $shell output from one of the failing commands for a clue?", please?
  22. The php web video script that I'm using, has ffmpeg, and it uploads videos succesfully. I'm trying to add the ability to add a watermark onto the video upon upload. However, what I've added -i /home/user/public_html/watermark.png -filter_complex 'overlay=10:10' shows N ERROR: Media error: Format(s) not supported or sources not found mejs.download-file: https://…com/upload/videos/2018/08/6SWCpSImGQrsVXGgIh7A_24_549ebe0d36bccb10faf72b81e303ce50_video_360p_converted.mp4 mejs.download-file: https://…com/upload/videos/2018/08/Ubud1OqKHK7MPjvtbHw5_24_cdab9c4bc2a4eccc7c478526abb530d8_video_240p_converted.mp4 Any suggestion/solution will be appreciated. Here's the entire file code: <?php if (IS_LOGGED == false || $pt->config->upload_system != 'on') { $data = array( 'status' => 400, 'error' => 'Not logged in' ); echo json_encode($data); exit(); } else if ($pt->config->ffmpeg_system != 'on') { $data = array( 'status' => 402 ); echo json_encode($data); exit(); } else { $getID3 = new getID3; $featured = ($user->is_pro == 1) ? 1 : 0; $filesize = 0; $error = false; $request = array(); $request[] = (empty($_POST['title']) || empty($_POST['description'])); $request[] = (empty($_POST['tags']) || empty($_POST['video-thumnail'])); if (in_array(true, $request)) { $error = $lang->please_check_details; } else if (empty($_POST['video-location'])) { $error = $lang->video_not_found_please_try_again; } else { $request = array(); $request[] = (!in_array($_POST['video-location'], $_SESSION['uploads']['videos'])); $request[] = (!in_array($_POST['video-thumnail'], $_SESSION['uploads']['images'])); $request[] = (!file_exists($_POST['video-location'])); if (in_array(true, $request)) { $error = $lang->error_msg; } } if (empty($error)) { $file = $getID3->analyze($_POST['video-location']); $duration = '00:00'; if (!empty($file['playtime_string'])) { $duration = PT_Secure($file['playtime_string']); } if (!empty($file['filesize'])) { $filesize = $file['filesize']; } $video_res = (!empty($file['video']['resolution_x'])) ? $file['video']['resolution_x'] : 0; $video_id = PT_GenerateKey(15, 15); $check_for_video = $db->where('video_id', $video_id)->getValue(T_VIDEOS, 'count(*)'); if ($check_for_video > 0) { $video_id = PT_GenerateKey(15, 15); } $thumbnail = PT_Secure($_POST['video-thumnail'], 0); if (file_exists($thumbnail)) { $upload = PT_UploadToS3($thumbnail); } $category_id = 0; $convert = true; $thumbnail = substr($thumbnail, strpos($thumbnail, "upload"), 120); if (!empty($_POST['category_id'])) { if (in_array($_POST['category_id'], array_keys($categories))) { $category_id = PT_Secure($_POST['category_id']); } } $link_regex = '/(http\:\/\/|https\:\/\/|www\.)([^\ ]+)/i'; $i = 0; preg_match_all($link_regex, PT_Secure($_POST['description']), $matches); foreach ($matches[0] as $match) { $match_url = strip_tags($match); $syntax = '[a]' . urlencode($match_url) . '[/a]'; $_POST['description'] = str_replace($match, $syntax, $_POST['description']); } $video_privacy = 0; if (!empty($_POST['privacy'])) { if (in_array($_POST['privacy'], array(0, 1, 2))) { $video_privacy = PT_Secure($_POST['privacy']); } } $age_restriction = 1; if (!empty($_POST['age_restriction'])) { if (in_array($_POST['age_restriction'], array(1, 2))) { $age_restriction = PT_Secure($_POST['age_restriction']); } } $data_insert = array( 'video_id' => $video_id, 'user_id' => $user->id, 'title' => PT_Secure($_POST['title']), 'description' => PT_Secure($_POST['description']), 'tags' => PT_Secure($_POST['tags']), 'duration' => $duration, 'video_location' => '', 'category_id' => $category_id, 'thumbnail' => $thumbnail, 'time' => time(), 'registered' => date('Y') . '/' . intval(date('m')), 'featured' => $featured, 'converted' => '2', 'size' => $filesize, 'privacy' => $video_privacy, 'age_restriction' => $age_restriction ); if ($pt->config->approve_videos == 'on' && !PT_IsAdmin()) { $data_insert['approved'] = 0; } $insert = $db->insert(T_VIDEOS, $data_insert); if ($insert) { $data = array( 'status' => 200, 'video_id' => $video_id, 'link' => PT_Link("watch/$video_id") ); ob_end_clean(); header("Content-Encoding: none"); header("Connection: close"); ignore_user_abort(); ob_start(); header('Content-Type: application/json'); echo json_encode($data); $size = ob_get_length(); header("Content-Length: $size"); ob_end_flush(); flush(); session_write_close(); if (is_callable('fastcgi_finish_request')) { fastcgi_finish_request(); } $ffmpeg_b = $pt->config->ffmpeg_binary_file; $filepath = explode('.', $_POST['video-location'])[0]; $time = time(); $full_dir = str_replace('ajax', '/', __DIR__); $video_output_full_path_240 = $full_dir . $filepath . "_240p_converted.mp4"; $video_output_full_path_360 = $full_dir . $filepath . "_360p_converted.mp4"; $video_output_full_path_480 = $full_dir . $filepath . "_480p_converted.mp4"; $video_output_full_path_720 = $full_dir . $filepath . "_720p_converted.mp4"; $video_output_full_path_1080 = $full_dir . $filepath . "_1080p_converted.mp4"; $video_output_full_path_2048 = $full_dir . $filepath . "_2048p_converted.mp4"; $video_output_full_path_4096 = $full_dir . $filepath . "_4096p_converted.mp4"; $video_file_full_path = $full_dir . $_POST['video-location']; $shell = shell_exec("$ffmpeg_b -y -i $video_file_full_path -i /home/user/public_html/watermark.png -filter_complex 'overlay=10:10' -vcodec libx264 -preset {$pt->config->convert_speed} -filter:v scale=426:-2 -crf 26 $video_output_full_path_240 2>&1"); $upload_s3 = PT_UploadToS3($filepath . "_240p_converted.mp4"); $db->where('id', $insert); $db->update(T_VIDEOS, array( 'converted' => 1, '240p' => 1, 'video_location' => $filepath . "_240p_converted.mp4" )); if ($video_res >= 640 || $video_res == 0) { $shell = shell_exec("$ffmpeg_b -y -i $video_file_full_path -i /home/user/public_html/watermark.png -filter_complex 'overlay=10:10' -vcodec libx264 -preset {$pt->config->convert_speed} -filter:v scale=640:-2 -crf 26 $video_output_full_path_360 2>&1"); $upload_s3 = PT_UploadToS3($filepath . "_360p_converted.mp4"); $db->where('id', $insert); $db->update(T_VIDEOS, array( '360p' => 1, )); } if ($video_res >= 854 || $video_res == 0) { $shell = shell_exec("$ffmpeg_b -y -i $video_file_full_path -i /home/user/public_html/watermark.png -filter_complex 'overlay=10:10' -vcodec libx264 -preset {$pt->config->convert_speed} -filter:v scale=854:-2 -crf 26 $video_output_full_path_480 2>&1"); $upload_s3 = PT_UploadToS3($filepath . "_480p_converted.mp4"); $db->where('id', $insert); $db->update(T_VIDEOS, array( '480p' => 1 )); } if ($video_res >= 1280 || $video_res == 0) { $shell = shell_exec("$ffmpeg_b -y -i $video_file_full_path -i /home/user/public_html/watermark.png -filter_complex 'overlay=10:10' -vcodec libx264 -preset {$pt->config->convert_speed} -filter:v scale=1280:-2 -crf 26 $video_output_full_path_720 2>&1"); $upload_s3 = PT_UploadToS3($filepath . "_720p_converted.mp4"); $db->where('id', $insert); $db->update(T_VIDEOS, array( '720p' => 1 )); } if ($video_res >= 1920 || $video_res == 0) { $shell = shell_exec("$ffmpeg_b -y -i $video_file_full_path -i /home/user/public_html/watermark.png -filter_complex 'overlay=10:10' -vcodec libx264 -preset {$pt->config->convert_speed} -filter:v scale=1920:-2 -crf 26 $video_output_full_path_1080 2>&1"); $upload_s3 = PT_UploadToS3($filepath . "_1080p_converted.mp4"); $db->where('id', $insert); $db->update(T_VIDEOS, array( '1080p' => 1 )); } if ($video_res >= 2048) { $shell = shell_exec("$ffmpeg_b -y -i $video_file_full_path -i /home/user/public_html/watermark.png -filter_complex 'overlay=10:10' -vcodec libx264 -preset {$pt->config->convert_speed} -filter:v scale=2048:-2 -crf 26 $video_output_full_path_2048 2>&1"); $upload_s3 = PT_UploadToS3($filepath . "_2048p_converted.mp4"); $db->where('id', $insert); $db->update(T_VIDEOS, array( '2048p' => 1 )); } if ($video_res >= 3840) { $shell = shell_exec("$ffmpeg_b -y -i $video_file_full_path -i /home/user/public_html/watermark.png -filter_complex 'overlay=10:10' -vcodec libx264 -preset {$pt->config->convert_speed} -filter:v scale=3840:-2 -crf 26 $video_output_full_path_4096 2>&1"); $upload_s3 = PT_UploadToS3($filepath . "_4096p_converted.mp4"); $db->where('id', $insert); $db->update(T_VIDEOS, array( '4096p' => 1 )); } if (file_exists($_POST['video-location'])) { unlink($_POST['video-location']); } if (!empty($_SESSION['uploads']['images'])) { if (is_array($_SESSION['uploads']['images'])) { foreach ($_SESSION['uploads']['images'] as $key => $file) { if ($thumbnail == $file) { unset($_SESSION['uploads']['images'][$key]); } else { //@unlink($file); } } $_SESSION['uploads']['images'] = array(); } } pt_push_channel_notifiations($video_id); $_SESSION['uploads'] = array(); exit(); } } else { $data = array( 'status' => 400, 'message' => $error_icon . $error ); } }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.