javascript - Youtube blob urls don't work in browsers but in src -


first,i know there no blob urls objects.
made own blob object video buffer , used in src of video tag blob://website.com/blabla . opened url in new tab of chrome browser worked when tried open url of youtube video src new tab did't work mine blob worked charm why that?
can make own system blob not work in browsers in src?
kind of htaccess code can use?
lets copy blob url in src of image

its working , don't want work

and don't want work in new tab.

the question seems vague me, here interpret (also code in fiddle-images in question):

  • you receive blob (image's binary data) through xmlhttprequest() get-request (responsetype = 'blob')
  • you create blob url url.createobjecturl() in url store xmlhttprequest() response-object (the blob holding binary data)
  • you set resulting blob url-string src image (and append image document, thereby showing image downloaded)
  • you "don't want work in new tab" ("it" being blob url-string assume).

in comments say:

  • in fiddle inspected image , copied src , pasted in new tab , worked , showed image i don't want image shown directly blob url.

  • if go youtube , open src of video in new tab : not work,, i want happen

it appears me not want user able view/download blob when copy blob url-string (by examining live source or right-click-on-image>>copy imagelocation) , paste new tab/window (for give youtube example).

but also talking video's.

tl;dr: seems question/bounty might mixing 2 different types of url returned window.url.createobjecturl();:


here's what's happening fiddle in question's image and similar code downloaded video blob (where downloaded whole video-file's data/binary on server using xhr) or other 'local' data:
using 'bare' 'un-enhanced' file-api.
url store maintained during session (so survive page-refresh, since still same session) , lost when document unloaded.
so, if fiddle still open, fiddle-document (the document created blob url) not yet unloaded, , therefore it's blob urls available browser (any tab/window) long not revoked!
relevant feature: can build/download/modify blob in browser, create blob url , set href file-download link (which user can right-click , open in new tab/window!!)
close fiddle or revoke blob url url store , blob url no longer accessible (also not in different tab/window).

try modified fiddle: https://jsfiddle.net/7cyoozwv/
in fiddle should no longer possible load sample image different tab/window after copied image url (once image displayed in page).
here revoked url manually (revokeobjecturl()) best cross-browser method (partially due api not yet being stabilized).
note: element's onload event can elegant place revoke blob url.


here what's happening <audio> or <video> source linked mediasource object using mediasource object url returned window.url.createobjecturl(mediasource):
media source extensions (mse) also extend file-api's window.url.createobjecturl() accept mediasource object. (current draft of the) url object extension specifies that:

this algorithm intended mirror behavior of createobjecturl()[file-api] method autorevoke set true.

note current spec of file api's window.url.createobjecturl() no longer has autorevoke (or flag_onetimeonly) boolean flag accessible programmer should using window.url.createfor() purpose instead. wonder when media-source spec mimic (and backward compatibility alias createobjecturl() new createfor() extension (seems more appropriate how seems intended work currently)).

these resulting automatically revoked url-strings only intended link src of htmlmediaelement (think <audo> & <video> elements) special mediasource object.
i don't think empty document (from new tab/window) <audo> or <video> element.

perhaps "a quick tutorial on mse"(source: msdn) might clarify difference , basic use:

to use mse api, follow these steps:

  1. define html5 video element in html section of page.
  2. create mediasource object in javascript.
  3. create virtual url using createobjecturl mediasource object source.
  4. assign virtual url video element's src property.
  5. create sourcebuffer using addsourcebuffer, mime type of video you're adding.
  6. get video initialization segment media file online , add sourcebuffer appendbuffer.
  7. get segments of video data media file, append them sourcebuffer appendbuffer.
  8. call play method on video element.
  9. repeat step 7 until done.
  10. clean up.

you (or big-time player youtube dynamically select supported technologies playback on client's platform (so there no way tell sure kind of youtube video url's talking about)) could using new special mediasource object play video's (or audio).
adds buffer-based source options html5 video streaming support (compared to downloading complete video file before playing or use add-on silverlight or adobe flash stream media).

hope after!


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -