STR is all about frames, first you need to identify the frame in which you are asked to find the velocity. then after identifying this frame, note down what are the given velocitie...
see attached file it's very helpful for you dear ......and don't get confused about that type of prob.. I suggest uh 1st of all u should analysed carefully.. and after that u will ...
here note that question gave u the velocity of photon w.r t earth and spaceship.. sometimes u have to measure Velocity of photon in spaceship frame.. so formula remain same..