Related Topics


[Video CMS v4]How to ... include video-upload?  (Read 1027 times) Print

1 2 All B


Heiby  June 05, 2015, 05:01:31 PM

Hello,
I've installed phpVibe in a subfolder (path: htdocs/phpvibe/index.php).
Now I want to include the phpvibe-video-upload-function into the website, that I can upload videos from a file placed 1 level higher (path: htdocs/video-upload.php).

I've tried already successless - so I haven't any idea, how this works.
Does anyone know, which changings I have to do, that I can use the phpvibe-Upload 1 level higher?

Thanks in advance.
Heiby

Logged


Alexander  June 05, 2015, 05:09:10 PM

Hi,

this is isn't an easy thing to do, since the uploader consists of a few elements:
- the maxupload.js file
- the handler (upload.php of upload-ffmpeg.php in /lib)
- the form which is being made visible once the upload is finished, the one in com/com_add.php

Logged

Heiby  June 05, 2015, 05:40:50 PM

Hi,
thanks for the fast reply.

And which file I have to include then (URI), that the uploader and upload-form will be showed in my video-upload.php?
Because the URI (folder / file) -> http...phpvibe/add-video  istn't really existing.


Heiby

Logged


Alexander  June 05, 2015, 05:43:15 PM

but, this is the problem, it's not an file include, is not that easy.
I've never did this or bumped into a client that needed it.
I think you have to build your own external upload plan, and just hook the command to store the video in PHPVibe.

Using load.php and the is_user(), maxupload.js and all of the rest.
Are you sure you really need this? It would be a lot of work to do. Why not just redirect/link them?

Logged

Alexander  June 05, 2015, 05:44:31 PM

Basically, if you look at com/com-add.php you will see all the upload logic.

Logged

Heiby  June 05, 2015, 05:58:15 PM

... because we need the excellent phpVibe-Software only in the background: video-upload, video-management, newsletter, and other features.
The frontend is an own written software for a kind of "challenges", where the users must upload videos to special challenges, for what phpvibe isn't developped.

Yes, the com/com-add.php I've already found ... and I can already write my own database-fields that I need.
And now, I wanted to include the "upload"-function.
For this feature I would need only the upload-function without the form for further information.

Logged


Alexander  June 05, 2015, 06:54:44 PM

Ok, got it, here you go, the file is lib/maxupload.js

It can be triggered like:
Code
<!-- The basic File Upload plugin -->
<script src="/lib/maxupload.js"></script>
 <script type="text/javascript" >
$(document).ready(function(){
$('#dumpvideo').MaxUpload({
maxFileSize:3145728000,
maxFileCount: 1,target: lib/upload-ffmpeg.php',
        allowedExtensions:['.flv','.mp4','.avi','.mpeg','.wmv','.mov','.m4v','.3gp','.mkv','.mpg','.wmv',],
        data: {"token": "af844ad893f5700f67a625a490973d80"},
        onComplete: function (data) { processVid(data);  },
onError: function () {  }
});
});
With a
Code
<div id="dumpvideo"></div>

as rendering stage/container.


Logged

Heiby  June 05, 2015, 07:42:42 PM

Many thanks for taking time and finding a solution.

But it doesn't work. What could I have made wrong?

File: video-upload.php (in Folder /htdocs in relation to /htdocs/phpvibe/)
I changed the paths:
Code
<script src="phpvibe/lib/maxupload.js"></script>
Code
maxFileCount: 1,target: phpvibe/lib/upload-ffmpeg.php',

Then I put
Code
<script src="phpvibe/lib/maxupload.js"></script>
into the Head.

Directly after the h1:
Code
<div id="dumpvideo"></div>

Where do I have to put your javascript exactly? Head or body?
Is there anything else, what I have to do?


Thanks in advance.
Heiby

Logged


Alexander  June 05, 2015, 07:44:37 PM

What is the actual problem? Open the browser console, what does it say?
Try to make thouse links full, like http://www.site.com/lib/maxupload.js

Logged

Heiby  June 05, 2015, 08:01:18 PM

I changed the URI like  newbielink:http://www.site.com/lib/maxupload.js [nonactive]

2 warnings in the console:
1) Uncaught ReferenceError: jQuery is not defined(anonymous function) @ maxupload.js:316
video-upload.php:20
2) Uncaught SyntaxError: Unexpected token ILLEGAL

Then I also changed the com_add.php und took off:
Code
if(!is_user()) { redirect(site_url().'login/'); }
and gave an existing user_id

