So I've built an iPhone template for PHPMotion which is based on iWebkit and I figured it was time it made it's debut. I wrote queries into iWebkit so that it presents the contents of PHPMotion's database to the user in a form that makes iPhones, iPads and Androids happy. You can see a sample of my full site as well as the mobile site.
The key to this template is getting PHPMotion to convert the files to mp4 so that the iphone is happy with that. To do that i wrote a conversion script that is to be run in a cron job (mine is set to every 10 mins). So that it converts the videos that have been uploaded in the past 10 minutes to the iphone friendly mp4 format.
If you don't see the --enable-libfaac, then you are out of luck and will have to recompile ffmpeg. Below are basic instructions on how to get this working on your site.# ffmpeg
FFmpeg version 0.5, Copyright (c) 2000-2009 Fabrice Bellard, et al.
configuration: --prefix=/usr --libdir=/usr/lib --shlibdir=/usr/lib --mandir=/usr/share/man --incdir=/usr/include --enable-libamr-nb --enable-libamr-wb --enable-libdirac --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-gpl --enable-nonfree --enable-postproc --enable-pthreads --enable-shared --enable-swscale --enable-x11grab
Download PHPMotion Iphone Template
I offer up this template and converter script to you free, I'll do my best to help you get it installed but can't make any guarantees. If it works for you and you want to show some love I've provided a donate button below... no pressure, but I do love love... ;)
Install instructions:
- download template package (see link above)
- unpack and copy to a directory inside phpmotion. (I chose "ip")
- so when you go to http://yoursite.com/ip you will see the new iphone template.
- edit ip/inc/main.inc.php
- enter your database name, database user, and database password in the variables.
$db_user ="your_db_user"; // this is your databse user
$db_pass ="your_db_password"; // this is your database password
- copy vid_script/converter to your uploads directory and configure the variables inside the script
- Make sure to chmod a+x converter (otherwise it won't run)
- setup cron to run every 10 mins
- insert redirects into phpmotions pages to redirect people who are visiting on their iphone/ipad/android phones. (see examples below)
this is what a redirect should look like for the iphone:
$browser = strpos($_SERVER['HTTP_USER_AGENT'],"iPhone");
if ($browser == true) { header("Location: http://yoursite.com/ip/vidview.php?vidid=$vid"); }
$browser = strpos($_SERVER['HTTP_USER_AGENT'],"iPhone");
if ($browser == true) { header("Location: http://yoursite.com/ip/picview.php?imgid=$image_id"); }
Note: make sure to change the yourstie.com in the urls above with your site.
Helpful links:
Support Forum
My Projects
- PHPMotion iPhone Template
- iPhone Routing Switcher Controller
- Video Production Comm System
- Video Multi-Viewer