@@ -46,8 +46,12 @@ def pytest_selenium_capture_debug(item, report, extra):
46
46
if not provider .uses_driver (item .config .getoption ("driver" )):
47
47
return
48
48
49
+ session_id = item ._driver .session_id
50
+ auth_url = get_auth_url (
51
+ "https://testingbot.com/tests/{}.mp4" .format (session_id ), provider , session_id
52
+ )
49
53
pytest_html = item .config .pluginmanager .getplugin ("html" )
50
- extra .append (pytest_html .extras .html (_video_html (item . _driver . session_id )))
54
+ extra .append (pytest_html .extras .html (_video_html (auth_url , session_id )))
51
55
52
56
53
57
@pytest .mark .optionalhook
@@ -97,47 +101,25 @@ def driver_kwargs(request, test, capabilities, host, port, **kwargs):
97
101
return kwargs
98
102
99
103
100
- def _video_html (session ):
101
- flash_vars = 'config={{\
102
- "clip":{{\
103
- "url":"{session}",\
104
- "provider":"rtmp"}},\
105
- "plugins":{{\
106
- "controls":{{\
107
- "url":"http://testingbot.com/assets/\
108
- flowplayer.controls-3.2.14.swf",\
109
- "mute":null,\
110
- "volume":null}},\
111
- "rtmp":{{\
112
- "url":"http://testingbot.com/assets/\
113
- flowplayer.rtmp-3.2.11.swf",\
114
- "netConnectionUrl":"rtmp://s2tuay45tyrz3f.cloudfront.net/\
115
- cfx/st"}}}},\
116
- "playerId":"mediaplayer{session}",\
117
- "playlist":[{{\
118
- "url":"{session}",\
119
- "provider":"rtmp"}}]}}' .format (
120
- session = session
121
- )
122
-
104
+ def _video_html (video_url , session ):
123
105
return str (
124
106
html .div (
125
- html .object (
126
- html .param (value = "true" , name = "allowfullscreen" ),
127
- html .param (value = "always" , name = "allowscriptaccess" ),
128
- html .param (value = "high" , name = "quality" ),
129
- html .param (value = "#000000" , name = "bgcolor" ),
130
- html .param (value = "opaque" , name = "wmode" ),
131
- html .param (value = flash_vars .replace (" " , "" ), name = "flashvars" ),
107
+ html .video (
108
+ html .source (src = video_url , type = "video/mp4" ),
132
109
width = "100%" ,
133
110
height = "100%" ,
134
- type = "application/x-shockwave-flash" ,
135
- data = "http://testingbot.com/assets/flowplayer-3.2.14.swf" ,
136
- name = "mediaplayer_api" ,
137
- id = "mediaplayer_api" ,
111
+ controls = "controls" ,
138
112
),
139
113
id = "mediaplayer{session}" .format (session = session ),
140
114
style = "border:1px solid #e6e6e6; float:right; height:240px;"
141
115
"margin-left:5px; overflow:hidden; width:320px" ,
142
116
)
143
117
)
118
+
119
+
120
+ def get_auth_url (url , provider , session_id ):
121
+ from hashlib import md5
122
+
123
+ key = "{0.key}:{0.secret}:{1}" .format (provider , session_id )
124
+ token = md5 (key .encode ("utf-8" )).hexdigest ()
125
+ return "{}?auth={}" .format (url , token )
0 commit comments