Beispiel #1
0
 def preview(self, obj):
     """An IFrame containing the JWPlatform hosted video."""
     url = api.player_embed_url(obj.key,
                                settings.JWPLATFORM_EMBED_PLAYER_KEY,
                                'html')
     return format_html(
         '<iframe width="640" height="360" src="{}"></iframe>', url)
Beispiel #2
0
 def embed_url(self):
     """
     Return a URL with an embed view of a :py:class:`mediaplatform.MediaItem`. Returns ``None``
     if there is no JWP video associated with the item.
     """
     return jwplatform.player_embed_url(
         self.key, settings.JWPLATFORM_EMBED_PLAYER_KEY, format='html')
Beispiel #3
0
 def test_basic_functionality(self):
     with mock.patch('time.time') as time:
         time.return_value = 123456
         expected_url = api.player_embed_url(self.item.jwp.key,
                                             'mock-key',
                                             format='html')
         response = self.view(self.get_request, pk=self.item.id)
     self.assertRedirects(response,
                          expected_url,
                          fetch_redirect_response=False)
Beispiel #4
0
    def player_html_url(self, obj):
        """
        Get a link to the HTML JWPlayer for the matching video or None if there is no matching JWP
        video.

        """
        if obj.jwp is None:
            return None
        return api.player_embed_url(obj.jwp.key,
                                    settings.JWPLATFORM_EMBED_PLAYER_KEY,
                                    'html')
Beispiel #5
0
 def player_html_url(self, obj):
     return api.player_embed_url(obj.key,
                                 settings.JWPLATFORM_EMBED_PLAYER_KEY,
                                 'html')