aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Playing video's according schedule Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Playing video Watch "Playing video New topic
Author

Playing video's according schedule

siva sankar
Ranch Hand

Joined: Jul 13, 2006
Posts: 68
hi all,
I developed an application using jmf and swings which plays video clip's,scrolling text and pop-up window(panel) on a screen playing according to schedule ,

1.The problem is that we are getting blank screen between the video clips.

2. For ex.there are 5 playlist in schedular, but has to play according schedule but the playlist is not in the loop which should play for 24 hrs schedule.

we have tried on adjusting time concept but still the problem we are facing.
could you please refer the code and let us know if any issues are there.
Awaiting reply.
.
import javax.swing.*;
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import java.lang.String;
import java.io.IOException;
import javax.media.*;
import java.io.*;
import java.lang.*;

//class playlist extends Date
class scheduler extends Date
{
long hou;
int min;
int sec;
long readtime()
{
Date date =new Date();
hou = date.getHours();
hou *=100;
min = date.getMinutes();
hou +=min;
hou *=100;
sec = date.getSeconds();
hou +=sec;
return hou;
// this method to read the present time and club in to long format
// like long = hou * min ; // seconds we are not concedaring
}
long comparetime( long pretime, long playtime)
{
//int time_elaps;
if(pretime > playtime) return (-1);
else if (pretime < playtime)return (playtime - pretime);
else return (0);
// compare the present time and play list time and send the diffrernce
}
};

class cMEsigns
{
public static void main(String[] args) throws Exception
{
Que q = new Que();
String stMessage="this a message from main";
String stPath=null;
String stPlayerPath=null;
//String path=null;
//playlist plist = new playlist(); // our own play list
scheduler slist = new scheduler (); // our own play list
//////////////////////////////////////////////////////////////////////////////////////////////
Split mainFrame= new Split(q);
mainFrame.setUndecorated(true);
mainFrame.pack();
mainFrame.setVisible(true);
//////////////////////////////////////////////////////////////////////////////////////////////

/*******************PopupVideoplay class***************/
PopUpVideoPlay fa=null ;
//////////////////////////////////////////////////////////////////////////////////////////////
//String url="file:C:/alien.mpg";
//String url="file:C:/Final-Bird.mpeg";
String url="file:C:/icici.mpg";
MediaLocator ml;
//Create a media Loacator from the file name
if ((ml = new MediaLocator(url)) == null)
{
System.err.println("Cannot build media locator from: " +url);
//if(fa.open(ml))
System.exit(0);
}
//////////////////////////////////////////////////////////////////////////////////////////////
FileReader sfr = null;
FileReader pfr = null;
BufferedReader sbr=null;
BufferedReader pbr=null;
StringTokenizer ss=null;
long TimeStamp=0;
long playingTime=0;
long tStamp=0;
boolean m_newPlaylist=false;
boolean m_scheduler=true;
boolean m_oncePlayListFound=false;

while(true)
{
//Thread.sleep(1000);
Thread.sleep(500);
if(playingTime!=0)playingTime--;
///////////////////////////////////////schedular related////////////////////////////////////////////////
//long tStamp = slist.comparetime(slist.readtime(),PlayListTime);
tStamp= slist.comparetime(slist.readtime(),TimeStamp );
System.out.println( "time is :" +tStamp);

if(tStamp==0)
{
stPath = ss.nextToken();
m_newPlaylist =true;
}
else if (tStamp <0)
{
tStamp=0;
}

if(m_scheduler)
{
m_scheduler=false;
//sfr = new FileReader("scheduler.txt");
sfr = new FileReader("scheduler.html");
sbr = new BufferedReader(sfr);
tStamp=0;
}
if(tStamp==0)
{
String st = sbr.readLine();
if(st != null)
{
ss = new StringTokenizer(st,"*");
String x = ss.nextToken();
TimeStamp = Integer.valueOf(x);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/*if(TimeStamp==1)
{
break;
}
if(TimeStamp==242400)
{
q.put(TimeStamp,x);
q.putMsg(x);
tStamp=1;
break;
}*/
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
else {m_scheduler = true;}
}
// Read the play list time
// Compare the with current system time
// if it is zero m_newPlaylist =1; and stPath = playlist
//
//////////////////////////////////////// playlist related//////////////////////////////////////////////////
if(m_newPlaylist)
{
m_newPlaylist=false;
m_oncePlayListFound=true;
if(stPath!=null)
{
pfr = new FileReader(stPath);
pbr = new BufferedReader(pfr);
playingTime=0;
}
}

if((playingTime==0)&&(m_oncePlayListFound==true))
{
stPlayerPath=pbr.readLine();
if(stPlayerPath!=null)
{
//System.out.println(stPlayerPath) ;
StringTokenizer t=new StringTokenizer(stPlayerPath,"*");
Stringpath= t.nextToken();
String time= t.nextToken();
playingTime = Integer.valueOf(time);
q.put(playingTime,path);
q.putMsg(path);
//System.out.println(path + " " +time);
System.out.println(path);

/************///////////////////////////childprocesss///////*****************/
Thread.sleep(1000);
fa = new PopUpVideoPlay();
//SmallVideoplay fa=new SmallVideoplay();
System.out.println("Pop-up Video is created");
if (!fa.open(ml))
fa.dispose();
if (ml!=null)
System.out.println("Medialocatror is:"+ml);
Thread.sleep(15000);
fa.setVisible(false);
System.out.println("Pop-up Video play is Finished and Exited ");
//System.exit(0);
/*****************///////////////////////////childprocesss//////***************/
/*if(TimeStamp==-1)
{
break;
}
if(TimeStamp ==242400)
{
q.put(TimeStamp,path);
q.putMsg(path);
TimeStamp=1;
break;
}*/
}
else
{
m_newPlaylist=true;
}

}
}
}
}




Thanks in Advance.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Playing video's according schedule