Order Now AdSolution Sign Up | Login » Bits on the Run Sign Up | Login »

Forums

/

Play video daily

6 replies [Last post]

Hi there!

I was wondering if it's possible to use this player to post a different video everyday. I wanted the player to automatically change the videos stored in my server.
For example: 01/01/2001 plays video1.flv 02/01/2001 plays video2.flv
Any ideias for this?

Thanks in advance

 
Create a file URI before your SWFObject JavaScript code, then use that URI in your SWFObject code.

  <script type="text/javascript">
    var file = 'http://www.domain.com/path/video' + new Date().getDate() + '.flv';

    var flashvars =
    {
      'file':                  encodeURIComponent(file),
      'image':                 encodeURIComponent('http://www.domain.com/path/image.jpg'),
      'playlist':             'bottom',
      'playlistsize':         '120',
      >>>> the rest of your JavaScript <<<<
  </script>

Thank you very much.

So in that method It's possible to create 31 files. The getDate() get's the day right? So after one month the videos would repeat?

Is it possible to get the month and year on one variable?

Even if the name of the video has to be something like:

video10012009 corresponding to the video of 10th January 2009 ?

there is a good javascript reference here: http://www.w3schools.com/jsref/jsref_obj_date.asp

var file = 'http://www.domain.com/path/video' + new Date().getDate() + new Date().getMonth() + new Date().getFullYear() + '.flv';

I'm having a hard ime doing this simple thing.. I just know this way, how does the creating the var flashvars works on the SWFObject after? Sorry for the time loss with this

<script type='text/javascript'>

var file = 'http://www.domain.com/path/video' + new Date().getDate() + new Date().getMonth() + new Date().getFullYear() + '.flv';

var so = new SWFObject('/mediaplayer/player.swf','mpl','512','410','9');
so.addParam('allowfullscreen','true');
so.addParam('allowscriptaccess','always');
so.addParam('wmode','opaque');

so.addVariable('author','authorname');
so.addVariable('description','descriptionhere');
so.addVariable('duration','300');
so.addVariable('file','encodeURIComponent(file)');
so.addVariable('image','http://imageurl.jpg');
so.addVariable('logo','http://logourl.jpg');
so.addVariable('controlbar','none');
so.addVariable('repeat','always');
so.write('mediaspace');
</script>

two issues:

1) months are numbered from 0-11, so add 1 to the month

2) do not wrap encodeURIComponent(file) in quotes.

<script src="swfobject.js"></script>

<div id="mediaspace"><a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash">Get the Flash Plugin to see this video.</a></div>

<script type='text/javascript'>
var file = 'http://www.domain.com/path/video' + new Date().getDate() + <strong>(new Date().getMonth() + 1)</strong> + new Date().getFullYear() + '.flv';
var so = new SWFObject('/mediaplayer/player.swf', 'mpl', '512', '410', '9.0.124');
    so.addParam('allowscriptaccess',   'always');
    so.addParam('allowfullscreen',     'true');
    so.addVariable('author',           'authorname');
    so.addVariable('description',      'descriptionhere');
    so.addVariable('duration',         '300');
    so.addVariable('file',              <strong>encodeURIComponent(file)</strong>);
    so.addVariable('image',            'http://imageurl.jpg');
    so.addVariable('logo',             'http://logourl.jpg');
    so.addVariable('controlbar',       'none');
    so.addVariable('repeat',           'always');
    so.write('mediaspace');
</script>