2

I am new to salesforce coding (apex) and I have a requirement: I have one text field on my visualforce page where a user will put you tube URL and there is a preview button on click of which he should be able to see the preview of the video on the same page without saving it to database.After he is done with preview there is a save button on click of which he should be able to save it(by save i mean save the YouTube URL) to some object.I explored and came to know sales force provide preview feature only for the file attached through feeder which gets stored in content document object but since my video size can be large in size I don't want to go by that way of previewing a video.Can some one please suggest any solution or code examples to do this.Thanks In advance.

2

1 Answer 1

1

In your visualforce page you'd have an apex:outputPanel who contains the youtube iframe and passe the field value (youtube url) as a parameter to the src attribute

<apex:outputPanel id="youtubePanel" rendered="{!url != ''}">    
    <iframe width="560" height="315" src="{!url}" frameborder="0"></iframe>
</apex:outputPanel>

And once you click your button the outputPanel is rerended with the video to watch.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .