3

I am trying to use an Object URL with Videogular and a 0 second video shows up. Here is the code I am trying to use:

$http.get("/Video/small.mp4").success(function(data) {
    var blob = new Blob([data], { type: 'video/mp4' })
    val objectUrl = URL.createObjectURL(blob)
    controller.config.sources =
        [{ src: $sce.trustAsResourceUrl(objectUrl), type: "video/mp4" }]
});

If I don't use an Object URL then everything works as expected:

controller.config.sources = [
     { src: $sce.trustAsResourceUrl("/Video/small.mp4"), type: "video/mp4" }
]

I am eventually going to store the video in indexeddb which is why I am interested in playing the video using an Object URL.

rancidfishbreath
  • 3,944
  • 2
  • 30
  • 44
  • http://stackoverflow.com/questions/8732567/html-object-tag-should-we-specify-type-as-video-mp4-to-play-mp4-videos take look at this – Pankaj Parkar Feb 13 '15 at 19:46
  • @pankajparkar Thanks for the links. Unfortunately none of the articles linked off that answer address Object URLs. The articles address the tag which is different. – rancidfishbreath Feb 13 '15 at 20:28
  • Did you tried without $sce.trustAsResourceUrl? I don't think that a blob needs to be trusted since is an object. If it doesn't works maybe you need to write a plugin and access to the video element source through API. mediaElement.src to change the source. – elecash Feb 16 '15 at 09:40
  • Does anyone have an answer to this? I encountered the same issue. – Ethan Chen Mar 22 '17 at 14:28

0 Answers0