Logged


Alexander  June 05, 2015, 08:22:18 PM

You need to load jquery in that page, it's a jquery plugin, it depends on jquery.

Logged

Heiby  June 05, 2015, 08:30:20 PM

Now I took of the error in line 20.

Oooppss - no jquery ... so linked to a jquery-lib.

Now still 1 error: Uncaught SyntaxError: Unexpected token ILLEGAL
Code
maxFileCount: 1,target: http://www.domain-name.com/phpvibe/lib/upload-ffmpeg.php',

I tried also "phpvibe/lib/upload-ffmpeg.php".



Logged


Alexander  June 05, 2015, 08:33:28 PM

My bad, try this

Code
target: 'http://www.domain-name.com/phpvibe/lib/upload-ffmpeg.php'
forgot an '

Logged

Alexander  June 05, 2015, 08:34:08 PM

I'll catch you up later, will try to log from home, shift got over 30 min ago and the building is closing.

Logged

Heiby  June 05, 2015, 08:53:04 PM

Now there aren't any mistakes in the console  ;D

But the Uploader is still not included yet.

In the com_add.php is the login-function off:
Code
// if(!is_user()) { redirect(site_url().'login/'); }

Where do I have to set the user_id() exactly?
And what? The real name oder the hashed?

Do I have to set other variables as well?


No problem - so I can take a break as well  ;)


Logged


Heiby  June 06, 2015, 02:11:49 PM

Hi,
on this way it cant't really work.

1) In the com_add.php are variables written for the head and body.
So I have to include this file into the head, that I can put out the variables differently in the head and body.

2) But then I have collisions with:
Code
//Time for design
 the_header();
 include_once(TPL.'/default-full.php');
 the_footer();
So I have to delete this und write own functions.

3) Then I have to include all the functions of phpVibe to my site that these are running as well.


So it would be very nice, if you could tell me, which file I have to "speak to" first, for being able to include the Uploader.
That means com_add.php and upload.php in the head? ... with the right paths to other files  ;)


Thanks in advance,
Heiby

Logged


Alexander  June 08, 2015, 02:08:18 PM

Heiby, there is no way to include this like how you try.

Use load.php to get access to all functions, including user check.
Use maxupload.js on your custom page, and process them there (like lib/upload.php does, or lib/upload-ffmpeg.php if you use ffmpeg).
This is purely theoretical, since I've never needed this, so I can't know for sure which are the barriers.

I can explain you the functional flow of PHPVibe (this is what I am here for):

- com/com_add.php renders the forms and output to the default page theme
- maxupload.js handles the actual html5 upload, sends the files to lib/upload-ffmpeg.php (if ffmpeg is on) or lib/upload.php (if ffmpeg is off)
- lib/upload-ffmpeg.php sends the video to conversion at videocron.php via an exec
- maxupload.js then enables the form on com/com_add.php , upon save the file itself handles the video update with the values in the form.

This is the process inside PHPVibe.


Logged

Heiby  June 08, 2015, 05:06:33 PM

Thanks for the answer.
So have to go to PLAN-B   :(

I wanted to include "add_video" by iframe. It works pretty much until the video is load uploaded.
But then their isn't any the OK- or Save-Button, and no video was saved in the database.

I think, because of the missing Session-Variables.
These are written:
Code
[logintype] => core
[name] => Heinz
[group] => 4
[username] => heinz
[user_id] => 2
[avatar] => uploads/def-avatar.jpg
[pass] => e390f4169fb8e2749f441dafa92f89a7
[usergroup] => 4
[token] => 454da57fbe8e05d33e030df4a924392a
[HTTP_USER_AGENT] => 52fcc5c9bb837e35bcdb6a6f0af6ef5e
[ulikes] =>
[uhistory] =>
[likes_id] => 4
[history_id] => 5
[later_id] => 6
[lastNoty] => 1433763358
Do you know, which are used in "add_video"?
Or where can I switch of almost all of them?

Heiby

Logged


Alexander  June 08, 2015, 06:18:52 PM

Open the browser console, see if any error shows up inside the iframe, I guess the function doesn't fire to enable the form submission when upload finishes, I understand correct?

Logged

Heiby  June 09, 2015, 02:34:18 PM

Hi,
sorry - yesterday it didn't work. Today, without any changings, it works ???
Video is up!

Next step: Overgive own Session-ID and create phpVibe-Cookie!

Our users coming from newbielink:http://www.my-domain.com [nonactive] to newbielink:http://www.my-domain.com/upload-video.php [nonactive] where newbielink:http://www.my-domain.com/phpvibe/add-video [nonactive] is included per iframe.

We set a Session-ID, but phpVibe needs an own Cookie, so that phpVibe knows that our user is logged in.
For example:
Code
Name:	b8955456185a7bb623e65a6a387f81dd200
Content: 1-phpv-9de9e76d81464ce25b19d6abb677d4d1-phpv-91.14.228.72
Domain: .my-domain.com
Pfad: /
So I should know, how the "Name" and the "Content" is created to set a 2nd Cookie with the phpVibe-Parameters.


Thanks in advance,
Heiby





Logged


Heiby  June 09, 2015, 02:40:58 PM

... or how to delete all the needed user-verifications, so that everyone that comes to this page can upload videos - that would be the best.

So I could check by our Session-Id, if someone is allowed to upload videos only by my own.

Heiby

Logged


Alexander  June 09, 2015, 04:56:10 PM

Hi,

the cookie name is under Settings -> Login, it's also good to check lib/functions.user.php (has all you're looking for ;) )

