Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with dynamic source #19

Open
calvinkei opened this issue Mar 30, 2016 · 7 comments
Open

Problems with dynamic source #19

calvinkei opened this issue Mar 30, 2016 · 7 comments

Comments

@calvinkei
Copy link

Hi, I have a problem with using dynamic source.
My app's idea is to go to firebase and retrieve an array of links of videos, and play the videos one by one like a playlist.
Using ionic-cache-src, even if the device is offline, videos can still be played (the links are stored in local storage when they are retrieved from firebase, so even if it's in offline state, the links are still available)
Now the problem is, when I test the app in a web browser, everything works well as expected even when the device is offline. But when I try to deploy on a device, the videos can't be loaded when it's offline.

        <video autoplay ui-event="{ended:'next()'}">
          <source cache-src="{{link}}" type="video/mp4">
        </video>

One more thing, when the "{{link}}" part is changed to the actual url of the video, it works perfectly.
Thanks for help!

@scripter-co
Copy link

@calcal12 I came across this issue today, and I'd actually say it's not an issue with this plugin (and shouldn't be dealt with here either).

As you know, the scoped variable hasn't been assign by the time the directive runs, so the solution to this problem is to apply an ng-if="link" on your video tag, that way, your element wont be placed on the dom until your link is assigned.

@antonfire
Copy link

Replace all instances of scope.$watch('attrs.cacheSrc', with attrs.$observe('cacheSrc', in the js file.

@scripter-co
Copy link

@antonfire PR?

@antonfire
Copy link

@scripter-co see PR #21

@FredeHo
Copy link

FredeHo commented Aug 5, 2016

Has this issue been solved yet? I'm having problems with dynamic URLs (running Android 6) as well. I tried both scope.$watch and attrs.$observe versions. When hardcoding the URL into cache-src it's working fine. The URL I'm trying to cache-src is stored in my Firebase. Thanks you!

@antonfire
Copy link

Hi @FredeHo attrs.$observe works, can you provide a url? If stored in firebase do you mean the url is stored in firebase or a base64 string is stored in firebase? If url please provide an example and I'll see if I can help.

@FredeHo
Copy link

FredeHo commented Aug 9, 2016

Hi @antonfire, yes the URL is stored in the Firebase (its actually a url to a image stored in Firebase Storage). I also found the solution: It seems the URL is already encoded, so it only worked with encode-uri="false. Thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants