Reputation: 3797
I am using one of the webrtc libraries to show video and attaching the stream received to video element. But when I inspect the video element, src
attribute is missing.
<video autoplay="" id="EKA-e2RERLzhCFy8AAEd" class="videoRoom"></video>
I have couple of questions here :
video
element to have no src
attribute.src
for that videoUpvotes: 1
Views: 3817
Reputation: 136678
Is it possible for video element to have no src attribute.
Yes it's possible.
The library you do use probably sets the srcObject
property of your videoElement.
This property allows to set the source of your video directly to a MediaStream, a MediaSource, a Blob or a File Object. Note that FF only supports MediaStreams currently.
Example for FF (inspect the element afterward)
navigator.mediaDevices.getUserMedia({video:true}).then(s=>(vid.srcObject = s));
<video id="vid" controls></video>
And a fiddle for chrome since it requires https
protocol for GUM to work.
If possible, how to get src for that video
Well, there is not really an src
so I'd say not possible.
You can still call yourVideoElement.srcObject
, but this will return the object to what it was set (usually a MediaStream).
If you need to record it, you can then use a MediaRecorder.
Upvotes: 7
Reputation: 280
<div class="col-sm-12">
<video width="400" controls>
<source src="http://ia800803.us.archive.org/17/items/MickeyMouse-RunawayTrain/Film-42.mp4" type="video/mp4">
</video>
</div>
In src place the video url you want
<video width="400" controls>
<source src="" type="video/mp4">
</video>
Upvotes: 0