0

Hello i need to be able to
play short music files(mp3) (3sec Max)
on click event.(on client side)
already tried javascript
the files located in blob storage
any tips/pointers.
thanks
ori

Edited by oriel

2
Contributors
1
Reply
9
Views
1 Year
Discussion Span
Last Post by NextCom
0

It may be better solutions out there, but i have solved it this way:
1. I have created a folder on the webserver that empties every night
2. When a visitor clicks on playing the MP3 file I use FSO to look if it exists in the temp folder with the filename: <TABLENAME>_<RECORDID>.mp3
3. If it exists it plays the file right away, if not it gets downloaded from blog to the server with the procedure bellow.

CREATE PROCEDURE [dbo].[BinaryToFile] (@FilePath VARCHAR(MAX), @Binary VARBINARY(max)) AS
BEGIN
    SET NOCOUNT ON;

    DECLARE @init int

    EXEC sp_OACreate 'ADODB.Stream', @init OUTPUT; -- An instace created
    EXEC sp_OASetProperty @init, 'Type', 1; -- Set property value to the instance
    EXEC sp_OAMethod @init, 'Open'; -- Calling a method
    EXEC sp_OAMethod @init, 'Write', NULL, @Binary; -- Calling a method
    EXEC sp_OAMethod @init, 'SaveToFile', NULL, @FilePath, 2; -- Calling a method
    EXEC sp_OAMethod @init, 'Close'; -- Calling a method
    EXEC sp_OADestroy @init; -- Closed the insatnce
END
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.