Updated API function 'plyr.source()' to get media source
Currently, there is no simple way of acquiring media source. This commit updates the 'source' API function to allow developers to acquire the video source regardless of whether the video is a youtube-embed or HTML5 video. Future embeds just need their respective URL fetching code added to this common function.
This commit is contained in:
10
readme.md
10
readme.md
@ -356,10 +356,10 @@ Here's a list of the methods supported:
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>source(...)</code></td>
|
||||
<td>String or Array</td>
|
||||
<td>String or Array or (null|undefined)</td>
|
||||
<td>
|
||||
Set the media source.
|
||||
<br><br>
|
||||
Get/Set the media source.
|
||||
<br><br>
|
||||
<strong>string</strong><br>
|
||||
<code>.source("/path/to/video.mp4")</code><br>
|
||||
This will set the <code>src</code> attribute on the <code>video</code> or <code>audio</code> element.
|
||||
@ -370,6 +370,9 @@ Here's a list of the methods supported:
|
||||
<br><br>
|
||||
<strong>YouTube</strong><br>
|
||||
Currently this API method only accepts a YouTube ID when used with a YouTube player. I will add URL support soon, along with being able to swap between types (e.g. YouTube to Audio or Video and vice versa.)
|
||||
<br><br>
|
||||
<strong> null or undefined </strong><br>
|
||||
Returns the current media source. Works for both native videos and embeds.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -504,3 +507,4 @@ Also these links helped created Plyr:
|
||||
|
||||
## Copyright and License
|
||||
[The MIT license](license.md).
|
||||
|
||||
|
Reference in New Issue
Block a user