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.
-
2Youtube videos have very simple "embed" sample under them, all you'd have to do to display it with the pasted URL. Have you tried writing the Visualforce page yourself?– eyescreamCommented Jan 23, 2014 at 15:56
-
possible duplicate of How to upload videos into custom object record– Matt and NeilCommented Jan 23, 2014 at 16:38
Add a comment
|
1 Answer
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.