You can do this:

Code
if(!is_user()) {
user::LoginUser(3);
}

Change 3 to an user account's id created for a "Guest" or how you wish to call it ;)

Logged

Heiby  June 09, 2015, 05:26:35 PM

Thanks for the "easy" option - is it really that easy?

But... do I have only to change the code in the com_add.php (line1) or e.g. in the load.php as well, because there are the functions "authByCookie(); validate_session();". There is the "if (!is_user()..." written too.

But then ... the whole phpVibe is generally opened for all guests? Or only the "/add-video", because of the changed com_add.php?


It needs 3-4 hours until the testserver is ready for trying it in real ;-) ... I'll give you a reply then.
Thanks,
Heiby

Logged


Alexander  June 09, 2015, 05:37:24 PM

Change it in your file, not in PHPVibe, after you include load.php

And you can do this in index.php of PHPVibe

Code
if(is_user() && user_id() == 3) {
user::clearSessionData();
}

This will log him off if the visitor is on that account.  ;)

Logged

Heiby  June 09, 2015, 07:37:48 PM

Sorry - but the site stops processing, when it reaches:
Code
if(!is_user()) {
user::LoginUser(3);
}

So I think, it cannot handle "user::LoginUser(3);:-\
either a session-id is existing.

Logged


Heiby  June 09, 2015, 07:47:24 PM

Ooopppsss - sorry ... I've forgotten to require the functions  :-[

Logged


Heiby  June 09, 2015, 08:06:50 PM

HOOOOOOORRAAAAAAAAAAAAAY!!!!
Quote
And 12 points go to ................
the support of phpVibe - especially to you, Alexander.

A very good solution, which is working now!
And a one, than trying to write something own. Because when phpVibe is being upgraded in future, there isn't anything to do anymore  8)

I'm very lucky about this.
Many, many thanks to you.
Heiby

Logged


Heiby  June 09, 2015, 11:26:30 PM

Hello Alexander,
the next problem is including the JW-Player.

We bought the actual version of phpVibe, where a licence for the JWPlayer is automatically included.
So we've got the licence to use the JWPlayer also commercially (within the phpVibe-Software).

Now my question:
We use phpVibe on our Website ... do we can download newer JW-versions and integrate it into our Website in a separate folder by our own? ... with the licence of phpVibe included?

Heiby

Logged


Heiby  June 10, 2015, 12:57:41 PM

Hi,
we have a problem with the Upload.

When I upload Videos, it works several times very well - but then suddenly the upload stops and isn't finishing.
When I change the user in my file, it works again.

My question:
Are there any restrictions how many MB or videos a user may upload?
And where can I change this?
I've already searched in the code, but I did't found anything yet.

Thanks in advance.
Heigy

Logged


Alexander  June 10, 2015, 05:53:09 PM

Hey,


you can overwrite the lib/players/jwplayer/ with the files from your own pro/ads version, no problem, you can add the key via settings, if you need to alter the embed code for it open lib/class.provider.php, it's commented.

Logged

Alexander  June 10, 2015, 05:54:44 PM

For restrictions, there are none, there is a size restriction in settings for how big the files can be.
Sounds more like a session issue somewhere, can you check it server side? Any firewall, mod_security on server?

Logged