Page 2 of 2

Re: Video playback/performance across multiple platforms

PostPosted: October 17th, 2011, 9:40 pm
by drbyte
Hi Jason

Thank you for the recent updates.

I looked at the plugin and it seems to work in some situations but that's not what I have in mind.

In my template, I created a custom post type by using this in my function.php

<?php
// Fire this during init
register_post_type('movies', array(
'label' => __('Movies'),
'singular_label' => __('Movies'),
'public' => true,
'show_ui' => true,
'capability_type' => 'post',
'hierarchical' => false,
'rewrite' => false,
'query_var' => false,
'supports' => array('title', 'editor', 'author', 'custom-fields')
));
?>

Then I created a custom page called single-movies.php

Now, instead of using create a new post I have this custom post type in my admin page:
001.jpg
001.jpg (19.78 KiB) Viewed 303 times


Now in the single-movies.php I have the JW Player code provided by S2:

<?php $cfg = array ("file_download" => "video.mp4", "url_to_storage_source" => true, "count_against_user" => true); ?>

<?php if (($mp4 = s2member_file_download_url ($cfg, "get-streamer-array"))) { ?>

<script type="text/javascript">...........

So now all I have to do is add the custom filed and the video.mp4 above will be populated with the new value.

<?php echo get_post_meta($post->ID, playmovie, true); ?>

002.jpg



I need to create a new post for each video that I create, for example: The Little Princess (1939), I need to create a new custom post type that contain the video



4.jpg

6.jpg


I need to keep track of how many times the movie been watched (member only) as the original post would have incorrect hits form none members and boots

I am trying to avoid having to insert a code inside any post as I might change it. This way one custom field can support multiple codes. This is very helpful because we have over 2000 posts and will have the same number in custom post types.

Not sure if the plugin above works for that matter or you have any other ideas that might be better that what I'm doing

Thank you

Sam

PS. I know WordPress might be the wrong option for this kind of site but We started with WordPress as a simple video site and now it's all over the place.

Re: Video playback/performance across multiple platforms

PostPosted: October 20th, 2011, 5:23 pm
by Jason Caldwell
Thanks for the reply Sam.

Right, so inside your PHP template file for these Custom Posts, you might have something like this:
Code: Select all
<?php
$cfg 
= array ("file_download" => get_post_meta(get_the_ID(), "playmovie", true), "url_to_storage_source" => true, "count_against_user" => true); ?>

<?php if (($mp4 = s2member_file_download_url ($cfg, "get-streamer-array"))) { ?>

<script type="text/javascript">... and so on ...
See also: http://codex.wordpress.org/Function_Ref ... get_the_ID
and http://codex.wordpress.org/Function_Ref ... _post_meta

Recording unique downloads on a per-post basis is not something s2Member does by default. So you may need to integrate a script of your own that records this information as the video is viewed. Please note this documentation regarding "count_against_user" => true. See: viewtopic.php?f=40&t=12453#src_doc_s2member_file_download_url%28%29

Re: Video playback/performance across multiple platforms

PostPosted: October 20th, 2011, 5:24 pm
by Jason Caldwell
PS. I know WordPress might be the wrong option for this kind of site but We started with WordPress as a simple video site and now it's all over the place.
I think you're doing just fine. Seems like a good fit for WordPress to me :)

Re: Video playback/performance across multiple platforms

PostPosted: November 8th, 2011, 12:23 pm
by drbyte
Hi Jason

Thank you for the code. Works as it should be.

Sorry for not being around here lately, got me couple of heavy duty projects. The custom post type updates in your latest release are awesome. Thank you

Sam