• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Problem in playing mp3 from databse in swf player

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have searched a lot and at last found this forum,and i think i can find my solutions here......

Q->I have stored all my songs in my oracle database my db table is like this...CREATE TABLE SONGS_TABLE(title varchar2(20),songs BLOB); .
Creating an admin page in jsp (insertSongs.jsp) i have inserted my data into the songs_table .And then in another jsp page (i.e songsList.jsp)
i have query for displaying only songs list from db code below...................................................................
String QueryString = "SELECT title from mysong";
rs = statement.executeQuery(QueryString);
%>


<%
while (rs.next()) {
String arr[]= new String [rs.getString("title").split("\\,").length];
int i;
for(i=0;i<arr.length;i++)
{
arr = rs.getString("title").split("\\,");

%>
<a href="Player.jsp?sid=<%=rs.getString("title")%>" ><input TYPE=checkbox NAME="chkSample" VALUE="<%=rs.getString("title")%>" ><%=rs.getString("title")%></a><BR>


<% } } %>
<%
// close all the connections.

rs.close();
statement.close();
connection.close();
} catch (Exception ex) {
%>
.......................................................................

Now My Problem is that how to play that songs or a list of songs on clicking on it to a swf player ie in my Player.jsp page...................................................................................

String QueryString = "SELECT * from mysong where title='"+request.getParameter("sid")+"'";
rs = statement.executeQuery(QueryString);
%>
<%
while (rs.next()) {
byte[] bytearray = new byte[10240];
int size=0;

InputStream songs;

//response.addHeader("Content-Disposition","filename=getsongs.mp3");
response.reset();
response.setContentType("audio/mpeg");
songs=rs.getBinaryStream(2);


while((size=songs.read(bytearray))!= -1)
{
response.getOutputStream().write(bytearray,0,size);
}
//response.flushBuffer();


%>

<object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" id="obj1" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" border="0" width="160" height="160">
<param name="movie" value="Player.swf">
<param name="src" value="<%=%>" >
<param name="quality" value="High">
<embed src="Player.swf" SRC="<%=%>" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="obj1" width="160" height="160">
</object>


<%songs.close(); %>
<% } %>
<%
// close all the connections.

rs.close();
statement.close();
connection.close();
} catch (Exception ex) {
%>
..........................................................................

My exact problem is that how to feed the songs or songs list to a swf player from database directly?
have i to create any dynamic .xml file or else for songs list to a swf player? if so how?
 
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI bikash,
Please use code tag for code, that will help a lot for reading code,
you can add by using edit button....
 
Rancher
Posts: 43026
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So "Player.swf" is a flash application that can play MP3s? If so, what does its documentation say?
 
Just let me do the talking. Ahem ... so ... you see ... we have this tiny ad...
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic